e_policy_wl: support tizen_policy_set_layout request 46/290246/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 22 Mar 2023 01:40:21 +0000 (10:40 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 22 Mar 2023 01:42:01 +0000 (10:42 +0900)
Change-Id: I97bfb3fdf6ee52489644c2edf4ba8e21b4db8006

src/bin/e_policy_wl.c

index 261b53ec66430c2439721d191c6cfdc2569ef27d..2697a3b1b10513b5d0b125bd6b6c13bf4b7e303c 100644 (file)
@@ -3541,6 +3541,31 @@ _tzpol_iface_cb_unset_pin_mode(struct wl_client *client EINA_UNUSED, struct wl_r
    _e_policy_set_pin_mode(ec, EINA_FALSE);
 }
 
+static void
+_tzpol_iface_cb_set_layout(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf, uint32_t num_cols, uint32_t num_rows, uint32_t column, uint32_t row, uint32_t col_span, uint32_t row_span)
+{
+   E_Client *ec;
+
+   int unit_w, unit_h;
+   int x, y, w, h;
+   ec = wl_resource_get_user_data(surf);
+   if (!ec) return;
+
+   unit_w = ec->desk->geom.w / num_cols;
+   unit_h = ec->desk->geom.h / num_rows;
+
+   x = unit_w * column;
+   y = unit_h * row;
+   w = unit_w * col_span;
+   h = unit_h * row_span;
+
+   // TODO: We may need to adjust the last size if the unit size is not deviced exactly
+
+   ELOGF("TZPOL", "TIZEN_POLICY_SET_LAYOUT... layout(%d,%d) request(%d,%d,%d,%d) -> unit(%d,%d), geo(%d,%d,%dx%d)",
+         ec, num_cols, num_rows, column, row, col_span, row_span, unit_w, unit_h, x, y, w, h);
+   e_client_frame_geometry_set(ec, x, y, w, h);
+}
+
 // --------------------------------------------------------
 // tizen_policy_interface
 // --------------------------------------------------------
@@ -3593,6 +3618,7 @@ static const struct tizen_policy_interface _tzpol_iface =
    _tzpol_iface_cb_set_maximize_direction,
    _tzpol_iface_cb_set_pin_mode,
    _tzpol_iface_cb_unset_pin_mode,
+   _tzpol_iface_cb_set_layout
 };
 
 static void