ecore_wl2: add ecore_wl2_window_layout_set function 75/290275/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 22 Mar 2023 08:05:07 +0000 (17:05 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 22 Mar 2023 08:11:46 +0000 (17:11 +0900)
@tizen_only

Change-Id: Ie601b795d696220c0454e2614c3994d464c03600

src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_window.c

index fb8be68..077b1f8 100644 (file)
@@ -1328,6 +1328,11 @@ EAPI void ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool max
 EAPI void ecore_wl2_window_maximized_set_with_direction(Ecore_Wl2_Window *window, Ecore_Wl2_Maximize_Direction direction);
 //
 
+// TIZEN_ONLY(20230320): support a layout window
+EAPI Eina_Bool
+ecore_wl2_window_layout_set(Ecore_Wl2_Window * window, unsigned int num_cols, unsigned int num_rows, unsigned int column, unsigned int row, unsigned int col_span, unsigned int row_span);
+//
+
 /**
  * @internal
  *
index 7f7840d..2864043 100644 (file)
@@ -2279,6 +2279,52 @@ ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
    ecore_wl2_display_flush(window->display);
 }
 
+// TIZEN_ONLY(20230320): support a layout window
+EAPI Eina_Bool
+ecore_wl2_window_layout_set(Ecore_Wl2_Window * window, unsigned int num_cols, unsigned int num_rows, unsigned int column, unsigned int row, unsigned int col_span, unsigned int row_span)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(window->surface, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(window->display->wl.tz_policy, EINA_FALSE);
+
+   if ((col_span == 0) || (row_span == 0)) goto err_param;
+   if ((column + col_span) > num_cols) goto err_param;
+   if ((row + row_span) > num_rows) goto err_param;
+
+   uint32_t ver = wl_proxy_get_version((struct wl_proxy *)window->display->wl.tz_policy);
+
+#ifdef TIZEN_POLICY_SET_LAYOUT_SINCE_VERSION
+   if (ver < TIZEN_POLICY_SET_LAYOUT_SINCE_VERSION)
+     {
+        ERR("[WINDOW] Layout window is not supported on this version(%d). It is supported since version %d.",
+            ver, TIZEN_POLICY_SET_LAYOUT_SINCE_VERSION);
+        return EINA_FALSE;
+     }
+
+   // update saved size
+   window->saved = window->set_config.geometry;
+
+   // unset maximize state
+   ecore_wl2_window_maximized_set(window, EINA_FALSE);
+
+   ERR("[WINDOW] win:%d, CALL tizen_policy_layout_change... layout_size(%d,%d) set(%d,%d,%d,%d)",
+       window->resource_id, num_cols, num_rows, column, row, col_span, row_span);
+
+   tizen_policy_set_layout(window->display->wl.tz_policy, window->surface, num_cols, num_rows, column, row, col_span, row_span);
+
+   return EINA_TRUE;
+#else
+   ERR("[WINDOW] Layout window is not supported on this version(%d).", ver);
+   return EINA_FALSE;
+#endif
+
+err_param:
+   ERR("[WINDOW] win:%d, Error. Need to check parameter. num_cols:%d, num_rows:%d, col:%d, row:%d, col_span:%d, row_span:%d",
+       window->resource_id, num_cols, num_rows, column, row, col_span, row_span);
+   return EINA_FALSE;
+}
+//
+
 EAPI int
 ecore_wl2_window_rotation_get(Ecore_Wl2_Window *window)
 {