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
This commit is contained in:
parent
700d87b370
commit
f174053564
|
@ -1448,6 +1448,17 @@ EAPI Eina_Stringshare *ecore_wl2_input_name_get(Ecore_Wl2_Input *input);
|
|||
*/
|
||||
EAPI Eina_Bool ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay);
|
||||
|
||||
/**
|
||||
* Set the keyboard repeat rate and delay of an input
|
||||
* @param input The input
|
||||
* @param rate Pointer to store the repeat rate (in seconds)
|
||||
* @param rate Pointer to store the repeat delay (in seconds)
|
||||
* @return True if repeat is enabled
|
||||
* @ingroup Ecore_Wl2_Input_Group
|
||||
* @since 1.24
|
||||
*/
|
||||
EAPI Eina_Bool ecore_wl2_input_keyboard_repeat_set(Ecore_Wl2_Input *input, double rate, double delay);
|
||||
|
||||
/**
|
||||
* Retrieves the mouse position of the seat
|
||||
*
|
||||
|
|
|
@ -1173,8 +1173,11 @@ _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED,
|
|||
}
|
||||
|
||||
input->repeat.enabled = EINA_TRUE;
|
||||
input->repeat.rate = (1.0 / rate);
|
||||
input->repeat.delay = (delay / 1000.0);
|
||||
if (!input->repeat.changed)
|
||||
{
|
||||
input->repeat.rate = (1.0 / rate);
|
||||
input->repeat.delay = (delay / 1000.0);
|
||||
}
|
||||
ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed));
|
||||
if (ev)
|
||||
{
|
||||
|
@ -1615,6 +1618,7 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int v
|
|||
input->repeat.rate = 0.025;
|
||||
input->repeat.delay = 0.4;
|
||||
input->repeat.enabled = EINA_TRUE;
|
||||
input->repeat.changed = EINA_FALSE;
|
||||
|
||||
wl_array_init(&input->data.selection.types);
|
||||
wl_array_init(&input->data.drag.types);
|
||||
|
@ -1813,6 +1817,18 @@ ecore_wl2_input_keymap_get(const Ecore_Wl2_Input *input)
|
|||
return input->xkb.keymap;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_input_keyboard_repeat_set(Ecore_Wl2_Input *input, double rate, double delay)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(input->display, EINA_FALSE);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(input->wl.keyboard, EINA_FALSE);
|
||||
input->repeat.rate = rate;
|
||||
input->repeat.delay = delay;
|
||||
input->repeat.changed = EINA_TRUE;
|
||||
return input->repeat.enabled;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay)
|
||||
{
|
||||
|
|
|
@ -508,6 +508,7 @@ struct _Ecore_Wl2_Input
|
|||
double rate, delay;
|
||||
Eina_Bool enabled : 1;
|
||||
Eina_Bool repeating : 1;
|
||||
Eina_Bool changed : 1;
|
||||
} repeat;
|
||||
|
||||
struct
|
||||
|
|
Loading…
Reference in New Issue