tizen_rotation_interface: add implementation for destroy interface. 53/57853/1
authorSeunghun Lee <shiin.lee@samsung.com>
Mon, 25 Jan 2016 08:47:33 +0000 (17:47 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Mon, 25 Jan 2016 08:47:33 +0000 (17:47 +0900)
Change-Id: Iad0c08b315e64531fe4f9099b5ef19cc4521341a

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 6543913..1c6430c 100644 (file)
@@ -80,6 +80,7 @@ static Ecore_Idle_Enterer *rot_idle_enterer = NULL;
 static Policy_Ext_Rotation* _policy_ext_rotation_get(E_Pixmap *ep);
 
 /* local subsystem wayland rotation protocol related functions */
+static void _e_tizen_rotation_destroy_cb(struct wl_client *client, struct wl_resource *resource);
 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);
@@ -91,10 +92,10 @@ static void _e_tizen_policy_ext_bind_cb(struct wl_client *client, void *data, ui
 /* local subsystem wayland rotation protocol related variables */
 static const struct tizen_rotation_interface _e_tizen_rotation_interface =
 {
+   _e_tizen_rotation_destroy_cb,
    _e_tizen_rotation_set_available_angles_cb,
    _e_tizen_rotation_set_preferred_angle_cb,
    _e_tizen_rotation_ack_angle_change_cb,
-   /* need rotation destroy request? */
 };
 static const struct tizen_policy_ext_interface _e_tizen_policy_ext_interface =
 {
@@ -166,6 +167,13 @@ _policy_ext_rotation_get(E_Pixmap *ep)
 }
 
 static void
+_e_tizen_rotation_destroy_cb(struct wl_client *client EINA_UNUSED,
+                             struct wl_resource *resource)
+{
+   wl_resource_destroy(resource);
+}
+
+static void
 _e_tizen_rotation_set_available_angles_cb(struct wl_client *client,
                                           struct wl_resource *resource,
                                           uint32_t angles)
@@ -1151,6 +1159,8 @@ _rot_hook_new_client_post(void *d EINA_UNUSED, E_Client *ec)
 static void
 _rot_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
 {
+   Policy_Ext_Rotation *ext_rot;
+
    _e_client_rotation_list_remove(ec);
    if (rot.async_list) rot.async_list = eina_list_remove(rot.async_list, ec);
 
@@ -1159,6 +1169,10 @@ _rot_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
 
    if (ec->e.state.rot.available_rots)
      E_FREE(ec->e.state.rot.available_rots);
+
+   ext_rot = _policy_ext_rotation_get(ec->pixmap);
+   if (ext_rot)
+     E_FREE_LIST(ext_rot->rotation_list, wl_resource_destroy);
 }
 
 static void
index 35b3f33..d5ab495 100644 (file)
@@ -23,6 +23,7 @@ WL_EXPORT const struct wl_interface tizen_policy_ext_interface = {
 };
 
 static const struct wl_message tizen_rotation_requests[] = {
+       { "destroy", "", types + 0 },
        { "set_available_angles", "u", types + 0 },
        { "set_preferred_angle", "u", types + 0 },
        { "ack_angle_change", "u", types + 0 },
@@ -36,7 +37,7 @@ static const struct wl_message tizen_rotation_events[] = {
 
 WL_EXPORT const struct wl_interface tizen_rotation_interface = {
        "tizen_rotation", 1,
-       3, tizen_rotation_requests,
+       4, tizen_rotation_requests,
        3, tizen_rotation_events,
 };
 
index 9df7203..898f0c2 100644 (file)
@@ -7,7 +7,7 @@ extern "C" {
 
 #include <stdint.h>
 #include <stddef.h>
-#include "wayland-server.h"
+#include "wayland-util.h"
 
 struct wl_client;
 struct wl_resource;
@@ -30,7 +30,6 @@ struct tizen_policy_ext_interface {
                             struct wl_resource *surface);
 };
 
-
 #ifndef TIZEN_ROTATION_ANGLE_ENUM
 #define TIZEN_ROTATION_ANGLE_ENUM
 enum tizen_rotation_angle {
@@ -44,6 +43,13 @@ enum tizen_rotation_angle {
 
 struct tizen_rotation_interface {
        /**
+        * destroy - destroy tizen_rotation
+        *
+        * 
+        */
+       void (*destroy)(struct wl_client *client,
+                       struct wl_resource *resource);
+       /**
         * set_available_angles - (none)
         * @angles: (none)
         */
@@ -72,10 +78,6 @@ struct tizen_rotation_interface {
 #define TIZEN_ROTATION_PREFERRED_ANGLE_DONE    1
 #define TIZEN_ROTATION_ANGLE_CHANGE    2
 
-#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
-
 static inline void
 tizen_rotation_send_available_angles_done(struct wl_resource *resource_, uint32_t angles)
 {
index abfe20b..cbe81e1 100644 (file)
@@ -13,6 +13,9 @@
           <entry name="180" value = "4"/>
           <entry name="270" value = "8"/>
         </enum>
+        <request name="destroy" type="destructor">
+            <description summary="destroy tizen_rotation"/>
+        </request>
         <request name="set_available_angles">
             <arg name="angles" type="uint"/>
         </request>