Fix keyrepeat going crazy ;)
authorChris Michael <cp.michael@samsung.com>
Mon, 25 Nov 2013 07:47:52 +0000 (07:47 +0000)
committerChris Michael <cp.michael@samsung.com>
Mon, 25 Nov 2013 07:47:52 +0000 (07:47 +0000)
Previously, if you were hold down shift for 1-2 seconds and then press
a key, you would get superfluous key repeats (even tho you released
the printable key). This was because the "key repeat" code was not
checking for the same key before (re)starting the repeat timer.

This fixes the repeating key issue by checking if the key pressed is
different than the one already pressed. If so, it will (re)start the
timer. If it is not different, then the timer is already running and
we don't need to do anything.

Fixes T552

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wayland/ecore_wl_input.c

index 8e7255f..daa497c 100644 (file)
@@ -760,7 +760,7 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
         if (input->repeat.tmr) ecore_timer_del(input->repeat.tmr);
         input->repeat.tmr = NULL;
      }
-   else if (state)
+   else if ((state) && (keycode != input->repeat.key))
      {
         input->repeat.sym = sym;
         input->repeat.key = keycode;
@@ -770,8 +770,8 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
           {
              input->repeat.tmr = 
                ecore_timer_add(0.025, _ecore_wl_input_cb_keyboard_repeat, input);
-             ecore_timer_delay(input->repeat.tmr, 0.4);
           }
+        ecore_timer_delay(input->repeat.tmr, 0.4);
      }
 }