add support for tizen_rotation v2 56/107556/2
authorGwanglim Lee <gl77.lee@samsung.com>
Wed, 28 Dec 2016 11:58:02 +0000 (20:58 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 28 Dec 2016 11:59:02 +0000 (03:59 -0800)
angle_change_with_resize event which is newly added to tizen_rotation
v2 clarifies the semantics of changing size of window while rotation.
The clients that receive this event can know exactly how much their
window size should be changed while rotating.

Change-Id: Iadcb72e57bb782de013b6e52e6c4caf70e8b9ff5

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

index 46d97f7..76c826b 100644 (file)
@@ -468,7 +468,7 @@ _e_tizen_policy_ext_bind_cb(struct wl_client *client, void *data, uint32_t versi
 {
    struct wl_resource *res;
 
-   if (!(res = wl_resource_create(client, &tizen_policy_ext_interface, version, id)))
+   if (!(res = wl_resource_create(client, &tizen_policy_ext_interface2, version, id)))
      {
         ERR("Could not create scaler resource: %m");
         wl_client_post_no_memory(client);
@@ -486,6 +486,7 @@ _e_tizen_rotation_send_angle_change(E_Client *ec, int angle)
    uint32_t serial;
    struct wl_resource *resource;
    enum tizen_rotation_angle tz_angle = TIZEN_ROTATION_ANGLE_0;
+   int ver;
 
    EINA_SAFETY_ON_NULL_RETURN(ec);
    EINA_SAFETY_ON_NULL_RETURN(hash_policy_ext_rotation);
@@ -521,7 +522,11 @@ _e_tizen_rotation_send_angle_change(E_Client *ec, int angle)
    EDBG(ec, "Send Change Rotation: angle %d", angle);
    EINA_LIST_FOREACH(rot->rotation_list, l, resource)
      {
-        tizen_rotation_send_angle_change(resource, tz_angle, serial);
+        ver = wl_resource_get_version(resource); // resource is type of tizen_rotation_interface
+        if ((ver >= 2) && (ec->floating))
+          tizen_rotation_send_angle_change_with_resize(resource, tz_angle, serial, ec->h, ec->w);
+        else
+          tizen_rotation_send_angle_change(resource, tz_angle, serial);
      }
 }
 
@@ -1911,7 +1916,7 @@ e_mod_rot_wl_init(void)
    EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl->wl.disp, EINA_FALSE);
 
-   if (!wl_global_create(e_comp_wl->wl.disp, &tizen_policy_ext_interface, 1,
+   if (!wl_global_create(e_comp_wl->wl.disp, &tizen_policy_ext_interface2, 2,
                          NULL, _e_tizen_policy_ext_bind_cb))
      {
         ERR("Could not add tizen_policy_ext to wayland globals: %m");
index cb915f0..1ced7fa 100644 (file)
@@ -8,22 +8,24 @@ extern const struct wl_interface wl_surface_interface;
 static const struct wl_interface *types[] = {
        NULL,
        NULL,
+       NULL,
+       NULL,
        &tizen_rotation_interface,
        &wl_surface_interface,
        &wl_surface_interface,
 };
 
 static const struct wl_message tizen_policy_ext_requests[] = {
-       { "get_rotation", "no", types + 2 },
-       { "get_active_angle", "?o", types + 4 },
+       { "get_rotation", "no", types + 4 },
+       { "get_active_angle", "?o", types + 6 },
 };
 
 static const struct wl_message tizen_policy_ext_events[] = {
        { "active_angle", "u", types + 0 },
 };
 
-WL_EXPORT const struct wl_interface tizen_policy_ext_interface = {
-       "tizen_policy_ext", 1,
+WL_EXPORT const struct wl_interface tizen_policy_ext_interface2 = {
+       "tizen_policy_ext", 2,
        2, tizen_policy_ext_requests,
        1, tizen_policy_ext_events,
 };
@@ -39,11 +41,12 @@ static const struct wl_message tizen_rotation_events[] = {
        { "available_angles_done", "u", types + 0 },
        { "preferred_angle_done", "u", types + 0 },
        { "angle_change", "uu", types + 0 },
+       { "angle_change_with_resize", "2uuuu", types + 0 },
 };
 
 WL_EXPORT const struct wl_interface tizen_rotation_interface = {
-       "tizen_rotation", 1,
+       "tizen_rotation", 2,
        4, tizen_rotation_requests,
-       3, tizen_rotation_events,
+       4, tizen_rotation_events,
 };
 
index c5441c1..dede3e8 100644 (file)
@@ -7,15 +7,16 @@ extern "C" {
 
 #include <stdint.h>
 #include <stddef.h>
-#include "wayland-util.h"
+#include "wayland-server.h"
 
 struct wl_client;
 struct wl_resource;
 
 struct tizen_policy_ext;
 struct tizen_rotation;
+struct wl_surface;
 
-extern const struct wl_interface tizen_policy_ext_interface;
+extern const struct wl_interface tizen_policy_ext_interface2;
 extern const struct wl_interface tizen_rotation_interface;
 
 struct tizen_policy_ext_interface {
@@ -32,7 +33,7 @@ struct tizen_policy_ext_interface {
         * get_active_angle - get a current active angle
         * @surface: (none)
         *
-        *
+        * 
         */
        void (*get_active_angle)(struct wl_client *client,
                                 struct wl_resource *resource,
@@ -41,6 +42,8 @@ struct tizen_policy_ext_interface {
 
 #define TIZEN_POLICY_EXT_ACTIVE_ANGLE  0
 
+#define TIZEN_POLICY_EXT_ACTIVE_ANGLE_SINCE_VERSION    1
+
 static inline void
 tizen_policy_ext_send_active_angle(struct wl_resource *resource_, uint32_t angle)
 {
@@ -94,6 +97,12 @@ struct tizen_rotation_interface {
 #define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE   0
 #define TIZEN_ROTATION_PREFERRED_ANGLE_DONE    1
 #define TIZEN_ROTATION_ANGLE_CHANGE    2
+#define TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE        3
+
+#define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE_SINCE_VERSION     1
+#define TIZEN_ROTATION_PREFERRED_ANGLE_DONE_SINCE_VERSION      1
+#define TIZEN_ROTATION_ANGLE_CHANGE_SINCE_VERSION      1
+#define TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE_SINCE_VERSION  2
 
 static inline void
 tizen_rotation_send_available_angles_done(struct wl_resource *resource_, uint32_t angles)
@@ -113,6 +122,12 @@ tizen_rotation_send_angle_change(struct wl_resource *resource_, uint32_t angle,
        wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE, angle, serial);
 }
 
+static inline void
+tizen_rotation_send_angle_change_with_resize(struct wl_resource *resource_, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height)
+{
+       wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE, angle, serial, width, height);
+}
+
 #ifdef  __cplusplus
 }
 #endif
index dc9b3e0..f568600 100644 (file)
@@ -1,5 +1,5 @@
 <protocol name="tizen_policy_ext">
-     <interface name="tizen_policy_ext" version="1">
+     <interface name="tizen_policy_ext" version="2">
         <request name="get_rotation">
             <arg name="id" type="new_id" interface="tizen_rotation" summary="new rotation object"/>
             <arg name="surface" type="object" interface="wl_surface" summary="surface object"/>
@@ -12,7 +12,7 @@
             <arg name="angle" type="uint"/>
         </event>
      </interface>
-     <interface name="tizen_rotation" version="1">
+     <interface name="tizen_rotation" version="2">
         <enum name="angle">
           <entry name="none" value = "0"/>
           <entry name="0" value = "1"/>
             <description summary="ack a  angle_change"/>
             <arg name="serial" type="uint" summary="a serial to angle_change for"/>
         </request>
+
+        <!-- Version 2 addtions -->
+        <event name="angle_change_with_resize" since="2">
+            <description summary="suggest a angle change with resize of window"/>
+            <arg name="angle" type="uint"/>
+            <arg name="serial" type="uint"/>
+            <arg name="width" type="uint"/>
+            <arg name="height" type="uint"/>
+        </event>
      </interface>
 </protocol>