forked from enlightenment/efl
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.
This commit is contained in:
parent
375179b47f
commit
a4f64d6fcb
|
@ -780,6 +780,11 @@ _keyboard_cb_repeat(void *data)
|
||||||
|
|
||||||
_ecore_wl2_input_key_send(input, input->focus.keyboard, input->repeat.sym, input->repeat.key + 8, WL_KEYBOARD_KEY_STATE_PRESSED, input->repeat.time);
|
_ecore_wl2_input_key_send(input, input->focus.keyboard, input->repeat.sym, input->repeat.key + 8, WL_KEYBOARD_KEY_STATE_PRESSED, input->repeat.time);
|
||||||
|
|
||||||
|
if (!input->repeat.repeating)
|
||||||
|
{
|
||||||
|
ecore_timer_interval_set(input->repeat.timer, input->repeat.rate);
|
||||||
|
input->repeat.repeating = EINA_TRUE;
|
||||||
|
}
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -841,9 +846,9 @@ _keyboard_cb_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned
|
||||||
|
|
||||||
if (!input->repeat.timer)
|
if (!input->repeat.timer)
|
||||||
{
|
{
|
||||||
|
input->repeat.repeating = EINA_FALSE;
|
||||||
input->repeat.timer =
|
input->repeat.timer =
|
||||||
ecore_timer_add(input->repeat.rate, _keyboard_cb_repeat, input);
|
ecore_timer_add(input->repeat.delay, _keyboard_cb_repeat, input);
|
||||||
ecore_timer_delay(input->repeat.timer, input->repeat.delay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -903,8 +908,8 @@ _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
input->repeat.enabled = EINA_TRUE;
|
input->repeat.enabled = EINA_TRUE;
|
||||||
input->repeat.rate = (rate / 10000);
|
input->repeat.rate = (1.0 / rate);
|
||||||
input->repeat.delay = (delay / 1000);
|
input->repeat.delay = (delay / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_keyboard_listener _keyboard_listener =
|
static const struct wl_keyboard_listener _keyboard_listener =
|
||||||
|
|
|
@ -404,6 +404,7 @@ struct _Ecore_Wl2_Input
|
||||||
unsigned int sym, key, time;
|
unsigned int sym, key, time;
|
||||||
double rate, delay;
|
double rate, delay;
|
||||||
Eina_Bool enabled : 1;
|
Eina_Bool enabled : 1;
|
||||||
|
Eina_Bool repeating : 1;
|
||||||
} repeat;
|
} repeat;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|
Loading…
Reference in New Issue