From c1c005661486544c6c67e301008534386c0f9b9e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 4 Mar 2019 13:37:30 -0500 Subject: [PATCH] efl.ui.win: remove keygrab set/unset from eo api Summary: this is fundamentally incompatible with many display servers and will not ever be supported outside of legacy ref T7511 Depends on D8083 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7511 Differential Revision: https://phab.enlightenment.org/D8084 Change-Id: I3171b0218df8e65a8a0d1fea0698a55624659a0a --- src/lib/elementary/efl_ui_win.c | 139 ++++++++++--------------------- src/lib/elementary/efl_ui_win.eo | 50 ----------- 2 files changed, 43 insertions(+), 146 deletions(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index a7de8e7084..3157f0d018 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -7989,94 +7989,6 @@ _efl_ui_win_prop_focus_skip_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_B // } -EOLIAN static Eina_Bool -_efl_ui_win_keygrab_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *key, - Efl_Input_Modifier modifiers EINA_UNUSED, - Efl_Input_Modifier not_modifiers EINA_UNUSED, - int priority EINA_UNUSED, Efl_Ui_Win_Keygrab_Mode grab_mode) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef HAVE_ELEMENTARY_X - _internal_elm_win_xwindow_get(sd); - if (sd->x.xwin) - { - Ecore_X_Win_Keygrab_Mode x_grab_mode; - switch (grab_mode) - { - case ELM_WIN_KEYGRAB_SHARED: - x_grab_mode = ECORE_X_WIN_KEYGRAB_SHARED; - break; - case ELM_WIN_KEYGRAB_TOPMOST: - x_grab_mode = ECORE_X_WIN_KEYGRAB_TOPMOST; - break; - case ELM_WIN_KEYGRAB_EXCLUSIVE: - x_grab_mode = ECORE_X_WIN_KEYGRAB_EXCLUSIVE; - break; - case ELM_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE: - x_grab_mode = ECORE_X_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE; - break; - default: - return ret; - } - ret = ecore_x_window_keygrab_set(sd->x.xwin, key, 0, 0, 0, x_grab_mode); - } -// TIZEN_ONLY(20150722): Add ecore_wl_window_keygrab_* APIs -#elif defined HAVE_ELEMENTARY_WL2 - _elm_win_wlwindow_get(sd); - if (sd->wl.win) - { - Ecore_Wl2_Window_Keygrab_Mode wl_grab_mode; - switch (grab_mode) - { - case ELM_WIN_KEYGRAB_SHARED: - wl_grab_mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED; - break; - case ELM_WIN_KEYGRAB_TOPMOST: - wl_grab_mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST; - break; - case ELM_WIN_KEYGRAB_EXCLUSIVE: - wl_grab_mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE; - break; - case ELM_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE: - wl_grab_mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE; - break; - default: - return ret; - } - ret = ecore_wl2_window_keygrab_set(sd->wl.win, key, 0, 0, 0, wl_grab_mode); - } -// -#else - (void)sd; - (void)key; - (void)grab_mode; -#endif - return ret; -} - -EOLIAN static Eina_Bool -_efl_ui_win_keygrab_unset(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char *key, - Efl_Input_Modifier modifiers EINA_UNUSED, - Efl_Input_Modifier not_modifiers EINA_UNUSED) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef HAVE_ELEMENTARY_X - _internal_elm_win_xwindow_get(sd); - if (sd->x.xwin) - ret = ecore_x_window_keygrab_unset(sd->x.xwin, key, 0, 0); -// TIZEN_ONLY(20150722): Add ecore_wl_window_keygrab_* APIs -#elif defined HAVE_ELEMENTARY_WL2 - _elm_win_wlwindow_get(sd); - if (sd->wl.win) - ret = ecore_wl2_window_keygrab_unset(sd->wl.win, key, 0, 0); -// -#else - (void)sd; - (void)key; -#endif - return ret; -} - EOLIAN static void _efl_ui_win_focus_highlight_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Bool enabled) { @@ -10187,13 +10099,40 @@ EAPI Eina_Bool elm_win_keygrab_set(Elm_Win *obj, const char *key, Evas_Modifier_Mask modifiers EINA_UNUSED, Evas_Modifier_Mask not_modifiers EINA_UNUSED, - int priority, Elm_Win_Keygrab_Mode grab_mode) + int priority EINA_UNUSED, Elm_Win_Keygrab_Mode grab_mode) { // Note: Not converting modifiers as they are not used in the implementation - return efl_ui_win_keygrab_set(obj, key, - EFL_INPUT_MODIFIER_NONE, - EFL_INPUT_MODIFIER_NONE, - priority, grab_mode); + Eina_Bool ret = EINA_FALSE; +#ifdef HAVE_ELEMENTARY_X + Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); + _internal_elm_win_xwindow_get(sd); + if (sd->x.xwin) + { + Ecore_X_Win_Keygrab_Mode x_grab_mode; + switch (grab_mode) + { + case ELM_WIN_KEYGRAB_SHARED: + x_grab_mode = ECORE_X_WIN_KEYGRAB_SHARED; + break; + case ELM_WIN_KEYGRAB_TOPMOST: + x_grab_mode = ECORE_X_WIN_KEYGRAB_TOPMOST; + break; + case ELM_WIN_KEYGRAB_EXCLUSIVE: + x_grab_mode = ECORE_X_WIN_KEYGRAB_EXCLUSIVE; + break; + case ELM_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE: + x_grab_mode = ECORE_X_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE; + break; + default: + return ret; + } + ret = ecore_x_window_keygrab_set(sd->x.xwin, key, 0, 0, 0, x_grab_mode); + } +#else + (void)key; + (void)grab_mode; +#endif + return ret; } EAPI Eina_Bool @@ -10202,9 +10141,17 @@ elm_win_keygrab_unset(Elm_Win *obj, const char *key, Evas_Modifier_Mask not_modifiers EINA_UNUSED) { // Note: Not converting modifiers as they are not used in the implementation - return efl_ui_win_keygrab_unset(obj, key, - EFL_INPUT_MODIFIER_NONE, - EFL_INPUT_MODIFIER_NONE); + Eina_Bool ret = EINA_FALSE; +#ifdef HAVE_ELEMENTARY_X + Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); + _internal_elm_win_xwindow_get(sd); + if (sd->x.xwin) + ret = ecore_x_window_keygrab_unset(sd->x.xwin, key, 0, 0); +#else + (void)sd; + (void)key; +#endif + return ret; } EAPI Eina_Bool diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index 91b8ccfe1b..b8f9fbaa9b 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -91,24 +91,6 @@ enum Efl.Ui.Win_Indicator_Mode If user flicks the upper side of window, the indicator is shown temporarily.]] } -enum Efl.Ui.Win_Keygrab_Mode -{ - [[Define the keygrab modes of window. A window may send commands to the - Keyrouter according this mode, and perform different actions.]] - - unknown = 0, [[Unknown keygrab mode]] - shared = (1 << 8), [[Get the grabbed-key together with the other client - windows]] - topmost = (1 << 9), [[Get the grabbed-key only when window is top of the - stack]] - exclusive = (1 << 10), [[Get the grabbed-key exclusively regardless of - window's position]] - override_exclusive = (1 << 11) [[Get the grabbed-key exclusively - regardless of window's position. This is - overrided by grabs from the other client - window]] -} - enum Efl.Ui.Win_Modal_Mode { [[Defines the mode of a modal window]] @@ -723,38 +705,6 @@ class @beta Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Ac @in v: bool; [[If $true, center vertically. If $false, do not change vertical location.]] } } - keygrab_set { - [[Set keygrab value of the window - - This function grabs the $key of window using $grab_mode. - ]] - - return: bool; [[$true on success, $false otherwise]] - params { - @in key: string; [[This string is the keyname to grab.]] - @in modifiers: Efl.Input.Modifier; [[A combination of modifier keys - that must be present to trigger the event. Not supported yet.]] - @in not_modifiers: Efl.Input.Modifier; [[A combination of modifier - keys that must not be present to trigger the event. Not supported yet.]] - @in priority: int; [[Not supported yet.]] - @in grab_mode: Efl.Ui.Win_Keygrab_Mode; [[Describes how the key should - be grabbed, wrt. focus and stacking.]] - } - } - keygrab_unset { - [[Unset keygrab value of the window - - This function unset keygrab value. Ungrab $key of window. - ]] - return: bool; [[$true on success, $false otherwise]] - params { - @in key: string; [[This string is the keyname to grab.]] - @in modifiers: Efl.Input.Modifier; [[A combination of modifier keys - that must be present to trigger the event. Not supported yet.]] - @in not_modifiers: Efl.Input.Modifier; [[A combination of modifier keys - that must not be present to trigger the event. Not supported yet.]] - } - } move_resize_start { [[Start moving or resizing the window. -- 2.34.1