ecore_wl2: fix checking configure_event 57/285357/1
authorHosang Kim <hosang12.kim@samsung.com>
Fri, 9 Dec 2022 10:40:44 +0000 (19:40 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Fri, 9 Dec 2022 11:04:42 +0000 (20:04 +0900)
Sometimes configure event is received twice.

Change-Id: I994f3f106054dd9808d21396b525c5b85bd16dc3

src/lib/ecore_wl2/ecore_wl2_private.h
src/lib/ecore_wl2/ecore_wl2_window.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 52b2748..b017f6a 100644 (file)
@@ -345,6 +345,7 @@ struct _Ecore_Wl2_Window
 
    struct
      {
+        int configure_event;
         Eina_Bool configure : 1;
         Eina_Bool min : 1;
         Eina_Bool max : 1;
@@ -353,7 +354,6 @@ struct _Ecore_Wl2_Window
         Eina_Bool input : 1;
         Eina_Bool fullscreen : 1;
         Eina_Bool maximized : 1;
-        Eina_Bool configure_event : 1;
      } pending;
 
    struct
index 36a2e61..49a0213 100644 (file)
@@ -228,7 +228,7 @@ _ecore_wl2_window_configure_send(Ecore_Wl2_Window *win)
      ev->states |= ECORE_WL2_WINDOW_STATE_MAXIMIZED;
 
    win->req_config = win->def_config;
-   win->pending.configure_event = EINA_TRUE;
+   win->pending.configure_event++;
 
    ERR("[WINDOW] Generate WINDOW_CONFIGURE event.. win:%d, states:%d, geo(%d,%d,%dx%d), type:%d", win->resource_id, ev->states, ev->x, ev->y, ev->w, ev->h, size_type);
    ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
@@ -770,6 +770,8 @@ _ecore_wl_window_cb_angle_change(void *data, struct tizen_rotation *tizen_rotati
         ev->h = win->wm_rot.geometry_hints[i].h;
      }
 
+   win->pending.configure_event++;
+
    ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATE, ev, NULL, NULL);
 // TIZEN_ONLY(20170212): pend rotation until app set rotation
    //this code don't need. This code will be added opensource code.
@@ -813,6 +815,8 @@ _ecore_wl_window_cb_angle_change_with_resize(void *data, struct tizen_rotation *
    ev->angle = rot;
    ev->resize = EINA_TRUE;
 
+   win->pending.configure_event++;
+
    ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATE, ev, NULL, NULL);
 }
 
index e9d49e4..96e957b 100644 (file)
@@ -349,9 +349,8 @@ _ecore_evas_wl_common_move(Ecore_Evas *ee, int x, int y)
 //
 
 static void
-_ecore_evas_wl_common_resize_job(void *data)
+_ecore_evas_wl_common_resize_internal(Ecore_Evas *ee, int w, int h)
 {
-   Ecore_Evas *ee = data;
    Ecore_Evas_Engine_Wl_Data *wdata;
    int ow, oh, ew, eh;
    int diff = 0;
@@ -360,14 +359,9 @@ _ecore_evas_wl_common_resize_job(void *data)
 
    if (!ee) return;
 
-   int w = ee->expecting_resize.w;
-   int h = ee->expecting_resize.h;
-
    wdata = ee->engine.data;
    if (!wdata) return;
 
-   wdata->resize_job = NULL;
-
    ee->req.w = w;
    ee->req.h = h;
 
@@ -566,6 +560,21 @@ _ecore_evas_wl_common_resize_job(void *data)
 }
 
 static void
+_ecore_evas_wl_common_resize_job(void *data)
+{
+   Ecore_Evas_Engine_Wl_Data *wdata;
+   Ecore_Evas *ee = data;
+
+   if (!ee) return;
+
+   wdata = ee->engine.data;
+   if (!wdata) return;
+
+   wdata->resize_job = NULL;
+   _ecore_evas_wl_common_resize_internal(ee, ee->expecting_resize.w, ee->expecting_resize.h);
+}
+
+static void
 _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
 {
    Ecore_Evas_Engine_Wl_Data *wdata;
@@ -578,7 +587,7 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
    wdata = ee->engine.data;
    if (!wdata) return;
 
-   if (wdata->win->pending.configure_event)
+   if (wdata->win->pending.configure_event > 0)
      {
         if (wdata->resize_job) ecore_job_del(wdata->resize_job);
         wdata->resize_job = ecore_job_add(_ecore_evas_wl_common_resize_job, ee);
@@ -689,7 +698,7 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
    wdata = ee->engine.data;
    if (!wdata) return ECORE_CALLBACK_PASS_ON;
 
-   wdata->win->pending.configure_event = EINA_FALSE;
+   if (wdata->win->pending.configure_event > 0) wdata->win->pending.configure_event--;
 
    if (!ecore_wl2_window_resizing_get(wdata->win) && !wdata->resizing)
      wdata->cw = wdata->ch = 0;
@@ -780,11 +789,11 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
         if (ecore_wl2_window_resizing_get(wdata->win) || wdata->resizing)
           {
              if ((wdata->cw != nw) || (wdata->ch != nh))
-               _ecore_evas_wl_common_resize(ee, nw, nh);
+               _ecore_evas_wl_common_resize_internal(ee, nw, nh);
              wdata->cw = nw, wdata->ch = nh;
           }
         else
-          _ecore_evas_wl_common_resize(ee, nw, nh);
+          _ecore_evas_wl_common_resize_internal(ee, nw, nh);
      }
    wdata->resizing = ecore_wl2_window_resizing_get(wdata->win);
 
@@ -987,6 +996,8 @@ _ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNU
    wdata = ee->engine.data;
    if (!wdata) return ECORE_CALLBACK_PASS_ON;
 
+   if (wdata->win->pending.configure_event > 0) wdata->win->pending.configure_event--;
+
    if ((!ee->prop.wm_rot.supported) || (!ee->prop.wm_rot.app_set))
      return ECORE_CALLBACK_PASS_ON;
 
@@ -1018,7 +1029,7 @@ _ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNU
      {
         if ((ee->w != nw) || (ee->h != nh))
           {
-             _ecore_evas_wl_common_resize(ee, nw, nh);
+             _ecore_evas_wl_common_resize_internal(ee, nw, nh);
           }
      }
 
@@ -2378,7 +2389,7 @@ _ecore_evas_wl_common_wm_rot_cb_angle_changed(Ecore_Wl2_Window *win, int rot, Ei
    ecore_evas_size_base_set(ee, basew, baseh);
    ecore_evas_size_step_set(ee, stepw, steph);
 
-   _ecore_evas_wl_common_resize(ee, w, h);
+   _ecore_evas_wl_common_resize_internal(ee, w, h);
 
    if (ee->prop.wm_rot.manual_mode.set)
      {