From dcd000f5d2319085638bce45cd268d1c5c60cefd Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Wed, 12 Apr 2023 16:48:47 +0900 Subject: [PATCH] ecore/evas: add flag for repeat key event Change-Id: I58ecb628dcbc5872c44c4609f421ba86bfabd445 --- src/lib/ecore/Ecore_Common.h | 5 +++-- src/lib/ecore_wl2/ecore_wl2_input.c | 8 +++++--- src/lib/evas/Evas_Common.h | 5 +++-- src/lib/evas/canvas/efl_input_types.eot | 4 ++++ src/lib/evas/canvas/evas_events.c | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h index d45ff8b..1e03d90 100644 --- a/src/lib/ecore/Ecore_Common.h +++ b/src/lib/ecore/Ecore_Common.h @@ -3475,14 +3475,15 @@ EAPI Ecore_Device_Subclass ecore_device_subclass_get(const Ecore_Device *dev); /** * @brief Flags for Events * - * @since_tizen 5.5 + * @since_tizen 7.5 */ typedef enum _Ecore_Event_Flags { ECORE_EVENT_FLAG_NONE = 0, /**< No fancy flags set */ ECORE_EVENT_FLAG_ON_HOLD = (1 << 0), /**< This event is being delivered but should be put "on hold" until the on hold flag is unset. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything */ ECORE_EVENT_FLAG_ON_SCROLL = (1 << 1), /**< This event flag indicates the event occurs while scrolling; for example, DOWN event occurs during scrolling; the event should be used for informational purposes and maybe some indications visually, but not actually perform anything */ - ECORE_EVENT_FLAG_CANCEL = (1 << 2) /**< This event flag indicates the event is canceled. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.*/ + ECORE_EVENT_FLAG_CANCEL = (1 << 2), /**< This event flag indicates the event is canceled. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.*/ + ECORE_EVENT_FLAG_REPEAT = (1 << 3) /**< This event flag indicates the event is repeated. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.*/ } Ecore_Event_Flags; /** diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index a2d680c..265ec67 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c @@ -956,7 +956,7 @@ _ecore_wl2_keyboard_dev_get(Ecore_Wl2_Input *input, int window_id) } static void -_ecore_wl2_input_key_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, xkb_keysym_t sym, xkb_keysym_t sym_name, unsigned int code, unsigned int state, unsigned int timestamp, Eina_Bool cancel) +_ecore_wl2_input_key_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, xkb_keysym_t sym, xkb_keysym_t sym_name, unsigned int code, unsigned int state, unsigned int timestamp, Eina_Bool cancel, Eina_Bool repeat) { Ecore_Event_Key *ev; char key[256] = "", keyname[256] = "", compose[256] = ""; @@ -982,6 +982,8 @@ _ecore_wl2_input_key_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, xkb_ ev->event_flags = ECORE_EVENT_FLAG_NONE; if (cancel) ev->event_flags |= ECORE_EVENT_FLAG_CANCEL; + if (repeat) + ev->event_flags |= ECORE_EVENT_FLAG_REPEAT; strcpy((char *)ev->keyname, keyname); strcpy((char *)ev->key, key); @@ -1409,7 +1411,7 @@ _keyboard_cb_repeat(void *data) input->repeat.sym, input->repeat.sym_name, input->repeat.key + 8, WL_KEYBOARD_KEY_STATE_PRESSED, - input->repeat.time, EINA_FALSE); + input->repeat.time, EINA_FALSE, EINA_TRUE); return ECORE_CALLBACK_RENEW; } @@ -1526,7 +1528,7 @@ _keyboard_cb_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned else { _ecore_wl2_input_key_send(input, window, sym, sym_name, code, - state, timestamp, _key_event_cancel); + state, timestamp, _key_event_cancel, EINA_FALSE); if (!xkb_keymap_key_repeats(input->xkb.keymap, code)) return; diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index df84cf9..5263bd7 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -366,14 +366,15 @@ typedef enum _Evas_Button_Flags /** * @brief Flags for Events * - * @since_tizen 5.5 + * @since_tizen 7.5 */ typedef enum _Evas_Event_Flags { EVAS_EVENT_FLAG_NONE = 0, /**< No fancy flags set */ EVAS_EVENT_FLAG_ON_HOLD = (1 << 0), /**< This event is being delivered but should be put "on hold" until the on hold flag is unset. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything */ EVAS_EVENT_FLAG_ON_SCROLL = (1 << 1), /**< This event flag indicates the event occurs while scrolling; for example, DOWN event occurs during scrolling; the event should be used for informational purposes and maybe some indications visually, but not actually perform anything */ - EVAS_EVENT_FLAG_CANCEL = (1 << 2) /**< This event flag indicates the event is canceled. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.*/ + EVAS_EVENT_FLAG_CANCEL = (1 << 2), /**< This event flag indicates the event is canceled. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.*/ + EVAS_EVENT_FLAG_REPEAT = (1 << 3) /**< This event flag indicates the event is repeated. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.*/ } Evas_Event_Flags; typedef enum _Evas_Aspect_Control diff --git a/src/lib/evas/canvas/efl_input_types.eot b/src/lib/evas/canvas/efl_input_types.eot index 9f9d8cb..b768aef 100644 --- a/src/lib/evas/canvas/efl_input_types.eot +++ b/src/lib/evas/canvas/efl_input_types.eot @@ -50,6 +50,10 @@ enum Efl.Input.Flags The event should be used for informational purposes and maybe some indications visually, but not actually perform anything.]] + repeated = (1 << 3), [[This event flag indicates the event is repeated. + The event should be used for informational purposes + and maybe some indications visually, but not actually + perform anything.]] } enum Efl.Input.Object_Pointer_Mode { diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c index d3014a6..2284498 100644 --- a/src/lib/evas/canvas/evas_events.c +++ b/src/lib/evas/canvas/evas_events.c @@ -3744,7 +3744,7 @@ _canvas_event_feed_key_down_internal(Evas_Public_Data *e, Efl_Input_Key_Data *ev evt = ev->eo; ev->modifiers = &(e->modifiers); ev->locks = &(e->locks); - ev->event_flags = (Efl_Input_Flags)e->default_event_flags; + ev->event_flags |= (Efl_Input_Flags)e->default_event_flags; if (ev->device) efl_ref(ev->device); if (e->grabs) -- 2.7.4