From 93c0372ed85ca8406edbfd4822692f01fa483093 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 1 Apr 2024 19:31:36 +0900 Subject: [PATCH] ecore_wl2: support the modal feature Change-Id: I00f11f25ac29c95f6d7fd89d6168eb00c195bb76 --- src/lib/ecore_wl2/Ecore_Wl2.h | 5 +++ src/lib/ecore_wl2/ecore_wl2_display.c | 4 +- src/lib/ecore_wl2/ecore_wl2_private.h | 4 ++ src/lib/ecore_wl2/ecore_wl2_window.c | 43 ++++++++++++++++++++++ .../engines/wayland/ecore_evas_wayland_common.c | 18 ++++++++- 5 files changed, 71 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 6e32849..da8262c 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -2660,6 +2660,11 @@ EAPI void ecore_wl2_window_cursor_visible_set(Ecore_Wl2_Window *win, Eina_Bool v EAPI Eina_Bool ecore_wl2_window_keyboard_grab(Ecore_Wl2_Window *win, unsigned int subtype); EAPI Eina_Bool ecore_wl2_window_keyboard_ungrab(Ecore_Wl2_Window *win); +// TIZEN_ONLY(20240327): Support for modal window +EAPI void ecore_wl2_window_modal_set(Ecore_Wl2_Window *window, Eina_Bool modal); +EAPI Eina_Bool ecore_wl2_window_modal_get(Ecore_Wl2_Window *window); +// + # undef EAPI # define EAPI diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index bb9a173..4547e4f 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -996,8 +996,8 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const // TIZEN_ONLY : To use tizen protocols else if (!strcmp(interface, "tizen_policy")) { - if (version >= 12) - client_version = 12; + if (version >= 13) + client_version = 13; else client_version = version; diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index bf038c1..a437188 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -373,6 +373,10 @@ struct _Ecore_Wl2_Window Eina_Bool input_set : 1; Eina_Bool opaque_set : 1; + // TIZEN_ONLY(20240327): support modal window + Eina_Bool modal : 1; + // + Eina_Bool focus_skip : 1; Eina_Bool floating : 1; diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 912e834..2d53cea 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -4737,3 +4737,46 @@ ecore_wl2_window_pin_mode_get(Ecore_Wl2_Window *window) return window->pinned; } // + +// TIZEN_ONLY(20240327): support modal window +EAPI void +ecore_wl2_window_modal_set(Ecore_Wl2_Window *window, Eina_Bool modal) +{ + EINA_SAFETY_ON_NULL_RETURN(window); + + INF("[WINDOW] win:%d, Set the Modal state:%d", window->resource_id, modal); + + uint32_t ver = wl_proxy_get_version((struct wl_proxy *)window->display->wl.tz_policy); +#ifdef TIZEN_POLICY_SET_MODAL_SINCE_VERSION + if (ver < TIZEN_POLICY_SET_MODAL_SINCE_VERSION) + { + ERR("[WINDOW] Modal is not supported on this version(%d). It is supported since version %d.", + ver, TIZEN_POLICY_SET_MODAL_SINCE_VERSION); + return; + } + + if (window->modal != modal) + { + if ((window->surface) && (window->display->wl.tz_policy)) + { + if (modal) + tizen_policy_set_modal(window->display->wl.tz_policy, window->surface); + else + tizen_policy_unset_modal(window->display->wl.tz_policy, window->surface); + } + } + + window->modal = modal; +#else + ERR("[WINDOW] Modal is not supported on this version(%d).", ver); + return; +#endif +} + +EAPI Eina_Bool +ecore_wl2_window_modal_get(Ecore_Wl2_Window *window) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); + return window->modal; +} +// diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 5d98a7d..b0fe77e 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -2604,6 +2604,20 @@ _ecore_evas_wl_common_aspect_set(Ecore_Evas *ee, double aspect) _ecore_evas_wl_common_resize(ee, ee->w, ee->h); } +// TIZEN_ONLY(20240327): support modal window +static void +_ecore_evas_wl_common_modal_set(Ecore_Evas *ee, Eina_Bool modal) +{ + Ecore_Evas_Engine_Wl_Data *wdata; + + wdata = ee->engine.data; + if (!wdata) return; + if (ee->prop.modal == modal) return; + ee->prop.modal = modal; + ecore_wl2_window_modal_set(wdata->win, modal); +} +// + static void _ecore_evas_wl_common_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip) { @@ -4056,7 +4070,9 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = NULL, // window group set _ecore_evas_wl_common_aspect_set, NULL, // urgent set - NULL, // modal set + // TIZEN_ONLY(20240327): support modal window + _ecore_evas_wl_common_modal_set, + // NULL, // demand attention set _ecore_evas_wl_common_focus_skip_set, NULL, -- 2.7.4