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 <wayland-server.h>
8 #include "tizen_policy_ext-server-protocol.h"
15 #ifndef WAYLAND_VERSION_CHECK
16 #define WAYLAND_VERSION_CHECK(major, minor, micro) \
17 ((WAYLAND_VERSION_MAJOR > (major)) || \
18 (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
19 (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
23 namespace DSWaylandServer {
24 class tizen_policy_ext
27 tizen_policy_ext(struct ::wl_client *client, uint32_t id, int version);
28 tizen_policy_ext(struct ::wl_display *display, int version);
29 tizen_policy_ext(struct ::wl_resource *resource);
32 virtual ~tizen_policy_ext();
37 Resource() : tizen_policy_ext_object(NULL), handle(NULL) {}
38 virtual ~Resource() {}
40 tizen_policy_ext *tizen_policy_ext_object;
41 tizen_policy_ext *object() { return tizen_policy_ext_object; }
42 struct ::wl_resource *handle;
44 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
45 int version() const { return wl_resource_get_version(handle); }
47 static Resource *fromResource(struct ::wl_resource *resource);
50 void init(struct ::wl_client *client, uint32_t id, int version);
51 void init(struct ::wl_display *display, int version);
52 void init(struct ::wl_resource *resource);
54 Resource *add(struct ::wl_client *client, int version);
55 Resource *add(struct ::wl_client *client, uint32_t id, int version);
56 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
58 Resource *resource() { return m_resource; }
59 const Resource *resource() const { return m_resource; }
61 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
62 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
64 bool isGlobal() const { return m_global != NULL; }
65 bool isResource() const { return m_resource != NULL; }
67 static const struct ::wl_interface *interface();
68 static std::string interfaceName() { return interface()->name; }
69 static int interfaceVersion() { return interface()->version; }
72 void send_active_angle(uint32_t angle);
73 void send_active_angle(struct ::wl_resource *resource, uint32_t angle);
76 virtual Resource *tizen_policy_ext_allocate();
78 virtual void tizen_policy_ext_bind_resource(Resource *resource);
79 virtual void tizen_policy_ext_destroy_resource(Resource *resource);
81 virtual void tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface);
82 virtual void tizen_policy_ext_get_active_angle(Resource *resource, struct ::wl_resource *surface);
85 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
86 static void destroy_func(struct ::wl_resource *client_resource);
87 static void display_destroy_func(struct ::wl_listener *listener, void *data);
89 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
90 Resource *bind(struct ::wl_resource *handle);
92 static const struct ::tizen_policy_ext_interface m_tizen_policy_ext_interface;
94 static void handle_get_rotation(
96 struct wl_resource *resource,
98 struct ::wl_resource *surface);
99 static void handle_get_active_angle(
101 struct wl_resource *resource,
102 struct ::wl_resource *surface);
104 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
105 Resource *m_resource;
106 struct ::wl_global *m_global;
107 uint32_t m_globalVersion;
108 struct DisplayDestroyedListener : ::wl_listener {
109 tizen_policy_ext *parent;
110 DisplayDestroyedListener(): parent(NULL) {}
112 DisplayDestroyedListener m_displayDestroyedListener;
118 tizen_rotation(struct ::wl_client *client, uint32_t id, int version);
119 tizen_rotation(struct ::wl_display *display, int version);
120 tizen_rotation(struct ::wl_resource *resource);
123 virtual ~tizen_rotation();
128 Resource() : tizen_rotation_object(NULL), handle(NULL) {}
129 virtual ~Resource() {}
131 tizen_rotation *tizen_rotation_object;
132 tizen_rotation *object() { return tizen_rotation_object; }
133 struct ::wl_resource *handle;
135 struct ::wl_client *client() const { return wl_resource_get_client(handle); }
136 int version() const { return wl_resource_get_version(handle); }
138 static Resource *fromResource(struct ::wl_resource *resource);
141 void init(struct ::wl_client *client, uint32_t id, int version);
142 void init(struct ::wl_display *display, int version);
143 void init(struct ::wl_resource *resource);
145 Resource *add(struct ::wl_client *client, int version);
146 Resource *add(struct ::wl_client *client, uint32_t id, int version);
147 Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
149 Resource *resource() { return m_resource; }
150 const Resource *resource() const { return m_resource; }
152 std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
153 const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
155 bool isGlobal() const { return m_global != NULL; }
156 bool isResource() const { return m_resource != NULL; }
158 static const struct ::wl_interface *interface();
159 static std::string interfaceName() { return interface()->name; }
160 static int interfaceVersion() { return interface()->version; }
171 void send_available_angles_done(uint32_t angles);
172 void send_available_angles_done(struct ::wl_resource *resource, uint32_t angles);
173 void send_preferred_angle_done(uint32_t angle);
174 void send_preferred_angle_done(struct ::wl_resource *resource, uint32_t angle);
175 void send_angle_change(uint32_t angle, uint32_t serial);
176 void send_angle_change(struct ::wl_resource *resource, uint32_t angle, uint32_t serial);
177 void send_angle_change_with_resize(uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
178 void send_angle_change_with_resize(struct ::wl_resource *resource, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
181 virtual Resource *tizen_rotation_allocate();
183 virtual void tizen_rotation_bind_resource(Resource *resource);
184 virtual void tizen_rotation_destroy_resource(Resource *resource);
186 virtual void tizen_rotation_destroy(Resource *resource);
187 virtual void tizen_rotation_set_available_angles(Resource *resource, uint32_t angles);
188 virtual void tizen_rotation_set_preferred_angle(Resource *resource, uint32_t angle);
189 virtual void tizen_rotation_ack_angle_change(Resource *resource, uint32_t serial);
190 virtual void tizen_rotation_set_geometry_hint(Resource *resource, uint32_t angle, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
193 static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
194 static void destroy_func(struct ::wl_resource *client_resource);
195 static void display_destroy_func(struct ::wl_listener *listener, void *data);
197 Resource *bind(struct ::wl_client *client, uint32_t id, int version);
198 Resource *bind(struct ::wl_resource *handle);
200 static const struct ::tizen_rotation_interface m_tizen_rotation_interface;
202 static void handle_destroy(
204 struct wl_resource *resource);
205 static void handle_set_available_angles(
207 struct wl_resource *resource,
209 static void handle_set_preferred_angle(
211 struct wl_resource *resource,
213 static void handle_ack_angle_change(
215 struct wl_resource *resource,
217 static void handle_set_geometry_hint(
219 struct wl_resource *resource,
226 std::multimap<struct ::wl_client*, Resource*> m_resource_map;
227 Resource *m_resource;
228 struct ::wl_global *m_global;
229 uint32_t m_globalVersion;
230 struct DisplayDestroyedListener : ::wl_listener {
231 tizen_rotation *parent;
232 DisplayDestroyedListener(): parent(NULL) {}
234 DisplayDestroyedListener m_displayDestroyedListener;