e_comp_wl: add _e_comp_wl_region_area_check function 47/291447/1
authorJunkyeong Kim <jk0430.kim@samsung.com>
Fri, 14 Apr 2023 09:07:48 +0000 (18:07 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 17 Apr 2023 05:19:59 +0000 (14:19 +0900)
if requested region size(x+w or y+h) is over origin base region area,
set base region area to requested size.

Change-Id: I1d76b2e32330b1a4917c1172d0a57fc49a665521

src/bin/e_comp_wl.c

index 27d0937..ca08c8e 100644 (file)
@@ -2945,8 +2945,9 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
              itr = eina_tiler_iterator_new(src);
              EINA_ITERATOR_FOREACH(itr, rect)
                {
-                  ELOGF("COMP", "Set Input Area x:%d, y:%d, w:%d, h:%d",
-                        ec, rect->x, rect->y, rect->w, rect->h);
+                  ELOGF("COMP", "Set Input Area x:%d, y:%d, w:%d, h:%d, ec(%dx%d), state(%dx%d)",
+                        ec, rect->x, rect->y, rect->w, rect->h,
+                        ec->w, ec->h, state->bw, state->bh);
                   e_comp_object_input_area_set(ec->frame,
                                                rect->x, rect->y,
                                                rect->w, rect->h);
@@ -3443,6 +3444,33 @@ _e_comp_wl_region_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_res
 }
 
 static void
+_e_comp_wl_region_area_check(struct wl_client *client, Eina_Tiler *tiler, int32_t x, int32_t y, int32_t w, int32_t h)
+{
+   Eina_Bool need_set = EINA_FALSE;
+   int area_w = 0;
+   int area_h = 0;
+
+   eina_tiler_area_size_get(tiler, &area_w, &area_h);
+   if (x + w > area_w)
+     {
+        area_w = x + w;
+        need_set = EINA_TRUE;
+     }
+
+   if (y + h > area_h)
+     {
+        area_h = y + h;
+        need_set = EINA_TRUE;
+     }
+
+   if (need_set)
+     {
+        INF("change region area. client:%8p(%dx%d)", client, area_w, area_h);
+        eina_tiler_area_size_set(tiler, area_w, area_h);
+     }
+}
+
+static void
 _e_comp_wl_region_cb_add(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y, int32_t w, int32_t h)
 {
    Eina_Tiler *tiler;
@@ -3452,7 +3480,10 @@ _e_comp_wl_region_cb_add(struct wl_client *client EINA_UNUSED, struct wl_resourc
 
    /* get the tiler from the resource */
    if ((tiler = wl_resource_get_user_data(resource)))
-     eina_tiler_rect_add(tiler, &(Eina_Rectangle){x, y, w, h});
+     {
+        _e_comp_wl_region_area_check(client, tiler, x, y ,w, h);
+        eina_tiler_rect_add(tiler, &(Eina_Rectangle){x, y, w, h});
+     }
 }
 
 static void