From 81d551bc0b496b8911715daf6e9a3079114ac4c9 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Mon, 25 Jan 2016 17:47:33 +0900 Subject: [PATCH] tizen_rotation_interface: add implementation for destroy interface. Change-Id: Iad0c08b315e64531fe4f9099b5ef19cc4521341a --- src/e_mod_rotation_wl.c | 16 +++++++++++++++- src/tizen_policy_ext-protocol.c | 3 ++- src/tizen_policy_ext-server-protocol.h | 14 ++++++++------ src/tizen_policy_ext.xml | 3 +++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/e_mod_rotation_wl.c b/src/e_mod_rotation_wl.c index 6543913..1c6430c 100644 --- a/src/e_mod_rotation_wl.c +++ b/src/e_mod_rotation_wl.c @@ -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 diff --git a/src/tizen_policy_ext-protocol.c b/src/tizen_policy_ext-protocol.c index 35b3f33..d5ab495 100644 --- a/src/tizen_policy_ext-protocol.c +++ b/src/tizen_policy_ext-protocol.c @@ -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, }; diff --git a/src/tizen_policy_ext-server-protocol.h b/src/tizen_policy_ext-server-protocol.h index 9df7203..898f0c2 100644 --- a/src/tizen_policy_ext-server-protocol.h +++ b/src/tizen_policy_ext-server-protocol.h @@ -7,7 +7,7 @@ extern "C" { #include #include -#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) { diff --git a/src/tizen_policy_ext.xml b/src/tizen_policy_ext.xml index abfe20b..cbe81e1 100644 --- a/src/tizen_policy_ext.xml +++ b/src/tizen_policy_ext.xml @@ -13,6 +13,9 @@ + + + -- 2.7.4