Wayland Rotation: remove communicating of rotation_geometry_hint with clients. 87/47887/2
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Wed, 9 Sep 2015 13:47:07 +0000 (22:47 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 22 Sep 2015 08:40:55 +0000 (01:40 -0700)
                  when client window got rotate event from display server , resize window size by itself policy.
Change-Id: Ia85b43a0cdfdfcd3aacce200bcc3f919a78589d9

src/e_mod_rotation_wl.c
src/tizen_policy_ext-protocol.c
src/tizen_policy_ext-server-protocol.h
src/tizen_policy_ext.xml

index 7176750..6cab026 100644 (file)
                                             (angle == TIZEN_ROTATION_ANGLE_180) ? 180 :    \
                                             (angle == TIZEN_ROTATION_ANGLE_270) ? 270 : -1)
 
-typedef struct _Geometry_Hint Geometry_Hint;
 typedef struct _Policy_Ext_Rotation Policy_Ext_Rotation;
 typedef struct _E_Client_Rotation E_Client_Rotation;
 
-struct _Geometry_Hint
-{
-   enum tizen_rotation_angle angle;
-   int x, y, w, h;
-};
-
 struct _Policy_Ext_Rotation
 {
    E_Pixmap *ep;
@@ -46,16 +39,7 @@ struct _Policy_Ext_Rotation
    enum tizen_rotation_angle cur_angle, prev_angle;
    Eina_List *rotation_list;
    Eina_Bool angle_change_done;
-
-   struct
-   {
-      enum tizen_rotation_angle angle;
-      int x, y, w, h;
-      Eina_Bool valid;
-   } geometry_hint[4];
-
    uint32_t serial;
-
 };
 
 struct _E_Client_Rotation
@@ -99,7 +83,6 @@ static Policy_Ext_Rotation* _policy_ext_rotation_get(E_Pixmap *ep);
 static void _e_tizen_rotation_set_available_angles_cb(struct wl_client *client, struct wl_resource *resource, uint32_t angles);
 static void _e_tizen_rotation_set_preferred_angle_cb(struct wl_client *client, struct wl_resource *resource, uint32_t angle);
 static void _e_tizen_rotation_ack_angle_change_cb(struct wl_client *client, struct wl_resource *resource, uint32_t serial);
-static void _e_tizen_rotation_set_geometry_hints_cb(struct wl_client *client, struct wl_resource *resource, struct wl_array *geometry_hints);
 static void _e_tizen_rotation_destroy(struct wl_resource *resource);
 static void _e_tizen_rotation_send_angle_change(E_Client *ec, int angle);
 static void _e_tizen_policy_ext_get_rotation_cb(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface);
@@ -111,7 +94,6 @@ static const struct tizen_rotation_interface _e_tizen_rotation_interface =
    _e_tizen_rotation_set_available_angles_cb,
    _e_tizen_rotation_set_preferred_angle_cb,
    _e_tizen_rotation_ack_angle_change_cb,
-   _e_tizen_rotation_set_geometry_hints_cb,
    /* need rotation destroy request? */
 };
 static const struct tizen_policy_ext_interface _e_tizen_policy_ext_interface =
@@ -284,72 +266,6 @@ _e_tizen_rotation_ack_angle_change_cb(struct wl_client *client,
 }
 
 static void
-_e_tizen_rotation_set_geometry_hints_cb(struct wl_client *client,
-                                        struct wl_resource *resource,
-                                        struct wl_array *geometry_hints)
-{
-   E_Client *ec;
-   E_Pixmap *ep;
-   Policy_Ext_Rotation *rot;
-   Geometry_Hint *geo_hint;
-   Eina_Bool geo_hint_change = EINA_FALSE;
-
-   ep = wl_resource_get_user_data(resource);
-   EINA_SAFETY_ON_NULL_RETURN(ep);
-
-   rot = _policy_ext_rotation_get(ep);
-   EINA_SAFETY_ON_NULL_RETURN(rot);
-
-   wl_array_for_each(geo_hint, geometry_hints)
-     {
-        Eina_Bool valid = EINA_FALSE;
-        int i;
-        switch(geo_hint->angle)
-          {
-             case TIZEN_ROTATION_ANGLE_0:
-               valid = EINA_TRUE;
-               i = 0;
-               break;
-             case TIZEN_ROTATION_ANGLE_90:
-               valid = EINA_TRUE;
-               i = 1;
-               break;
-             case TIZEN_ROTATION_ANGLE_180:
-               valid = EINA_TRUE;
-               i = 2;
-               break;
-             case TIZEN_ROTATION_ANGLE_270:
-               valid = EINA_TRUE;
-               i = 3;
-               break;
-             default:
-               break;
-          }
-
-        if (valid)
-          {
-             rot->geometry_hint[i].angle = geo_hint->angle;
-             rot->geometry_hint[i].x = geo_hint->x;
-             rot->geometry_hint[i].y = geo_hint->y;
-             rot->geometry_hint[i].w = geo_hint->w;
-             rot->geometry_hint[i].h = geo_hint->h;
-             rot->geometry_hint[i].valid = valid;
-             geo_hint_change = EINA_TRUE;
-          }
-     }
-
-   if (geo_hint_change)
-     {
-        ec = e_pixmap_client_get(ep);
-        if (ec)
-          {
-             ec->e.fetch.rot.geom_hint = 1;
-             EC_CHANGED(ec);
-          }
-     }
-}
-
-static void
 _e_tizen_rotation_destroy(struct wl_resource *resource)
 {
    E_Pixmap *ep;
@@ -430,7 +346,6 @@ _e_tizen_rotation_send_angle_change(E_Client *ec, int angle)
 {
    Eina_List *l;
    Policy_Ext_Rotation *rot;
-   int32_t width, height;
    uint32_t serial;
    struct wl_resource *resource;
    enum tizen_rotation_angle tz_angle = TIZEN_ROTATION_ANGLE_0;
@@ -467,25 +382,9 @@ _e_tizen_rotation_send_angle_change(E_Client *ec, int angle)
    rot->cur_angle = tz_angle;
    rot->serial = serial;
 
-   //set default width, height
-   width = ec->w;
-   height = ec->h;
-   //check geometry hint for resize
-   if (ec->e.state.rot.geom_hint)
-     {
-        int i = angle / 90;
-
-        if ((ec->e.state.rot.geom[i].w != 0) &&
-            (ec->e.state.rot.geom[i].h != 0))
-          {
-             width = ec->e.state.rot.geom[i].w;
-             height = ec->e.state.rot.geom[i].h;
-          }
-     }
-
    EINA_LIST_FOREACH(rot->rotation_list, l, resource)
      {
-        tizen_rotation_send_angle_change(resource, tz_angle, width, height, serial);
+        tizen_rotation_send_angle_change(resource, tz_angle, serial);
      }
 }
 
@@ -1136,15 +1035,6 @@ _rot_hook_new_client(void *d EINA_UNUSED, E_Client *ec)
 
    ec->e.fetch.rot.support = 1;
 
-   for (i = 0; i < 4; i++)
-      {
-         if (rot->geometry_hint[i].valid)
-           {
-              ec->e.fetch.rot.geom_hint = 1;
-              break;
-           }
-      }
-
    if (rot->preferred_angle)
      {
         ec->e.fetch.rot.app_set = 1;
@@ -1225,45 +1115,6 @@ _rot_hook_eval_fetch(void *d EINA_UNUSED, E_Client *ec)
         ec->e.fetch.rot.need_rotation = EINA_TRUE;
         ec->e.fetch.rot.support = 0;
      }
-   if (ec->e.fetch.rot.geom_hint)
-     {
-        Eina_Rectangle r[4];
-        int i;
-        ec->e.state.rot.geom_hint = 0;
-        for (i = 0; i < 4; i++)
-          {
-             r[i].x = ec->e.state.rot.geom[i].x;
-             r[i].y = ec->e.state.rot.geom[i].y;
-             r[i].w = ec->e.state.rot.geom[i].w;
-             r[i].h = ec->e.state.rot.geom[i].h;
-
-             ec->e.state.rot.geom[i].x = 0;
-             ec->e.state.rot.geom[i].y = 0;
-             ec->e.state.rot.geom[i].w = 0;
-             ec->e.state.rot.geom[i].h = 0;
-          }
-
-        for (i = 0; i < 4; i++)
-          {
-             if (rot->geometry_hint[i].valid)
-               {
-                  ec->e.state.rot.geom_hint = 1;
-                  ec->e.state.rot.geom[i].x = rot->geometry_hint[i].x;
-                  ec->e.state.rot.geom[i].y = rot->geometry_hint[i].y;
-                  ec->e.state.rot.geom[i].w = rot->geometry_hint[i].w;
-                  ec->e.state.rot.geom[i].h = rot->geometry_hint[i].h;
-
-                  if (!((r[i].x == rot->geometry_hint[i].x) &&
-                        (r[i].y == rot->geometry_hint[i].y) &&
-                        (r[i].w == rot->geometry_hint[i].w) &&
-                        (r[i].h == rot->geometry_hint[i].h)))
-                    {
-                       ec->e.fetch.rot.need_rotation = EINA_TRUE;
-                    }
-               }
-          }
-        ec->e.fetch.rot.geom_hint = 0;
-     }
    if (ec->e.fetch.rot.preferred_rot)
      {
         int _prev_preferred_rot;
index 6b54618..35b3f33 100644 (file)
@@ -8,14 +8,12 @@ extern const struct wl_interface wl_surface_interface;
 static const struct wl_interface *types[] = {
        NULL,
        NULL,
-       NULL,
-       NULL,
        &tizen_rotation_interface,
        &wl_surface_interface,
 };
 
 static const struct wl_message tizen_policy_ext_requests[] = {
-       { "get_rotation", "no", types + 4 },
+       { "get_rotation", "no", types + 2 },
 };
 
 WL_EXPORT const struct wl_interface tizen_policy_ext_interface = {
@@ -28,18 +26,17 @@ static const struct wl_message tizen_rotation_requests[] = {
        { "set_available_angles", "u", types + 0 },
        { "set_preferred_angle", "u", types + 0 },
        { "ack_angle_change", "u", types + 0 },
-       { "set_geometry_hints", "a", types + 0 },
 };
 
 static const struct wl_message tizen_rotation_events[] = {
        { "available_angles_done", "u", types + 0 },
        { "preferred_angle_done", "u", types + 0 },
-       { "angle_change", "uiiu", types + 0 },
+       { "angle_change", "uu", types + 0 },
 };
 
 WL_EXPORT const struct wl_interface tizen_rotation_interface = {
        "tizen_rotation", 1,
-       4, tizen_rotation_requests,
+       3, tizen_rotation_requests,
        3, tizen_rotation_events,
 };
 
index 0b0f0b6..9df7203 100644 (file)
@@ -66,13 +66,6 @@ struct tizen_rotation_interface {
        void (*ack_angle_change)(struct wl_client *client,
                                 struct wl_resource *resource,
                                 uint32_t serial);
-       /**
-        * set_geometry_hints - (none)
-        * @geometry_hints: (none)
-        */
-       void (*set_geometry_hints)(struct wl_client *client,
-                                  struct wl_resource *resource,
-                                  struct wl_array *geometry_hints);
 };
 
 #define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE   0
@@ -96,9 +89,9 @@ tizen_rotation_send_preferred_angle_done(struct wl_resource *resource_, uint32_t
 }
 
 static inline void
-tizen_rotation_send_angle_change(struct wl_resource *resource_, uint32_t angle, int32_t width, int32_t height, uint32_t serial)
+tizen_rotation_send_angle_change(struct wl_resource *resource_, uint32_t angle, uint32_t serial)
 {
-       wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE, angle, width, height, serial);
+       wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE, angle, serial);
 }
 
 #ifdef  __cplusplus
index ede39b2..abfe20b 100644 (file)
         <event name="angle_change">
             <description summary="suggest a angle_change"/>
             <arg name="angle" type="uint"/>
-            <arg name="width" type="int"/>
-            <arg name="height" type="int"/>
             <arg name="serial" type="uint"/>
         </event>
         <request name="ack_angle_change">
             <description summary="ack a  angle_change"/>
             <arg name="serial" type="uint" summary="a serial to angle_change for"/>
         </request>
-        <request name="set_geometry_hints">
-            <arg name="geometry_hints" type="array"/>
-        </request>
      </interface>
 </protocol>