summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-06-09 12:43:50 -0500
committerDerek Foreman <derekf@osg.samsung.com>2016-06-09 12:43:50 -0500
commita4f64d6fcb3de6ff650e9a09b09c69edbb862146 (patch)
tree8779f45c2b31d625f266bf9ca60a4e4dcbc0289a
parent375179b47fa62dba2a1168d1e4e6a7ab877f7414 (diff)
ecore_wl2: Fix keyboard repeat handling
Recent timer changes broke keyboard repeat under wayland - while that will probably be fixed shortly, this should be more robust and more accurate anyway.
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c13
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h1
2 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 2b4a80419a..4761672222 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -780,6 +780,11 @@ _keyboard_cb_repeat(void *data)
780 780
781 _ecore_wl2_input_key_send(input, input->focus.keyboard, input->repeat.sym, input->repeat.key + 8, WL_KEYBOARD_KEY_STATE_PRESSED, input->repeat.time); 781 _ecore_wl2_input_key_send(input, input->focus.keyboard, input->repeat.sym, input->repeat.key + 8, WL_KEYBOARD_KEY_STATE_PRESSED, input->repeat.time);
782 782
783 if (!input->repeat.repeating)
784 {
785 ecore_timer_interval_set(input->repeat.timer, input->repeat.rate);
786 input->repeat.repeating = EINA_TRUE;
787 }
783 return ECORE_CALLBACK_RENEW; 788 return ECORE_CALLBACK_RENEW;
784 789
785out: 790out:
@@ -841,9 +846,9 @@ _keyboard_cb_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned
841 846
842 if (!input->repeat.timer) 847 if (!input->repeat.timer)
843 { 848 {
849 input->repeat.repeating = EINA_FALSE;
844 input->repeat.timer = 850 input->repeat.timer =
845 ecore_timer_add(input->repeat.rate, _keyboard_cb_repeat, input); 851 ecore_timer_add(input->repeat.delay, _keyboard_cb_repeat, input);
846 ecore_timer_delay(input->repeat.timer, input->repeat.delay);
847 } 852 }
848 } 853 }
849} 854}
@@ -903,8 +908,8 @@ _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED,
903 } 908 }
904 909
905 input->repeat.enabled = EINA_TRUE; 910 input->repeat.enabled = EINA_TRUE;
906 input->repeat.rate = (rate / 10000); 911 input->repeat.rate = (1.0 / rate);
907 input->repeat.delay = (delay / 1000); 912 input->repeat.delay = (delay / 1000.0);
908} 913}
909 914
910static const struct wl_keyboard_listener _keyboard_listener = 915static const struct wl_keyboard_listener _keyboard_listener =
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 680214a4a4..fce1245b69 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -404,6 +404,7 @@ struct _Ecore_Wl2_Input
404 unsigned int sym, key, time; 404 unsigned int sym, key, time;
405 double rate, delay; 405 double rate, delay;
406 Eina_Bool enabled : 1; 406 Eina_Bool enabled : 1;
407 Eina_Bool repeating : 1;
407 } repeat; 408 } repeat;
408 409
409 struct 410 struct