ecore_wl2_window: send ECORE_WL2_EVENT_WINDOW_ROTATE event in _ecore_wl_window_cb_ang... 08/278508/1 accepted/tizen/unified/20220722.031016 submit/tizen/20220721.100327
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 21 Jul 2022 09:28:57 +0000 (18:28 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 21 Jul 2022 09:29:03 +0000 (18:29 +0900)
We add code to send a ECORE_WL2_EVENT_WINDOW_ROTATE event in the tizen_rotation's
angle_change_with_resize listener function (_ecore_wl_window_cb_angle_change_with_resize).

For this, a module can do what it wants when the window is rotated.

@tizen_only

Change-Id: I876e3bb877b65f55f5086c8b3fb73cc533c65581

src/lib/ecore_wl2/ecore_wl2_window.c

index ce98cd8..dfe2353 100644 (file)
@@ -763,11 +763,9 @@ _ecore_wl_window_cb_angle_change_with_resize(void *data, struct tizen_rotation *
 {
    Ecore_Wl2_Window *win = (Ecore_Wl2_Window *)data;
    int rot = 0;
+   Ecore_Wl2_Event_Window_Rotation *ev = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN(win);
-   EINA_SAFETY_ON_NULL_RETURN(win->cb_rot_changed);
-
-   win->wm_rot.serial = serial;
 
    switch (angle)
      {
@@ -778,9 +776,25 @@ _ecore_wl_window_cb_angle_change_with_resize(void *data, struct tizen_rotation *
        default:                       rot =   0; break;
      }
 
-   ecore_wl2_window_rotation_set(win, rot);
+   if (win->cb_rot_changed)
+     {
+        win->wm_rot.serial = serial;
+
+        ecore_wl2_window_rotation_set(win, rot);
+        win->cb_rot_changed(win, rot, 0, width, height, win->cb_rot_changed_data);
+     }
+
+   if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Rotation)))) return;
+
+   win->wm_rot.serial = serial;
 
-   win->cb_rot_changed(win, rot, 0, width, height, win->cb_rot_changed_data);
+   ev->win = win->id;
+   ev->w = width;
+   ev->h = height;
+   ev->angle = rot;
+   ev->resize = EINA_TRUE;
+
+   ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATE, ev, NULL, NULL);
 }
 
 static const struct tizen_rotation_listener _ecore_tizen_rotation_listener =