1 /* Protocol XML file : wayland-extension/tizen-policy-ext.xml */
3 #ifndef __DS_TIZEN_POLICY_EXT_PROTOCOL_H__
4 #define __DS_TIZEN_POLICY_EXT_PROTOCOL_H__
6 #include "wayland-server-core.h"
7 #include "tizen-policy-ext-server-protocol.h"
14 #ifndef WAYLAND_VERSION_CHECK
15 #define WAYLAND_VERSION_CHECK(major, minor, micro) \
16 ((WAYLAND_VERSION_MAJOR > (major)) || \
17 (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
18 (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
22 namespace DSWaylandServer {
23 class tizen_policy_ext
26 tizen_policy_ext(struct ::wl_client *client, uint32_t id, int version);
27 tizen_policy_ext(struct ::wl_display *display, int version);
28 tizen_policy_ext(struct ::wl_resource *resource);
31 virtual ~tizen_policy_ext();
36 Resource() : tizen_policy_ext_object(NULL), handle(NULL) {}
37 virtual ~Resource() {}
39 tizen_policy_ext *tizen_policy_ext_object;
40 tizen_policy_ext *object() { return tizen_policy_ext_object; }
41 struct ::wl_resource *handle;
43 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
44 int version() const { return wl_resource_get_version(handle); }
46 static Resource *fromResource(struct ::wl_resource *resource);
49 void init(struct ::wl_client *client, uint32_t id, int version);
50 void init(struct ::wl_display *display, int version);
51 void init(struct ::wl_resource *resource);
53 Resource *add(struct ::wl_client *client, int version);
54 Resource *add(struct ::wl_client *client, uint32_t id, int version);
55 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
57 Resource *resource() { return m_resource; }
58 const Resource *resource() const { return m_resource; }
60 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
61 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
63 bool isGlobal() const { return m_global != NULL; }
64 bool isResource() const { return m_resource != NULL; }
66 static const struct ::wl_interface *interface();
67 static std::string interfaceName() { return interface()->name; }
68 static int interfaceVersion() { return interface()->version; }
71 void send_active_angle(uint32_t angle);
72 void send_active_angle(struct ::wl_resource *resource, uint32_t angle);
75 virtual Resource *tizen_policy_ext_allocate();
77 virtual void tizen_policy_ext_bind_resource(Resource *resource);
78 virtual void tizen_policy_ext_destroy_resource(Resource *resource);
80 virtual void tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface);
81 virtual void tizen_policy_ext_get_active_angle(Resource *resource, struct ::wl_resource *surface);
84 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
85 static void destroy_func(struct ::wl_resource *client_resource);
86 static void display_destroy_func(struct ::wl_listener *listener, void *data);
88 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
89 Resource *bind(struct ::wl_resource *handle);
91 static const struct ::tizen_policy_ext_interface m_tizen_policy_ext_interface;
93 static void handle_get_rotation(
95 struct wl_resource *resource,
97 struct ::wl_resource *surface);
98 static void handle_get_active_angle(
100 struct wl_resource *resource,
101 struct ::wl_resource *surface);
103 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
104 Resource *m_resource;
105 struct ::wl_global *m_global;
106 uint32_t m_globalVersion;
107 struct DisplayDestroyedListener : ::wl_listener {
108 tizen_policy_ext *parent;
109 DisplayDestroyedListener(): parent(NULL) {}
111 DisplayDestroyedListener m_displayDestroyedListener;
117 tizen_rotation(struct ::wl_client *client, uint32_t id, int version);
118 tizen_rotation(struct ::wl_display *display, int version);
119 tizen_rotation(struct ::wl_resource *resource);
122 virtual ~tizen_rotation();
127 Resource() : tizen_rotation_object(NULL), handle(NULL) {}
128 virtual ~Resource() {}
130 tizen_rotation *tizen_rotation_object;
131 tizen_rotation *object() { return tizen_rotation_object; }
132 struct ::wl_resource *handle;
134 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
135 int version() const { return wl_resource_get_version(handle); }
137 static Resource *fromResource(struct ::wl_resource *resource);
140 void init(struct ::wl_client *client, uint32_t id, int version);
141 void init(struct ::wl_display *display, int version);
142 void init(struct ::wl_resource *resource);
144 Resource *add(struct ::wl_client *client, int version);
145 Resource *add(struct ::wl_client *client, uint32_t id, int version);
146 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
148 Resource *resource() { return m_resource; }
149 const Resource *resource() const { return m_resource; }
151 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
152 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
154 bool isGlobal() const { return m_global != NULL; }
155 bool isResource() const { return m_resource != NULL; }
157 static const struct ::wl_interface *interface();
158 static std::string interfaceName() { return interface()->name; }
159 static int interfaceVersion() { return interface()->version; }
170 void send_available_angles_done(uint32_t angles);
171 void send_available_angles_done(struct ::wl_resource *resource, uint32_t angles);
172 void send_preferred_angle_done(uint32_t angle);
173 void send_preferred_angle_done(struct ::wl_resource *resource, uint32_t angle);
174 void send_angle_change(uint32_t angle, uint32_t serial);
175 void send_angle_change(struct ::wl_resource *resource, uint32_t angle, uint32_t serial);
176 void send_angle_change_with_resize(uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
177 void send_angle_change_with_resize(struct ::wl_resource *resource, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
180 virtual Resource *tizen_rotation_allocate();
182 virtual void tizen_rotation_bind_resource(Resource *resource);
183 virtual void tizen_rotation_destroy_resource(Resource *resource);
185 virtual void tizen_rotation_destroy(Resource *resource);
186 virtual void tizen_rotation_set_available_angles(Resource *resource, uint32_t angles);
187 virtual void tizen_rotation_set_preferred_angle(Resource *resource, uint32_t angle);
188 virtual void tizen_rotation_ack_angle_change(Resource *resource, uint32_t serial);
189 virtual void tizen_rotation_set_geometry_hint(Resource *resource, uint32_t angle, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
192 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
193 static void destroy_func(struct ::wl_resource *client_resource);
194 static void display_destroy_func(struct ::wl_listener *listener, void *data);
196 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
197 Resource *bind(struct ::wl_resource *handle);
199 static const struct ::tizen_rotation_interface m_tizen_rotation_interface;
201 static void handle_destroy(
203 struct wl_resource *resource);
204 static void handle_set_available_angles(
206 struct wl_resource *resource,
208 static void handle_set_preferred_angle(
210 struct wl_resource *resource,
212 static void handle_ack_angle_change(
214 struct wl_resource *resource,
216 static void handle_set_geometry_hint(
218 struct wl_resource *resource,
225 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
226 Resource *m_resource;
227 struct ::wl_global *m_global;
228 uint32_t m_globalVersion;
229 struct DisplayDestroyedListener : ::wl_listener {
230 tizen_rotation *parent;
231 DisplayDestroyedListener(): parent(NULL) {}
233 DisplayDestroyedListener m_displayDestroyedListener;