summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochanlee <wc0917.lee@samsung.com>2020-01-22 07:37:11 -0500
committerChristopher Michael <cp.michael@samsung.com>2020-01-22 07:37:11 -0500
commitf1740535648a4d1c8d372376a727d23e61c68c5d (patch)
treed32eed34d36f8db41d8176acfd12827d9bddf696
parent700d87b3709c5eeb6fa7a238b24ae93e6fad4d68 (diff)
ecore_wl2: Add ecore_wl2_input_keyboard_repeat_set() API.
Summary: Add API to set input's keyboard repeat. get API was already there. Reviewers: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11131
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h11
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c20
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h1
3 files changed, 30 insertions, 2 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 6a54812204..eed6660c7e 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -1449,6 +1449,17 @@ EAPI Eina_Stringshare *ecore_wl2_input_name_get(Ecore_Wl2_Input *input);
1449EAPI Eina_Bool ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay); 1449EAPI Eina_Bool ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay);
1450 1450
1451/** 1451/**
1452 * Set the keyboard repeat rate and delay of an input
1453 * @param input The input
1454 * @param rate Pointer to store the repeat rate (in seconds)
1455 * @param rate Pointer to store the repeat delay (in seconds)
1456 * @return True if repeat is enabled
1457 * @ingroup Ecore_Wl2_Input_Group
1458 * @since 1.24
1459 */
1460EAPI Eina_Bool ecore_wl2_input_keyboard_repeat_set(Ecore_Wl2_Input *input, double rate, double delay);
1461
1462/**
1452 * Retrieves the mouse position of the seat 1463 * Retrieves the mouse position of the seat
1453 * 1464 *
1454 * @param input The seat 1465 * @param input The seat
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 6694f3687d..92cc9a52bd 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -1173,8 +1173,11 @@ _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED,
1173 } 1173 }
1174 1174
1175 input->repeat.enabled = EINA_TRUE; 1175 input->repeat.enabled = EINA_TRUE;
1176 input->repeat.rate = (1.0 / rate); 1176 if (!input->repeat.changed)
1177 input->repeat.delay = (delay / 1000.0); 1177 {
1178 input->repeat.rate = (1.0 / rate);
1179 input->repeat.delay = (delay / 1000.0);
1180 }
1178 ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed)); 1181 ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed));
1179 if (ev) 1182 if (ev)
1180 { 1183 {
@@ -1615,6 +1618,7 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int v
1615 input->repeat.rate = 0.025; 1618 input->repeat.rate = 0.025;
1616 input->repeat.delay = 0.4; 1619 input->repeat.delay = 0.4;
1617 input->repeat.enabled = EINA_TRUE; 1620 input->repeat.enabled = EINA_TRUE;
1621 input->repeat.changed = EINA_FALSE;
1618 1622
1619 wl_array_init(&input->data.selection.types); 1623 wl_array_init(&input->data.selection.types);
1620 wl_array_init(&input->data.drag.types); 1624 wl_array_init(&input->data.drag.types);
@@ -1814,6 +1818,18 @@ ecore_wl2_input_keymap_get(const Ecore_Wl2_Input *input)
1814} 1818}
1815 1819
1816EAPI Eina_Bool 1820EAPI Eina_Bool
1821ecore_wl2_input_keyboard_repeat_set(Ecore_Wl2_Input *input, double rate, double delay)
1822{
1823 EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
1824 EINA_SAFETY_ON_NULL_RETURN_VAL(input->display, EINA_FALSE);
1825 EINA_SAFETY_ON_FALSE_RETURN_VAL(input->wl.keyboard, EINA_FALSE);
1826 input->repeat.rate = rate;
1827 input->repeat.delay = delay;
1828 input->repeat.changed = EINA_TRUE;
1829 return input->repeat.enabled;
1830}
1831
1832EAPI Eina_Bool
1817ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay) 1833ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay)
1818{ 1834{
1819 EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE); 1835 EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 5178e8f3ea..0f8b7ffc09 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -508,6 +508,7 @@ struct _Ecore_Wl2_Input
508 double rate, delay; 508 double rate, delay;
509 Eina_Bool enabled : 1; 509 Eina_Bool enabled : 1;
510 Eina_Bool repeating : 1; 510 Eina_Bool repeating : 1;
511 Eina_Bool changed : 1;
511 } repeat; 512 } repeat;
512 513
513 struct 514 struct