rotation: send angle_change_with_resize event early for portrait and floating app 64/117064/1
authorDuna Oh <duna.oh@samsung.com>
Thu, 2 Mar 2017 12:37:02 +0000 (21:37 +0900)
committerDuna Oh <duna.oh@samsung.com>
Thu, 2 Mar 2017 12:37:46 +0000 (21:37 +0900)
Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I4b0bc8c9df08fb5dbd9e02c0cc425ae83bf879b0

src/rotation/e_mod_rotation_wl.c

index e0cd7a7..b1fd249 100644 (file)
@@ -413,13 +413,8 @@ _e_tizen_rotation_set_preferred_angle_cb(struct wl_client *client,
         return;
      }
 
-   ec->e.fetch.rot.preferred_rot = 1;
-   EC_CHANGED(ec);
-
-   /* for clients supporting landscape mode only */
-   if ((rot->preferred_angle) &&
-       !(rot->preferred_angle & TIZEN_ROTATION_ANGLE_0) &&
-       !(rot->preferred_angle & TIZEN_ROTATION_ANGLE_180))
+   /* for clients supporting landscape mode only and clients supporting portrait mode in floating state*/
+   if (rot->preferred_angle)
      {
         enum tizen_rotation_angle tz_angle = 0;
         uint32_t serial;
@@ -432,16 +427,23 @@ _e_tizen_rotation_set_preferred_angle_cb(struct wl_client *client,
           tz_angle = TIZEN_ROTATION_ANGLE_270;
         else
           {
-             ERR("What's this impossible angle?? : %d", rot->preferred_angle);
+             if ((ec->floating) && (ec->comp_data) && ((ec->comp_data->shell.window.w != ec->w) || (ec->comp_data->shell.window.h != ec->h)))
+               {
+                  if (rot->preferred_angle & TIZEN_ROTATION_ANGLE_0)
+                    tz_angle = TIZEN_ROTATION_ANGLE_0;
+                  else if (rot->preferred_angle & TIZEN_ROTATION_ANGLE_180)
+                    tz_angle = TIZEN_ROTATION_ANGLE_180;
+                  else
+                    {
+                       ERR("What's this impossible angle?? : %d", rot->preferred_angle);
+                    }
+               }
           }
 
         if (tz_angle)
           {
              serial = wl_display_next_serial(e_comp_wl->wl.disp);
 
-             EDBG(ec, "Send Change Rotation: angle %d for redering preparation of landscape only app. mapped:%d serial:%u",
-                  tz_angle, ec->first_mapped, serial);
-
              if (ec->first_mapped)
                {
                   rot->angle_change_done = EINA_FALSE;
@@ -456,10 +458,34 @@ _e_tizen_rotation_set_preferred_angle_cb(struct wl_client *client,
 
              EINA_LIST_FOREACH(rot->rotation_list, l, res)
                {
-                  tizen_rotation_send_angle_change(res, tz_angle, serial);
+                  int ver = wl_resource_get_version(resource);
+
+                  if ((ver >= 2) && ((tz_angle == TIZEN_ROTATION_ANGLE_0) || (tz_angle == TIZEN_ROTATION_ANGLE_180)))
+                    {
+                       int window_w, window_h;
+                       if (!ec->comp_data) continue;
+                       window_w = ec->comp_data->shell.window.w;
+                       window_h = ec->comp_data->shell.window.h;
+                       EDBG(ec, "Send Change Rotation: angle %d for rendering preparation of portrait mode in floating w/h:%dx%d, shell.w/h:%dx%d, Resize:%dx%d -> %dx%d",
+                            tz_angle, ec->w, ec->h, window_w, window_h, window_w, window_h, window_h, window_w);
+                       tizen_rotation_send_angle_change_with_resize(resource, tz_angle, serial, window_h, window_w);
+
+                       ec->e.state.rot.preferred_rot = TIZEN_ROTATION_ANGLE_TO_INT(angle);
+                       return;
+                    }
+                  else
+                    {
+                       EDBG(ec, "Send Change Rotation: angle %d for rendering preparation of landscape mode only app. mapped:%d serial:%u",
+                            tz_angle, ec->first_mapped, serial);
+
+                       tizen_rotation_send_angle_change(res, tz_angle, serial);
+                    }
                }
           }
      }
+
+   ec->e.fetch.rot.preferred_rot = 1;
+   EC_CHANGED(ec);
 }
 
 static void