ecore_wl2_window: intercept aux hint that setting splitscreen 98/289998/10
authorJunseok Kim <juns.kim@samsung.com>
Fri, 17 Mar 2023 02:08:04 +0000 (11:08 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 29 Mar 2023 09:51:43 +0000 (09:51 +0000)
@tizen_only

Change-Id: I371bb4463d3a0a9f0032cf7108c7b02e94800cac

src/lib/ecore_wl2/ecore_wl2_private.h
src/lib/ecore_wl2/ecore_wl2_screen.c
src/lib/ecore_wl2/ecore_wl2_window.c

index a954cec..7947e58 100644 (file)
@@ -996,6 +996,7 @@ Eina_Bool _ecore_wl2_splitscreen_activated_get(Ecore_Wl2_Splitscreen *ewsp);
 Ecore_Wl2_Splitscreen_Region *_ecore_wl2_splitscreen_region_get(Ecore_Wl2_Splitscreen *ewsp, const char *name);
 void _ecore_wl2_splitscreen_region_assign_appid(Ecore_Wl2_Splitscreen_Region *ewsr, const char *appid);
 Eina_Bool _ecore_wl2_splitscreen_region_get_geometry(Ecore_Wl2_Splitscreen_Region *ewsr, int *x, int *y, int *w, int *h);
+Eina_Bool _ecore_wl2_screen_aux_hint_splitscreen_helper(Ecore_Wl2_Window *win, const char *hint, const char *val);
 //
 
 #endif
index 685d5b4..3cea415 100644 (file)
@@ -325,3 +325,66 @@ _ecore_wl2_splitscreen_region_del(Ecore_Wl2_Splitscreen_Region *ewsr)
      }
    free(ewsr);
 }
+
+Eina_Bool
+_ecore_wl2_screen_aux_hint_splitscreen_helper(Ecore_Wl2_Window *win, const char *hint, const char *val)
+{
+   Ecore_Wl2_Screen *ews = NULL;
+   Ecore_Wl2_Splitscreen *ewsp = NULL;
+   Ecore_Wl2_Splitscreen_Region *ewsr = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
+
+   if (!strcmp(hint, "wm.splitscreen.win.split_screen_manager.assign_region.sub1"))
+     {
+        ews = _ecore_wl2_display_screen_get(win->display);
+        if (!ews) return EINA_FALSE;
+
+        ewsp = _ecore_wl2_screen_splitscreen_get(ews);
+        if (!ewsp) return EINA_FALSE;
+
+        ewsr = _ecore_wl2_splitscreen_region_get(ewsp, "sub1");
+        if (!ewsr) return EINA_FALSE;
+
+        _ecore_wl2_splitscreen_region_assign_appid(ewsr, val);
+        return EINA_TRUE;
+     }
+   else if (!strcmp(hint, "wm.splitscreen.win.split_screen_manager.assign_region.sub2"))
+     {
+        ews = _ecore_wl2_display_screen_get(win->display);
+        if (!ews) return EINA_FALSE;
+
+        ewsp = _ecore_wl2_screen_splitscreen_get(ews);
+        if (!ewsp) return EINA_FALSE;
+
+        ewsr = _ecore_wl2_splitscreen_region_get(ewsp, "sub2");
+        if (!ewsr) return EINA_FALSE;
+
+        _ecore_wl2_splitscreen_region_assign_appid(ewsr, val);
+        return EINA_TRUE;
+     }
+   else if (!strcmp(hint, "wm.splitscreen.win.split_screen_manager.activate"))
+     {
+        ews = _ecore_wl2_display_screen_get(win->display);
+        if (!ews) return EINA_FALSE;
+
+        ewsp = _ecore_wl2_screen_splitscreen_get(ews);
+        if (!ewsp) return EINA_FALSE;
+
+        _ecore_wl2_splitscreen_activate(ewsp);
+        return EINA_TRUE;
+     }
+   else if (!strcmp(hint, "wm.splitscreen.win.split_screen_manager.deactivate"))
+     {
+        ews = _ecore_wl2_display_screen_get(win->display);
+        if (!ews) return EINA_FALSE;
+
+        ewsp = _ecore_wl2_screen_splitscreen_get(ews);
+        if (!ewsp) return EINA_FALSE;
+
+        _ecore_wl2_splitscreen_deactivate(ewsp);
+        return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}
index 2864043..2a31948 100644 (file)
@@ -3134,6 +3134,11 @@ ecore_wl2_window_aux_hint_generate(Ecore_Wl2_Window *win, const char *hint, cons
 
    if (!_ecore_wl2_window_aux_hint_list_add(win, id, hint, val))
      return -1;
+// TIZEN_ONLY(20230312): support wtz_split_screen
+// WORKAROUND: for temporary solution using wayland protocol instead of aux_hint
+   if (_ecore_wl2_screen_aux_hint_splitscreen_helper(win, hint, val))
+     return id;
+//
 
    // add aux hint
    if ((win->surface) && (win->display->wl.tz_policy))
@@ -3202,6 +3207,12 @@ ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, c
 {
    if (!win) return;
 
+// TIZEN_ONLY(20230312): support wtz_split_screen
+// WORKAROUND: for temporary solution using wayland protocol instead of aux_hint
+   if (_ecore_wl2_screen_aux_hint_splitscreen_helper(win, hint, val))
+     return;
+//
+
    // TIZEN_ONLY : To use tizen protocols
    if ((win->surface) && (win->display->wl.tz_policy))
      tizen_policy_add_aux_hint(win->display->wl.tz_policy, win->surface, id, hint, val);
@@ -3220,16 +3231,22 @@ ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, c
 EAPI void
 ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val)
 {
+   Ecore_Wl2_Window_Aux_Hint *ewah = NULL;
    if (!win) return;
 
+// TIZEN_ONLY(20230312): support wtz_split_screen
+// WORKAROUND: for temporary solution using wayland protocol instead of aux_hint
+   ewah = _ecore_wl2_window_aux_hint_get_by_id(win, id);
+   if (ewah && _ecore_wl2_screen_aux_hint_splitscreen_helper(win, ewah->hint, val))
+     return;
+//
+
    // TIZEN_ONLY : To use tizen protocols
    if ((win->surface) && (win->display->wl.tz_policy))
      tizen_policy_change_aux_hint(win->display->wl.tz_policy, win->surface, id, val);
    //
 
    // TIZEN_ONLY(20210330): for maintain internal aux hint list
-   Ecore_Wl2_Window_Aux_Hint *ewah = NULL;
-   ewah = _ecore_wl2_window_aux_hint_get_by_id(win, id);
    if (ewah)
      _ecore_wl2_window_aux_hint_list_change(win, ewah, val);
    //