summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-01-18 09:42:29 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-01-18 13:04:47 -0600
commit50883f7a6f2feb93a5b1ad934aa211d2e65f64ee (patch)
treedf89f392a79c08ef44cb2700cc8cda20671c794b
parentdc84374d450705f4e9f8d3631eee77254f92494e (diff)
ecore_wl2: Auto generate xdg v5 protocol
Remove our generated copies, also rename the XDG_VERSION macro so it's not quite so confusing now that we support v5 and v6.
Diffstat (limited to '')
-rw-r--r--.gitignore2
-rw-r--r--src/Makefile_Ecore_Wl2.am6
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h4
-rw-r--r--src/lib/ecore_wl2/xdg-shell-client-protocol.h561
-rw-r--r--src/lib/ecore_wl2/xdg-shell-protocol.c125
6 files changed, 10 insertions, 691 deletions
diff --git a/.gitignore b/.gitignore
index b545383..91e6d8da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,5 +81,7 @@ Session.vim
81#Once all protocols are generated these will use wildcards 81#Once all protocols are generated these will use wildcards
82/src/lib/ecore_wl2/linux-dmabuf-unstable-v1-client-protocol.h 82/src/lib/ecore_wl2/linux-dmabuf-unstable-v1-client-protocol.h
83/src/lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c 83/src/lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c
84/src/lib/ecore_wl2/xdg-shell-unstable-v5-client-protocol.h
85/src/lib/ecore_wl2/xdg-shell-unstable-v5-protocol.c
84/src/lib/ecore_wl2/session-recovery-client-protocol.h 86/src/lib/ecore_wl2/session-recovery-client-protocol.h
85/src/lib/ecore_wl2/session-recovery-protocol.c 87/src/lib/ecore_wl2/session-recovery-protocol.c
diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am
index 50a979a..0e5d11a 100644
--- a/src/Makefile_Ecore_Wl2.am
+++ b/src/Makefile_Ecore_Wl2.am
@@ -12,8 +12,8 @@ lib/ecore_wl2/teamwork_protocol.c \
12lib/ecore_wl2/teamwork_protocol.h \ 12lib/ecore_wl2/teamwork_protocol.h \
13lib/ecore_wl2/session-recovery-client-protocol.h \ 13lib/ecore_wl2/session-recovery-client-protocol.h \
14lib/ecore_wl2/session-recovery-protocol.c \ 14lib/ecore_wl2/session-recovery-protocol.c \
15lib/ecore_wl2/xdg-shell-client-protocol.h \ 15lib/ecore_wl2/xdg-shell-unstable-v5-client-protocol.h \
16lib/ecore_wl2/xdg-shell-protocol.c \ 16lib/ecore_wl2/xdg-shell-unstable-v5-protocol.c \
17lib/ecore_wl2/www-protocol.h \ 17lib/ecore_wl2/www-protocol.h \
18lib/ecore_wl2/www-protocol.c \ 18lib/ecore_wl2/www-protocol.c \
19lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \ 19lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \
@@ -36,6 +36,8 @@ lib_ecore_wl2_libecore_wl2_la_DEPENDENCIES = @ECORE_WL2_INTERNAL_LIBS@
36lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ 36lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
37 37
38BUILT_SOURCES += \ 38BUILT_SOURCES += \
39 lib/ecore_wl2/xdg-shell-unstable-v5-client-protocol.h \
40 lib/ecore_wl2/xdg-shell-unstable-v5-protocol.c \
39 lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \ 41 lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \
40 lib/ecore_wl2/linux-dmabuf-unstable-v1-client-protocol.h \ 42 lib/ecore_wl2/linux-dmabuf-unstable-v1-client-protocol.h \
41 lib/ecore_wl2/session-recovery-protocol.c \ 43 lib/ecore_wl2/session-recovery-protocol.c \
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 139e2ff..99e7334 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -168,7 +168,8 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
168 168
169 ewd->wl.xdg_shell = 169 ewd->wl.xdg_shell =
170 wl_registry_bind(registry, id, &xdg_shell_interface, 1); 170 wl_registry_bind(registry, id, &xdg_shell_interface, 1);
171 xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION); 171 xdg_shell_use_unstable_version(ewd->wl.xdg_shell,
172 XDG_V5_UNSTABLE_VERSION);
172 xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL); 173 xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL);
173 174
174 EINA_INLIST_FOREACH(ewd->windows, window) 175 EINA_INLIST_FOREACH(ewd->windows, window)
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 91fce24..c872aa2 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -9,8 +9,8 @@
9#define EFL_TEAMWORK_VERSION 2 9#define EFL_TEAMWORK_VERSION 2
10# include "teamwork_protocol.h" 10# include "teamwork_protocol.h"
11 11
12# include "xdg-shell-client-protocol.h" 12# include "xdg-shell-unstable-v5-client-protocol.h"
13# define XDG_VERSION 5 13# define XDG_V5_UNSTABLE_VERSION 5
14 14
15# include "session-recovery-client-protocol.h" 15# include "session-recovery-client-protocol.h"
16 16
diff --git a/src/lib/ecore_wl2/xdg-shell-client-protocol.h b/src/lib/ecore_wl2/xdg-shell-client-protocol.h
deleted file mode 100644
index 24b92b0..0000000
--- a/src/lib/ecore_wl2/xdg-shell-client-protocol.h
+++ /dev/null
@@ -1,561 +0,0 @@
1/*
2 * Copyright © 2008-2013 Kristian Høgsberg
3 * Copyright © 2013 Rafael Antognolli
4 * Copyright © 2013 Jasper St. Pierre
5 * Copyright © 2010-2013 Intel Corporation
6 *
7 * Permission to use, copy, modify, distribute, and sell this
8 * software and its documentation for any purpose is hereby granted
9 * without fee, provided that the above copyright notice appear in
10 * all copies and that both that copyright notice and this permission
11 * notice appear in supporting documentation, and that the name of
12 * the copyright holders not be used in advertising or publicity
13 * pertaining to distribution of the software without specific,
14 * written prior permission. The copyright holders make no
15 * representations about the suitability of this software for any
16 * purpose. It is provided "as is" without express or implied
17 * warranty.
18 *
19 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
20 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
23 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
24 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
25 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
26 * THIS SOFTWARE.
27 */
28
29#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
30#define XDG_SHELL_CLIENT_PROTOCOL_H
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include <stdint.h>
37#include <stddef.h>
38#include "wayland-client.h"
39
40struct wl_client;
41struct wl_resource;
42
43struct wl_output;
44struct wl_seat;
45struct wl_surface;
46struct xdg_popup;
47struct xdg_shell;
48struct xdg_surface;
49
50extern const struct wl_interface xdg_shell_interface;
51extern const struct wl_interface xdg_surface_interface;
52extern const struct wl_interface xdg_popup_interface;
53
54#ifndef XDG_SHELL_VERSION_ENUM
55#define XDG_SHELL_VERSION_ENUM
56/**
57 * xdg_shell_version - latest protocol version
58 * @XDG_SHELL_VERSION_CURRENT: Always the latest version
59 *
60 * The 'current' member of this enum gives the version of the protocol.
61 * Implementations can compare this to the version they implement using
62 * static_assert to ensure the protocol and implementation versions match.
63 */
64enum xdg_shell_version {
65 XDG_SHELL_VERSION_CURRENT = 5,
66};
67#endif /* XDG_SHELL_VERSION_ENUM */
68
69#ifndef XDG_SHELL_ERROR_ENUM
70#define XDG_SHELL_ERROR_ENUM
71enum xdg_shell_error {
72 XDG_SHELL_ERROR_ROLE = 0,
73 XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1,
74 XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2,
75 XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3,
76};
77#endif /* XDG_SHELL_ERROR_ENUM */
78
79/**
80 * xdg_shell - create desktop-style surfaces
81 * @ping: check if the client is alive
82 *
83 * xdg_shell allows clients to turn a wl_surface into a "real window"
84 * which can be dragged, resized, stacked, and moved around by the user.
85 * Everything about this interface is suited towards traditional desktop
86 * environments.
87 */
88struct xdg_shell_listener {
89 /**
90 * ping - check if the client is alive
91 * @serial: pass this to the pong request
92 *
93 * The ping event asks the client if it's still alive. Pass the
94 * serial specified in the event back to the compositor by sending
95 * a "pong" request back with the specified serial.
96 *
97 * Compositors can use this to determine if the client is still
98 * alive. It's unspecified what will happen if the client doesn't
99 * respond to the ping request, or in what timeframe. Clients
100 * should try to respond in a reasonable amount of time.
101 *
102 * A compositor is free to ping in any way it wants, but a client
103 * must always respond to any xdg_shell object it created.
104 */
105 void (*ping)(void *data,
106 struct xdg_shell *xdg_shell,
107 uint32_t serial);
108};
109
110static inline int
111xdg_shell_add_listener(struct xdg_shell *xdg_shell,
112 const struct xdg_shell_listener *listener, void *data)
113{
114 return wl_proxy_add_listener((struct wl_proxy *) xdg_shell,
115 (void (**)(void)) listener, data);
116}
117
118#define XDG_SHELL_DESTROY 0
119#define XDG_SHELL_USE_UNSTABLE_VERSION 1
120#define XDG_SHELL_GET_XDG_SURFACE 2
121#define XDG_SHELL_GET_XDG_POPUP 3
122#define XDG_SHELL_PONG 4
123
124static inline void
125xdg_shell_set_user_data(struct xdg_shell *xdg_shell, void *user_data)
126{
127 wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data);
128}
129
130static inline void *
131xdg_shell_get_user_data(struct xdg_shell *xdg_shell)
132{
133 return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell);
134}
135
136static inline void
137xdg_shell_destroy(struct xdg_shell *xdg_shell)
138{
139 wl_proxy_marshal((struct wl_proxy *) xdg_shell,
140 XDG_SHELL_DESTROY);
141
142 wl_proxy_destroy((struct wl_proxy *) xdg_shell);
143}
144
145static inline void
146xdg_shell_use_unstable_version(struct xdg_shell *xdg_shell, int32_t version)
147{
148 wl_proxy_marshal((struct wl_proxy *) xdg_shell,
149 XDG_SHELL_USE_UNSTABLE_VERSION, version);
150}
151
152static inline struct xdg_surface *
153xdg_shell_get_xdg_surface(struct xdg_shell *xdg_shell, struct wl_surface *surface)
154{
155 struct wl_proxy *id;
156
157 id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
158 XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface);
159
160 return (struct xdg_surface *) id;
161}
162
163static inline struct xdg_popup *
164xdg_shell_get_xdg_popup(struct xdg_shell *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
165{
166 struct wl_proxy *id;
167
168 id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
169 XDG_SHELL_GET_XDG_POPUP, &xdg_popup_interface, NULL, surface, parent, seat, serial, x, y);
170
171 return (struct xdg_popup *) id;
172}
173
174static inline void
175xdg_shell_pong(struct xdg_shell *xdg_shell, uint32_t serial)
176{
177 wl_proxy_marshal((struct wl_proxy *) xdg_shell,
178 XDG_SHELL_PONG, serial);
179}
180
181#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM
182#define XDG_SURFACE_RESIZE_EDGE_ENUM
183/**
184 * xdg_surface_resize_edge - edge values for resizing
185 * @XDG_SURFACE_RESIZE_EDGE_NONE: (none)
186 * @XDG_SURFACE_RESIZE_EDGE_TOP: (none)
187 * @XDG_SURFACE_RESIZE_EDGE_BOTTOM: (none)
188 * @XDG_SURFACE_RESIZE_EDGE_LEFT: (none)
189 * @XDG_SURFACE_RESIZE_EDGE_TOP_LEFT: (none)
190 * @XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT: (none)
191 * @XDG_SURFACE_RESIZE_EDGE_RIGHT: (none)
192 * @XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT: (none)
193 * @XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT: (none)
194 *
195 * These values are used to indicate which edge of a surface is being
196 * dragged in a resize operation. The server may use this information to
197 * adapt its behavior, e.g. choose an appropriate cursor image.
198 */
199enum xdg_surface_resize_edge {
200 XDG_SURFACE_RESIZE_EDGE_NONE = 0,
201 XDG_SURFACE_RESIZE_EDGE_TOP = 1,
202 XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2,
203 XDG_SURFACE_RESIZE_EDGE_LEFT = 4,
204 XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5,
205 XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6,
206 XDG_SURFACE_RESIZE_EDGE_RIGHT = 8,
207 XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9,
208 XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10,
209};
210#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */
211
212#ifndef XDG_SURFACE_STATE_ENUM
213#define XDG_SURFACE_STATE_ENUM
214/**
215 * xdg_surface_state - types of state on the surface
216 * @XDG_SURFACE_STATE_MAXIMIZED: the surface is maximized
217 * @XDG_SURFACE_STATE_FULLSCREEN: the surface is fullscreen
218 * @XDG_SURFACE_STATE_RESIZING: (none)
219 * @XDG_SURFACE_STATE_ACTIVATED: (none)
220 *
221 * The different state values used on the surface. This is designed for
222 * state values like maximized, fullscreen. It is paired with the configure
223 * event to ensure that both the client and the compositor setting the
224 * state can be synchronized.
225 *
226 * States set in this way are double-buffered. They will get applied on the
227 * next commit.
228 *
229 * Desktop environments may extend this enum by taking up a range of values
230 * and documenting the range they chose in this description. They are not
231 * required to document the values for the range that they chose. Ideally,
232 * any good extensions from a desktop environment should make its way into
233 * standardization into this enum.
234 *
235 * The current reserved ranges are:
236 *
237 * 0x0000 - 0x0FFF: xdg-shell core values, documented below. 0x1000 -
238 * 0x1FFF: GNOME
239 */
240enum xdg_surface_state {
241 XDG_SURFACE_STATE_MAXIMIZED = 1,
242 XDG_SURFACE_STATE_FULLSCREEN = 2,
243 XDG_SURFACE_STATE_RESIZING = 3,
244 XDG_SURFACE_STATE_ACTIVATED = 4,
245};
246#endif /* XDG_SURFACE_STATE_ENUM */
247
248/**
249 * xdg_surface - A desktop window
250 * @configure: suggest a surface change
251 * @close: surface wants to be closed
252 *
253 * An interface that may be implemented by a wl_surface, for
254 * implementations that provide a desktop-style user interface.
255 *
256 * It provides requests to treat surfaces like windows, allowing to set
257 * properties like maximized, fullscreen, minimized, and to move and resize
258 * them, and associate metadata like title and app id.
259 *
260 * The client must call wl_surface.commit on the corresponding wl_surface
261 * for the xdg_surface state to take effect. Prior to committing the new
262 * state, it can set up initial configuration, such as maximizing or
263 * setting a window geometry.
264 *
265 * Even without attaching a buffer the compositor must respond to initial
266 * committed configuration, for instance sending a configure event with
267 * expected window geometry if the client maximized its surface during
268 * initialization.
269 *
270 * For a surface to be mapped by the compositor the client must have
271 * committed both an xdg_surface state and a buffer.
272 */
273struct xdg_surface_listener {
274 /**
275 * configure - suggest a surface change
276 * @width: (none)
277 * @height: (none)
278 * @states: (none)
279 * @serial: (none)
280 *
281 * The configure event asks the client to resize its surface or
282 * to change its state.
283 *
284 * The width and height arguments specify a hint to the window
285 * about how its surface should be resized in window geometry
286 * coordinates. See set_window_geometry.
287 *
288 * If the width or height arguments are zero, it means the client
289 * should decide its own window dimension. This may happen when the
290 * compositor need to configure the state of the surface but
291 * doesn't have any information about any previous or expected
292 * dimension.
293 *
294 * The states listed in the event specify how the width/height
295 * arguments should be interpreted, and possibly how it should be
296 * drawn.
297 *
298 * Clients should arrange their surface for the new size and
299 * states, and then send a ack_configure request with the serial
300 * sent in this configure event at some point before committing the
301 * new surface.
302 *
303 * If the client receives multiple configure events before it can
304 * respond to one, it is free to discard all but the last event it
305 * received.
306 */
307 void (*configure)(void *data,
308 struct xdg_surface *xdg_surface,
309 int32_t width,
310 int32_t height,
311 struct wl_array *states,
312 uint32_t serial);
313 /**
314 * close - surface wants to be closed
315 *
316 * The close event is sent by the compositor when the user wants
317 * the surface to be closed. This should be equivalent to the user
318 * clicking the close button in client-side decorations, if your
319 * application has any...
320 *
321 * This is only a request that the user intends to close your
322 * window. The client may choose to ignore this request, or show a
323 * dialog to ask the user to save their data...
324 */
325 void (*close)(void *data,
326 struct xdg_surface *xdg_surface);
327};
328
329static inline int
330xdg_surface_add_listener(struct xdg_surface *xdg_surface,
331 const struct xdg_surface_listener *listener, void *data)
332{
333 return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
334 (void (**)(void)) listener, data);
335}
336
337#define XDG_SURFACE_DESTROY 0
338#define XDG_SURFACE_SET_PARENT 1
339#define XDG_SURFACE_SET_TITLE 2
340#define XDG_SURFACE_SET_APP_ID 3
341#define XDG_SURFACE_SHOW_WINDOW_MENU 4
342#define XDG_SURFACE_MOVE 5
343#define XDG_SURFACE_RESIZE 6
344#define XDG_SURFACE_ACK_CONFIGURE 7
345#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8
346#define XDG_SURFACE_SET_MAXIMIZED 9
347#define XDG_SURFACE_UNSET_MAXIMIZED 10
348#define XDG_SURFACE_SET_FULLSCREEN 11
349#define XDG_SURFACE_UNSET_FULLSCREEN 12
350#define XDG_SURFACE_SET_MINIMIZED 13
351
352static inline void
353xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
354{
355 wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
356}
357
358static inline void *
359xdg_surface_get_user_data(struct xdg_surface *xdg_surface)
360{
361 return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
362}
363
364static inline void
365xdg_surface_destroy(struct xdg_surface *xdg_surface)
366{
367 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
368 XDG_SURFACE_DESTROY);
369
370 wl_proxy_destroy((struct wl_proxy *) xdg_surface);
371}
372
373static inline void
374xdg_surface_set_parent(struct xdg_surface *xdg_surface, struct xdg_surface *parent)
375{
376 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
377 XDG_SURFACE_SET_PARENT, parent);
378}
379
380static inline void
381xdg_surface_set_title(struct xdg_surface *xdg_surface, const char *title)
382{
383 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
384 XDG_SURFACE_SET_TITLE, title);
385}
386
387static inline void
388xdg_surface_set_app_id(struct xdg_surface *xdg_surface, const char *app_id)
389{
390 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
391 XDG_SURFACE_SET_APP_ID, app_id);
392}
393
394static inline void
395xdg_surface_show_window_menu(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
396{
397 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
398 XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y);
399}
400
401static inline void
402xdg_surface_move(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial)
403{
404 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
405 XDG_SURFACE_MOVE, seat, serial);
406}
407
408static inline void
409xdg_surface_resize(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
410{
411 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
412 XDG_SURFACE_RESIZE, seat, serial, edges);
413}
414
415static inline void
416xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
417{
418 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
419 XDG_SURFACE_ACK_CONFIGURE, serial);
420}
421
422static inline void
423xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
424{
425 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
426 XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height);
427}
428
429static inline void
430xdg_surface_set_maximized(struct xdg_surface *xdg_surface)
431{
432 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
433 XDG_SURFACE_SET_MAXIMIZED);
434}
435
436static inline void
437xdg_surface_unset_maximized(struct xdg_surface *xdg_surface)
438{
439 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
440 XDG_SURFACE_UNSET_MAXIMIZED);
441}
442
443static inline void
444xdg_surface_set_fullscreen(struct xdg_surface *xdg_surface, struct wl_output *output)
445{
446 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
447 XDG_SURFACE_SET_FULLSCREEN, output);
448}
449
450static inline void
451xdg_surface_unset_fullscreen(struct xdg_surface *xdg_surface)
452{
453 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
454 XDG_SURFACE_UNSET_FULLSCREEN);
455}
456
457static inline void
458xdg_surface_set_minimized(struct xdg_surface *xdg_surface)
459{
460 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
461 XDG_SURFACE_SET_MINIMIZED);
462}
463
464/**
465 * xdg_popup - short-lived, popup surfaces for menus
466 * @popup_done: popup interaction is done
467 *
468 * A popup surface is a short-lived, temporary surface that can be used
469 * to implement menus. It takes an explicit grab on the surface that will
470 * be dismissed when the user dismisses the popup. This can be done by the
471 * user clicking outside the surface, using the keyboard, or even locking
472 * the screen through closing the lid or a timeout.
473 *
474 * When the popup is dismissed, a popup_done event will be sent out, and at
475 * the same time the surface will be unmapped. The xdg_popup object is now
476 * inert and cannot be reactivated, so clients should destroy it.
477 * Explicitly destroying the xdg_popup object will also dismiss the popup
478 * and unmap the surface.
479 *
480 * Clients will receive events for all their surfaces during this grab
481 * (which is an "owner-events" grab in X11 parlance). This is done so that
482 * users can navigate through submenus and other "nested" popup windows
483 * without having to dismiss the topmost popup.
484 *
485 * Clients that want to dismiss the popup when another surface of their own
486 * is clicked should dismiss the popup using the destroy request.
487 *
488 * The parent surface must have either an xdg_surface or xdg_popup role.
489 *
490 * Specifying an xdg_popup for the parent means that the popups are nested,
491 * with this popup now being the topmost popup. Nested popups must be
492 * destroyed in the reverse order they were created in, e.g. the only popup
493 * you are allowed to destroy at all times is the topmost one.
494 *
495 * If there is an existing popup when creating a new popup, the parent must
496 * be the current topmost popup.
497 *
498 * A parent surface must be mapped before the new popup is mapped.
499 *
500 * When compositors choose to dismiss a popup, they will likely dismiss
501 * every nested popup as well. When a compositor dismisses popups, it will
502 * follow the same dismissing order as required from the client.
503 *
504 * The x and y arguments passed when creating the popup object specify
505 * where the top left of the popup should be placed, relative to the local
506 * surface coordinates of the parent surface. See xdg_shell.get_xdg_popup.
507 *
508 * The client must call wl_surface.commit on the corresponding wl_surface
509 * for the xdg_popup state to take effect.
510 *
511 * For a surface to be mapped by the compositor the client must have
512 * committed both the xdg_popup state and a buffer.
513 */
514struct xdg_popup_listener {
515 /**
516 * popup_done - popup interaction is done
517 *
518 * The popup_done event is sent out when a popup is dismissed by
519 * the compositor. The client should destroy the xdg_popup object
520 * at this point.
521 */
522 void (*popup_done)(void *data,
523 struct xdg_popup *xdg_popup);
524};
525
526static inline int
527xdg_popup_add_listener(struct xdg_popup *xdg_popup,
528 const struct xdg_popup_listener *listener, void *data)
529{
530 return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
531 (void (**)(void)) listener, data);
532}
533
534#define XDG_POPUP_DESTROY 0
535
536static inline void
537xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)
538{
539 wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
540}
541
542static inline void *
543xdg_popup_get_user_data(struct xdg_popup *xdg_popup)
544{
545 return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
546}
547
548static inline void
549xdg_popup_destroy(struct xdg_popup *xdg_popup)
550{
551 wl_proxy_marshal((struct wl_proxy *) xdg_popup,
552 XDG_POPUP_DESTROY);
553
554 wl_proxy_destroy((struct wl_proxy *) xdg_popup);
555}
556
557#ifdef __cplusplus
558}
559#endif
560
561#endif
diff --git a/src/lib/ecore_wl2/xdg-shell-protocol.c b/src/lib/ecore_wl2/xdg-shell-protocol.c
deleted file mode 100644
index 82433ea..0000000
--- a/src/lib/ecore_wl2/xdg-shell-protocol.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Copyright © 2008-2013 Kristian Høgsberg
3 * Copyright © 2013 Rafael Antognolli
4 * Copyright © 2013 Jasper St. Pierre
5 * Copyright © 2010-2013 Intel Corporation
6 *
7 * Permission to use, copy, modify, distribute, and sell this
8 * software and its documentation for any purpose is hereby granted
9 * without fee, provided that the above copyright notice appear in
10 * all copies and that both that copyright notice and this permission
11 * notice appear in supporting documentation, and that the name of
12 * the copyright holders not be used in advertising or publicity
13 * pertaining to distribution of the software without specific,
14 * written prior permission. The copyright holders make no
15 * representations about the suitability of this software for any
16 * purpose. It is provided "as is" without express or implied
17 * warranty.
18 *
19 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
20 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
23 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
24 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
25 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
26 * THIS SOFTWARE.
27 */
28
29#include <stdlib.h>
30#include <stdint.h>
31#include "wayland-util.h"
32
33extern const struct wl_interface wl_output_interface;
34extern const struct wl_interface wl_seat_interface;
35extern const struct wl_interface wl_surface_interface;
36extern const struct wl_interface xdg_popup_interface;
37extern const struct wl_interface xdg_surface_interface;
38
39static const struct wl_interface *types[] = {
40 NULL,
41 NULL,
42 NULL,
43 NULL,
44 &xdg_surface_interface,
45 &wl_surface_interface,
46 &xdg_popup_interface,
47 &wl_surface_interface,
48 &wl_surface_interface,
49 &wl_seat_interface,
50 NULL,
51 NULL,
52 NULL,
53 &xdg_surface_interface,
54 &wl_seat_interface,
55 NULL,
56 NULL,
57 NULL,
58 &wl_seat_interface,
59 NULL,
60 &wl_seat_interface,
61 NULL,
62 NULL,
63 &wl_output_interface,
64};
65
66static const struct wl_message xdg_shell_requests[] = {
67 { "destroy", "", types + 0 },
68 { "use_unstable_version", "i", types + 0 },
69 { "get_xdg_surface", "no", types + 4 },
70 { "get_xdg_popup", "nooouii", types + 6 },
71 { "pong", "u", types + 0 },
72};
73
74static const struct wl_message xdg_shell_events[] = {
75 { "ping", "u", types + 0 },
76};
77
78WL_EXPORT const struct wl_interface xdg_shell_interface = {
79 "xdg_shell", 1,
80 5, xdg_shell_requests,
81 1, xdg_shell_events,
82};
83
84static const struct wl_message xdg_surface_requests[] = {
85 { "destroy", "", types + 0 },
86 { "set_parent", "?o", types + 13 },
87 { "set_title", "s", types + 0 },
88 { "set_app_id", "s", types + 0 },
89 { "show_window_menu", "ouii", types + 14 },
90 { "move", "ou", types + 18 },
91 { "resize", "ouu", types + 20 },
92 { "ack_configure", "u", types + 0 },
93 { "set_window_geometry", "iiii", types + 0 },
94 { "set_maximized", "", types + 0 },
95 { "unset_maximized", "", types + 0 },
96 { "set_fullscreen", "?o", types + 23 },
97 { "unset_fullscreen", "", types + 0 },
98 { "set_minimized", "", types + 0 },
99};
100
101static const struct wl_message xdg_surface_events[] = {
102 { "configure", "iiau", types + 0 },
103 { "close", "", types + 0 },
104};
105
106WL_EXPORT const struct wl_interface xdg_surface_interface = {
107 "xdg_surface", 1,
108 14, xdg_surface_requests,
109 2, xdg_surface_events,
110};
111
112static const struct wl_message xdg_popup_requests[] = {
113 { "destroy", "", types + 0 },
114};
115
116static const struct wl_message xdg_popup_events[] = {
117 { "popup_done", "", types + 0 },
118};
119
120WL_EXPORT const struct wl_interface xdg_popup_interface = {
121 "xdg_popup", 1,
122 1, xdg_popup_requests,
123 1, xdg_popup_events,
124};
125