From 57d1e361e61c3dac131f1e790db6318c3f0a005f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 22 Feb 2024 10:24:17 +0900 Subject: [PATCH] ecore_wl2: wait for receiving result of keygrab_set/unset Change-Id: I6b5e5f4d4d7913ca76abf3765fdc073d6b99d3ac Signed-off-by: Jihoon Kim --- src/lib/ecore_wl2/ecore_wl2_input.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index c7399dc..94a8f0f 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c @@ -46,6 +46,8 @@ #include // +#define MAX_WAIT_COUNT 20 + typedef struct _Ecore_Wl2_Mouse_Down_Info { EINA_INLIST; @@ -2941,6 +2943,17 @@ _ecore_wl2_keygrab_error_set() else set_last_result(TIZEN_ERROR_NONE); } +static void +_ecore_wl2_keygrab_result_wait(Ecore_Wl2_Display *ewd) +{ + unsigned int wait_count = 0; + while ((_ecore_wl2_keygrab_error == -1) && (wait_count < MAX_WAIT_COUNT)) + { + wl_display_dispatch(ewd->wl.display); + wait_count++; + } +} + //I'm not sure that keygrab function should be changed to Ecore_evas_XXX. //In the future, keyrouter feature can be added upstream or finish stabilizing. //After that time, we maybe change API name or other thing. @@ -3037,6 +3050,8 @@ ecore_wl2_window_keygrab_set(Ecore_Wl2_Window *win, const char *key, int mod EIN /* Send sync to wayland compositor and register sync callback to exit while dispatch loop below */ ecore_wl2_display_sync(ewd); + _ecore_wl2_keygrab_result_wait(ewd); + INF("After keygrab _ecore_wl2_keygrab_error = %d", _ecore_wl2_keygrab_error); if (!_ecore_wl2_keygrab_error) { @@ -3133,6 +3148,8 @@ ecore_wl2_window_keygrab_unset(Ecore_Wl2_Window *win, const char *key, int mod E /* Send sync to wayland compositor and register sync callback to exit while dispatch loop below */ ecore_wl2_display_sync(ewd); + _ecore_wl2_keygrab_result_wait(ewd); + INF("After keygrab unset _ecore_wl2_keygrab_error = %d", _ecore_wl2_keygrab_error); if (!_ecore_wl2_keygrab_error) { -- 2.7.4