e_comp_wl: clip input_region rect to state->input rect 92/265292/6
authorDuna Oh <duna.oh@samsung.com>
Thu, 14 Oct 2021 06:49:57 +0000 (15:49 +0900)
committerDuna Oh <duna.oh@samsung.com>
Fri, 15 Oct 2021 02:48:57 +0000 (02:48 +0000)
There was a bug that input_area was set larger than client requested.
The result tiler 'src' of eina_tiler_intersection() shouldn't be larger
than any of 'state->input' and 'tmp'. We clip it to state->input.

Change-Id: I5cfa599f6f96989c23a44cd7bbaa0b60aa1c40e7

src/bin/e_comp_wl.c

index fc6c315..72c8a37 100644 (file)
@@ -2761,16 +2761,28 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
 
         if ((src = eina_tiler_intersection(state->input, tmp)))
           {
-             Eina_Rectangle *rect;
-             Eina_Iterator *itr;
+             Eina_Rectangle *rect, *rect_input;
+             Eina_Iterator *itr, *itr_input;
 
              e_comp_object_input_objs_del(ec->frame);
              itr = eina_tiler_iterator_new(src);
              EINA_ITERATOR_FOREACH(itr, rect)
                {
+                  itr_input = eina_tiler_iterator_new(state->input);
+                  EINA_ITERATOR_FOREACH(itr_input, rect_input)
+                    {
+                       if ((rect->x == rect_input->x) && (rect->y == rect_input->y))
+                         {
+                            if (rect->w > rect_input->w) rect->w = rect_input->w;
+                            if (rect->h > rect_input->h) rect->h = rect_input->h;
+                         }
+                    }
+                  ELOGF("COMP", "Set Input Area x:%d, y:%d, w:%d, h:%d",
+                        ec, rect->x, rect->y, rect->w, rect->h);
                   e_comp_object_input_area_set(ec->frame,
                                                rect->x, rect->y,
                                                rect->w, rect->h);
+                  eina_iterator_free(itr_input);
                }
 
              eina_iterator_free(itr);