summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-06-08 10:56:10 -0400
committerChris Michael <cp.michael@samsung.com>2015-06-08 10:58:51 -0400
commit13df35050cdf5e500e9dbe1290ca3dd83580f252 (patch)
treefbb0b8a50964dd6d5c7f4b254bf51c6c4ec96222 /src/lib/ecore_wayland
parent7a38f8ec2129a4ae7ca1c1f76fba47d0cd1f7052 (diff)
ecore-wayland: Fix T2466: Update xdg shell protocol code
Summary: This updates the xdg_shell protocol and code to support XDG_SHELL version 5. This allows EFL/Elm apps to function again in Weston. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c2
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c9
-rw-r--r--src/lib/ecore_wayland/xdg-shell-client-protocol.h447
-rw-r--r--src/lib/ecore_wayland/xdg-shell-protocol.c121
4 files changed, 322 insertions, 257 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index a04d2df..f5d13ed 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -17,7 +17,7 @@
17#endif 17#endif
18 18
19#include "xdg-shell-client-protocol.h" 19#include "xdg-shell-client-protocol.h"
20#define XDG_VERSION 4 20#define XDG_VERSION 5
21 21
22/* local function prototypes */ 22/* local function prototypes */
23static int _ecore_wl_shutdown(Eina_Bool close); 23static int _ecore_wl_shutdown(Eina_Bool close);
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 8811ded..ab3f28d 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -15,7 +15,7 @@ static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h,
15static char *_ecore_wl_window_id_str_get(unsigned int win_id); 15static char *_ecore_wl_window_id_str_get(unsigned int win_id);
16static void _ecore_xdg_handle_surface_configure(void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height,struct wl_array *states, uint32_t serial); 16static void _ecore_xdg_handle_surface_configure(void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height,struct wl_array *states, uint32_t serial);
17static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface); 17static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface);
18static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup, unsigned int serial); 18static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup);
19 19
20/* local variables */ 20/* local variables */
21static Eina_Hash *_windows = NULL; 21static Eina_Hash *_windows = NULL;
@@ -368,7 +368,7 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
368 break; 368 break;
369 case ECORE_WL_WINDOW_TYPE_TRANSIENT: 369 case ECORE_WL_WINDOW_TYPE_TRANSIENT:
370 if (win->xdg_surface) 370 if (win->xdg_surface)
371 xdg_surface_set_parent(win->xdg_surface, win->parent->surface); 371 xdg_surface_set_parent(win->xdg_surface, win->parent->xdg_surface);
372 else if (win->shell_surface) 372 else if (win->shell_surface)
373 wl_shell_surface_set_transient(win->shell_surface, 373 wl_shell_surface_set_transient(win->shell_surface,
374 win->parent->surface, 374 win->parent->surface,
@@ -384,8 +384,7 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
384 win->parent->surface, 384 win->parent->surface,
385 _ecore_wl_disp->input->seat, 385 _ecore_wl_disp->input->seat,
386 _ecore_wl_disp->serial, 386 _ecore_wl_disp->serial,
387 win->allocation.x, 387 win->allocation.x, win->allocation.y);
388 win->allocation.y, 0);
389 if (!win->xdg_popup) return; 388 if (!win->xdg_popup) return;
390 xdg_popup_set_user_data(win->xdg_popup, win); 389 xdg_popup_set_user_data(win->xdg_popup, win);
391 xdg_popup_add_listener(win->xdg_popup, 390 xdg_popup_add_listener(win->xdg_popup,
@@ -1052,7 +1051,7 @@ _ecore_wl_window_cb_popup_done(void *data, struct wl_shell_surface *shell_surfac
1052} 1051}
1053 1052
1054static void 1053static void
1055_ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup, unsigned int serial EINA_UNUSED) 1054_ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup)
1056{ 1055{
1057 Ecore_Wl_Window *win; 1056 Ecore_Wl_Window *win;
1058 1057
diff --git a/src/lib/ecore_wayland/xdg-shell-client-protocol.h b/src/lib/ecore_wayland/xdg-shell-client-protocol.h
index eabf8ee..24b92b0 100644
--- a/src/lib/ecore_wayland/xdg-shell-client-protocol.h
+++ b/src/lib/ecore_wayland/xdg-shell-client-protocol.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * Copyright © 2008-2013 Kristian Høgsberg 2 * Copyright © 2008-2013 Kristian Høgsberg
3 * Copyright © 2013 Rafael Antognolli 3 * Copyright © 2013 Rafael Antognolli
4 * Copyright © 2013 Jasper St. Pierre 4 * Copyright © 2013 Jasper St. Pierre
5 * Copyright © 2010-2013 Intel Corporation 5 * Copyright © 2010-2013 Intel Corporation
6 * 6 *
7 * Permission to use, copy, modify, distribute, and sell this 7 * Permission to use, copy, modify, distribute, and sell this
8 * software and its documentation for any purpose is hereby granted 8 * software and its documentation for any purpose is hereby granted
9 * without fee, provided that the above copyright notice appear in 9 * without fee, provided that the above copyright notice appear in
@@ -15,7 +15,7 @@
15 * representations about the suitability of this software for any 15 * representations about the suitability of this software for any
16 * purpose. It is provided "as is" without express or implied 16 * purpose. It is provided "as is" without express or implied
17 * warranty. 17 * warranty.
18 * 18 *
19 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 19 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
20 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
@@ -40,9 +40,12 @@ extern "C" {
40struct wl_client; 40struct wl_client;
41struct wl_resource; 41struct wl_resource;
42 42
43struct wl_output;
44struct wl_seat;
45struct wl_surface;
46struct xdg_popup;
43struct xdg_shell; 47struct xdg_shell;
44struct xdg_surface; 48struct xdg_surface;
45struct xdg_popup;
46 49
47extern const struct wl_interface xdg_shell_interface; 50extern const struct wl_interface xdg_shell_interface;
48extern const struct wl_interface xdg_surface_interface; 51extern const struct wl_interface xdg_surface_interface;
@@ -59,103 +62,120 @@ extern const struct wl_interface xdg_popup_interface;
59 * static_assert to ensure the protocol and implementation versions match. 62 * static_assert to ensure the protocol and implementation versions match.
60 */ 63 */
61enum xdg_shell_version { 64enum xdg_shell_version {
62 XDG_SHELL_VERSION_CURRENT = 4, 65 XDG_SHELL_VERSION_CURRENT = 5,
63}; 66};
64#endif /* XDG_SHELL_VERSION_ENUM */ 67#endif /* XDG_SHELL_VERSION_ENUM */
65 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
66/** 79/**
67 * xdg_shell - create desktop-style surfaces 80 * xdg_shell - create desktop-style surfaces
68 * @ping: check if the client is alive 81 * @ping: check if the client is alive
69 * 82 *
70 * This interface is implemented by servers that provide desktop-style 83 * xdg_shell allows clients to turn a wl_surface into a "real window"
71 * user interfaces. 84 * which can be dragged, resized, stacked, and moved around by the user.
72 * 85 * Everything about this interface is suited towards traditional desktop
73 * It allows clients to associate a xdg_surface with a basic surface. 86 * environments.
74 */ 87 */
75struct xdg_shell_listener { 88struct xdg_shell_listener {
76 /** 89 /**
77 * ping - check if the client is alive 90 * ping - check if the client is alive
78 * @serial: pass this to the callback 91 * @serial: pass this to the pong request
79 * 92 *
80 * The ping event asks the client if it's still alive. Pass the 93 * The ping event asks the client if it's still alive. Pass the
81 * serial specified in the event back to the compositor by sending 94 * serial specified in the event back to the compositor by sending
82 * a "pong" request back with the specified serial. 95 * a "pong" request back with the specified serial.
83 * 96 *
84 * Compositors can use this to determine if the client is still 97 * Compositors can use this to determine if the client is still
85 * alive. It's unspecified what will happen if the client doesn't 98 * alive. It's unspecified what will happen if the client doesn't
86 * respond to the ping request, or in what timeframe. Clients 99 * respond to the ping request, or in what timeframe. Clients
87 * should try to respond in a reasonable amount of time. 100 * should try to respond in a reasonable amount of time.
88 */ 101 *
89 void (*ping)(void *data, 102 * A compositor is free to ping in any way it wants, but a client
90 struct xdg_shell *xdg_shell, 103 * must always respond to any xdg_shell object it created.
91 uint32_t serial); 104 */
105 void (*ping)(void *data,
106 struct xdg_shell *xdg_shell,
107 uint32_t serial);
92}; 108};
93 109
94static inline int 110static inline int
95xdg_shell_add_listener(struct xdg_shell *xdg_shell, 111xdg_shell_add_listener(struct xdg_shell *xdg_shell,
96 const struct xdg_shell_listener *listener, void *data) 112 const struct xdg_shell_listener *listener, void *data)
97{ 113{
98 return wl_proxy_add_listener((struct wl_proxy *) xdg_shell, 114 return wl_proxy_add_listener((struct wl_proxy *) xdg_shell,
99 (void (**)(void)) listener, data); 115 (void (**)(void)) listener, data);
100} 116}
101 117
102#define XDG_SHELL_USE_UNSTABLE_VERSION 0 118#define XDG_SHELL_DESTROY 0
103#define XDG_SHELL_GET_XDG_SURFACE 1 119#define XDG_SHELL_USE_UNSTABLE_VERSION 1
104#define XDG_SHELL_GET_XDG_POPUP 2 120#define XDG_SHELL_GET_XDG_SURFACE 2
105#define XDG_SHELL_PONG 3 121#define XDG_SHELL_GET_XDG_POPUP 3
122#define XDG_SHELL_PONG 4
106 123
107static inline void 124static inline void
108xdg_shell_set_user_data(struct xdg_shell *xdg_shell, void *user_data) 125xdg_shell_set_user_data(struct xdg_shell *xdg_shell, void *user_data)
109{ 126{
110 wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data); 127 wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data);
111} 128}
112 129
113static inline void * 130static inline void *
114xdg_shell_get_user_data(struct xdg_shell *xdg_shell) 131xdg_shell_get_user_data(struct xdg_shell *xdg_shell)
115{ 132{
116 return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell); 133 return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell);
117} 134}
118 135
119static inline void 136static inline void
120xdg_shell_destroy(struct xdg_shell *xdg_shell) 137xdg_shell_destroy(struct xdg_shell *xdg_shell)
121{ 138{
122 wl_proxy_destroy((struct wl_proxy *) xdg_shell); 139 wl_proxy_marshal((struct wl_proxy *) xdg_shell,
140 XDG_SHELL_DESTROY);
141
142 wl_proxy_destroy((struct wl_proxy *) xdg_shell);
123} 143}
124 144
125static inline void 145static inline void
126xdg_shell_use_unstable_version(struct xdg_shell *xdg_shell, int32_t version) 146xdg_shell_use_unstable_version(struct xdg_shell *xdg_shell, int32_t version)
127{ 147{
128 wl_proxy_marshal((struct wl_proxy *) xdg_shell, 148 wl_proxy_marshal((struct wl_proxy *) xdg_shell,
129 XDG_SHELL_USE_UNSTABLE_VERSION, version); 149 XDG_SHELL_USE_UNSTABLE_VERSION, version);
130} 150}
131 151
132static inline struct xdg_surface * 152static inline struct xdg_surface *
133xdg_shell_get_xdg_surface(struct xdg_shell *xdg_shell, struct wl_surface *surface) 153xdg_shell_get_xdg_surface(struct xdg_shell *xdg_shell, struct wl_surface *surface)
134{ 154{
135 struct wl_proxy *id; 155 struct wl_proxy *id;
136 156
137 id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, 157 id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
138 XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface); 158 XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface);
139 159
140 return (struct xdg_surface *) id; 160 return (struct xdg_surface *) id;
141} 161}
142 162
143static inline struct xdg_popup * 163static inline struct xdg_popup *
144xdg_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, uint32_t flags) 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)
145{ 165{
146 struct wl_proxy *id; 166 struct wl_proxy *id;
147 167
148 id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, 168 id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
149 XDG_SHELL_GET_XDG_POPUP, &xdg_popup_interface, NULL, surface, parent, seat, serial, x, y, flags); 169 XDG_SHELL_GET_XDG_POPUP, &xdg_popup_interface, NULL, surface, parent, seat, serial, x, y);
150 170
151 return (struct xdg_popup *) id; 171 return (struct xdg_popup *) id;
152} 172}
153 173
154static inline void 174static inline void
155xdg_shell_pong(struct xdg_shell *xdg_shell, uint32_t serial) 175xdg_shell_pong(struct xdg_shell *xdg_shell, uint32_t serial)
156{ 176{
157 wl_proxy_marshal((struct wl_proxy *) xdg_shell, 177 wl_proxy_marshal((struct wl_proxy *) xdg_shell,
158 XDG_SHELL_PONG, serial); 178 XDG_SHELL_PONG, serial);
159} 179}
160 180
161#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM 181#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM
@@ -177,15 +197,15 @@ xdg_shell_pong(struct xdg_shell *xdg_shell, uint32_t serial)
177 * adapt its behavior, e.g. choose an appropriate cursor image. 197 * adapt its behavior, e.g. choose an appropriate cursor image.
178 */ 198 */
179enum xdg_surface_resize_edge { 199enum xdg_surface_resize_edge {
180 XDG_SURFACE_RESIZE_EDGE_NONE = 0, 200 XDG_SURFACE_RESIZE_EDGE_NONE = 0,
181 XDG_SURFACE_RESIZE_EDGE_TOP = 1, 201 XDG_SURFACE_RESIZE_EDGE_TOP = 1,
182 XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2, 202 XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2,
183 XDG_SURFACE_RESIZE_EDGE_LEFT = 4, 203 XDG_SURFACE_RESIZE_EDGE_LEFT = 4,
184 XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5, 204 XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5,
185 XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6, 205 XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6,
186 XDG_SURFACE_RESIZE_EDGE_RIGHT = 8, 206 XDG_SURFACE_RESIZE_EDGE_RIGHT = 8,
187 XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9, 207 XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9,
188 XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10, 208 XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10,
189}; 209};
190#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */ 210#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */
191 211
@@ -218,15 +238,15 @@ enum xdg_surface_resize_edge {
218 * 0x1FFF: GNOME 238 * 0x1FFF: GNOME
219 */ 239 */
220enum xdg_surface_state { 240enum xdg_surface_state {
221 XDG_SURFACE_STATE_MAXIMIZED = 1, 241 XDG_SURFACE_STATE_MAXIMIZED = 1,
222 XDG_SURFACE_STATE_FULLSCREEN = 2, 242 XDG_SURFACE_STATE_FULLSCREEN = 2,
223 XDG_SURFACE_STATE_RESIZING = 3, 243 XDG_SURFACE_STATE_RESIZING = 3,
224 XDG_SURFACE_STATE_ACTIVATED = 4, 244 XDG_SURFACE_STATE_ACTIVATED = 4,
225}; 245};
226#endif /* XDG_SURFACE_STATE_ENUM */ 246#endif /* XDG_SURFACE_STATE_ENUM */
227 247
228/** 248/**
229 * xdg_surface - desktop-style metadata interface 249 * xdg_surface - A desktop window
230 * @configure: suggest a surface change 250 * @configure: suggest a surface change
231 * @close: surface wants to be closed 251 * @close: surface wants to be closed
232 * 252 *
@@ -237,256 +257,301 @@ enum xdg_surface_state {
237 * properties like maximized, fullscreen, minimized, and to move and resize 257 * properties like maximized, fullscreen, minimized, and to move and resize
238 * them, and associate metadata like title and app id. 258 * them, and associate metadata like title and app id.
239 * 259 *
240 * On the server side the object is automatically destroyed when the 260 * The client must call wl_surface.commit on the corresponding wl_surface
241 * related wl_surface is destroyed. On client side, xdg_surface.destroy() 261 * for the xdg_surface state to take effect. Prior to committing the new
242 * must be called before destroying the wl_surface object. 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.
243 */ 272 */
244struct xdg_surface_listener { 273struct xdg_surface_listener {
245 /** 274 /**
246 * configure - suggest a surface change 275 * configure - suggest a surface change
247 * @width: (none) 276 * @width: (none)
248 * @height: (none) 277 * @height: (none)
249 * @states: (none) 278 * @states: (none)
250 * @serial: (none) 279 * @serial: (none)
251 * 280 *
252 * The configure event asks the client to resize its surface. 281 * The configure event asks the client to resize its surface or
253 * 282 * to change its state.
254 * The width and height arguments specify a hint to the window 283 *
255 * about how its surface should be resized in window geometry 284 * The width and height arguments specify a hint to the window
256 * coordinates. The states listed in the event specify how the 285 * about how its surface should be resized in window geometry
257 * width/height arguments should be interpreted. 286 * coordinates. See set_window_geometry.
258 * 287 *
259 * A client should arrange a new surface, and then send a 288 * If the width or height arguments are zero, it means the client
260 * ack_configure request with the serial sent in this configure 289 * should decide its own window dimension. This may happen when the
261 * event before attaching a new surface. 290 * compositor need to configure the state of the surface but
262 * 291 * doesn't have any information about any previous or expected
263 * If the client receives multiple configure events before it can 292 * dimension.
264 * respond to one, it is free to discard all but the last event it 293 *
265 * received. 294 * The states listed in the event specify how the width/height
266 */ 295 * arguments should be interpreted, and possibly how it should be
267 void (*configure)(void *data, 296 * drawn.
268 struct xdg_surface *xdg_surface, 297 *
269 int32_t width, 298 * Clients should arrange their surface for the new size and
270 int32_t height, 299 * states, and then send a ack_configure request with the serial
271 struct wl_array *states, 300 * sent in this configure event at some point before committing the
272 uint32_t serial); 301 * new surface.
273 /** 302 *
274 * close - surface wants to be closed 303 * If the client receives multiple configure events before it can
275 * 304 * respond to one, it is free to discard all but the last event it
276 * The close event is sent by the compositor when the user wants 305 * received.
277 * the surface to be closed. This should be equivalent to the user 306 */
278 * clicking the close button in client-side decorations, if your 307 void (*configure)(void *data,
279 * application has any... 308 struct xdg_surface *xdg_surface,
280 * 309 int32_t width,
281 * This is only a request that the user intends to close your 310 int32_t height,
282 * window. The client may choose to ignore this request, or show a 311 struct wl_array *states,
283 * dialog to ask the user to save their data... 312 uint32_t serial);
284 */ 313 /**
285 void (*close)(void *data, 314 * close - surface wants to be closed
286 struct xdg_surface *xdg_surface); 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);
287}; 327};
288 328
289static inline int 329static inline int
290xdg_surface_add_listener(struct xdg_surface *xdg_surface, 330xdg_surface_add_listener(struct xdg_surface *xdg_surface,
291 const struct xdg_surface_listener *listener, void *data) 331 const struct xdg_surface_listener *listener, void *data)
292{ 332{
293 return wl_proxy_add_listener((struct wl_proxy *) xdg_surface, 333 return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
294 (void (**)(void)) listener, data); 334 (void (**)(void)) listener, data);
295} 335}
296 336
297#define XDG_SURFACE_DESTROY 0 337#define XDG_SURFACE_DESTROY 0
298#define XDG_SURFACE_SET_PARENT 1 338#define XDG_SURFACE_SET_PARENT 1
299#define XDG_SURFACE_SET_TITLE 2 339#define XDG_SURFACE_SET_TITLE 2
300#define XDG_SURFACE_SET_APP_ID 3 340#define XDG_SURFACE_SET_APP_ID 3
301#define XDG_SURFACE_SHOW_WINDOW_MENU 4 341#define XDG_SURFACE_SHOW_WINDOW_MENU 4
302#define XDG_SURFACE_MOVE 5 342#define XDG_SURFACE_MOVE 5
303#define XDG_SURFACE_RESIZE 6 343#define XDG_SURFACE_RESIZE 6
304#define XDG_SURFACE_ACK_CONFIGURE 7 344#define XDG_SURFACE_ACK_CONFIGURE 7
305#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8 345#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8
306#define XDG_SURFACE_SET_MAXIMIZED 9 346#define XDG_SURFACE_SET_MAXIMIZED 9
307#define XDG_SURFACE_UNSET_MAXIMIZED 10 347#define XDG_SURFACE_UNSET_MAXIMIZED 10
308#define XDG_SURFACE_SET_FULLSCREEN 11 348#define XDG_SURFACE_SET_FULLSCREEN 11
309#define XDG_SURFACE_UNSET_FULLSCREEN 12 349#define XDG_SURFACE_UNSET_FULLSCREEN 12
310#define XDG_SURFACE_SET_MINIMIZED 13 350#define XDG_SURFACE_SET_MINIMIZED 13
311 351
312static inline void 352static inline void
313xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data) 353xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
314{ 354{
315 wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data); 355 wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
316} 356}
317 357
318static inline void * 358static inline void *
319xdg_surface_get_user_data(struct xdg_surface *xdg_surface) 359xdg_surface_get_user_data(struct xdg_surface *xdg_surface)
320{ 360{
321 return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface); 361 return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
322} 362}
323 363
324static inline void 364static inline void
325xdg_surface_destroy(struct xdg_surface *xdg_surface) 365xdg_surface_destroy(struct xdg_surface *xdg_surface)
326{ 366{
327 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 367 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
328 XDG_SURFACE_DESTROY); 368 XDG_SURFACE_DESTROY);
329 369
330 wl_proxy_destroy((struct wl_proxy *) xdg_surface); 370 wl_proxy_destroy((struct wl_proxy *) xdg_surface);
331} 371}
332 372
333static inline void 373static inline void
334xdg_surface_set_parent(struct xdg_surface *xdg_surface, struct wl_surface *parent) 374xdg_surface_set_parent(struct xdg_surface *xdg_surface, struct xdg_surface *parent)
335{ 375{
336 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 376 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
337 XDG_SURFACE_SET_PARENT, parent); 377 XDG_SURFACE_SET_PARENT, parent);
338} 378}
339 379
340static inline void 380static inline void
341xdg_surface_set_title(struct xdg_surface *xdg_surface, const char *title) 381xdg_surface_set_title(struct xdg_surface *xdg_surface, const char *title)
342{ 382{
343 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 383 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
344 XDG_SURFACE_SET_TITLE, title); 384 XDG_SURFACE_SET_TITLE, title);
345} 385}
346 386
347static inline void 387static inline void
348xdg_surface_set_app_id(struct xdg_surface *xdg_surface, const char *app_id) 388xdg_surface_set_app_id(struct xdg_surface *xdg_surface, const char *app_id)
349{ 389{
350 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 390 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
351 XDG_SURFACE_SET_APP_ID, app_id); 391 XDG_SURFACE_SET_APP_ID, app_id);
352} 392}
353 393
354static inline void 394static inline void
355xdg_surface_show_window_menu(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) 395xdg_surface_show_window_menu(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
356{ 396{
357 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 397 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
358 XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y); 398 XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y);
359} 399}
360 400
361static inline void 401static inline void
362xdg_surface_move(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial) 402xdg_surface_move(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial)
363{ 403{
364 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 404 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
365 XDG_SURFACE_MOVE, seat, serial); 405 XDG_SURFACE_MOVE, seat, serial);
366} 406}
367 407
368static inline void 408static inline void
369xdg_surface_resize(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges) 409xdg_surface_resize(struct xdg_surface *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
370{ 410{
371 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 411 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
372 XDG_SURFACE_RESIZE, seat, serial, edges); 412 XDG_SURFACE_RESIZE, seat, serial, edges);
373} 413}
374 414
375static inline void 415static inline void
376xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial) 416xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
377{ 417{
378 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 418 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
379 XDG_SURFACE_ACK_CONFIGURE, serial); 419 XDG_SURFACE_ACK_CONFIGURE, serial);
380} 420}
381 421
382static inline void 422static inline void
383xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height) 423xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
384{ 424{
385 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 425 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
386 XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height); 426 XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height);
387} 427}
388 428
389static inline void 429static inline void
390xdg_surface_set_maximized(struct xdg_surface *xdg_surface) 430xdg_surface_set_maximized(struct xdg_surface *xdg_surface)
391{ 431{
392 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 432 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
393 XDG_SURFACE_SET_MAXIMIZED); 433 XDG_SURFACE_SET_MAXIMIZED);
394} 434}
395 435
396static inline void 436static inline void
397xdg_surface_unset_maximized(struct xdg_surface *xdg_surface) 437xdg_surface_unset_maximized(struct xdg_surface *xdg_surface)
398{ 438{
399 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 439 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
400 XDG_SURFACE_UNSET_MAXIMIZED); 440 XDG_SURFACE_UNSET_MAXIMIZED);
401} 441}
402 442
403static inline void 443static inline void
404xdg_surface_set_fullscreen(struct xdg_surface *xdg_surface, struct wl_output *output) 444xdg_surface_set_fullscreen(struct xdg_surface *xdg_surface, struct wl_output *output)
405{ 445{
406 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 446 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
407 XDG_SURFACE_SET_FULLSCREEN, output); 447 XDG_SURFACE_SET_FULLSCREEN, output);
408} 448}
409 449
410static inline void 450static inline void
411xdg_surface_unset_fullscreen(struct xdg_surface *xdg_surface) 451xdg_surface_unset_fullscreen(struct xdg_surface *xdg_surface)
412{ 452{
413 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 453 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
414 XDG_SURFACE_UNSET_FULLSCREEN); 454 XDG_SURFACE_UNSET_FULLSCREEN);
415} 455}
416 456
417static inline void 457static inline void
418xdg_surface_set_minimized(struct xdg_surface *xdg_surface) 458xdg_surface_set_minimized(struct xdg_surface *xdg_surface)
419{ 459{
420 wl_proxy_marshal((struct wl_proxy *) xdg_surface, 460 wl_proxy_marshal((struct wl_proxy *) xdg_surface,
421 XDG_SURFACE_SET_MINIMIZED); 461 XDG_SURFACE_SET_MINIMIZED);
422} 462}
423 463
424/** 464/**
425 * xdg_popup - desktop-style metadata interface 465 * xdg_popup - short-lived, popup surfaces for menus
426 * @popup_done: popup interaction is done 466 * @popup_done: popup interaction is done
427 * 467 *
428 * An interface that may be implemented by a wl_surface, for 468 * A popup surface is a short-lived, temporary surface that can be used
429 * implementations that provide a desktop-style popups/menus. A popup 469 * to implement menus. It takes an explicit grab on the surface that will
430 * surface is a transient surface with an added pointer grab. 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.
431 * 499 *
432 * An existing implicit grab will be changed to owner-events mode, and the 500 * When compositors choose to dismiss a popup, they will likely dismiss
433 * popup grab will continue after the implicit grab ends (i.e. releasing 501 * every nested popup as well. When a compositor dismisses popups, it will
434 * the mouse button does not cause the popup to be unmapped). 502 * follow the same dismissing order as required from the client.
435 * 503 *
436 * The popup grab continues until the window is destroyed or a mouse button 504 * The x and y arguments passed when creating the popup object specify
437 * is pressed in any other clients window. A click in any of the clients 505 * where the top left of the popup should be placed, relative to the local
438 * surfaces is reported as normal, however, clicks in other clients 506 * surface coordinates of the parent surface. See xdg_shell.get_xdg_popup.
439 * surfaces will be discarded and trigger the callback.
440 * 507 *
441 * The x and y arguments specify the locations of the upper left corner of 508 * The client must call wl_surface.commit on the corresponding wl_surface
442 * the surface relative to the upper left corner of the parent surface, in 509 * for the xdg_popup state to take effect.
443 * surface local coordinates.
444 * 510 *
445 * xdg_popup surfaces are always transient for another surface. 511 * For a surface to be mapped by the compositor the client must have
512 * committed both the xdg_popup state and a buffer.
446 */ 513 */
447struct xdg_popup_listener { 514struct xdg_popup_listener {
448 /** 515 /**
449 * popup_done - popup interaction is done 516 * popup_done - popup interaction is done
450 * @serial: serial of the implicit grab on the pointer 517 *
451 * 518 * The popup_done event is sent out when a popup is dismissed by
452 * The popup_done event is sent out when a popup grab is broken, 519 * the compositor. The client should destroy the xdg_popup object
453 * that is, when the users clicks a surface that doesn't belong to 520 * at this point.
454 * the client owning the popup surface. 521 */
455 */ 522 void (*popup_done)(void *data,
456 void (*popup_done)(void *data, 523 struct xdg_popup *xdg_popup);
457 struct xdg_popup *xdg_popup,
458 uint32_t serial);
459}; 524};
460 525
461static inline int 526static inline int
462xdg_popup_add_listener(struct xdg_popup *xdg_popup, 527xdg_popup_add_listener(struct xdg_popup *xdg_popup,
463 const struct xdg_popup_listener *listener, void *data) 528 const struct xdg_popup_listener *listener, void *data)
464{ 529{
465 return wl_proxy_add_listener((struct wl_proxy *) xdg_popup, 530 return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
466 (void (**)(void)) listener, data); 531 (void (**)(void)) listener, data);
467} 532}
468 533
469#define XDG_POPUP_DESTROY 0 534#define XDG_POPUP_DESTROY 0
470 535
471static inline void 536static inline void
472xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data) 537xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)
473{ 538{
474 wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data); 539 wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
475} 540}
476 541
477static inline void * 542static inline void *
478xdg_popup_get_user_data(struct xdg_popup *xdg_popup) 543xdg_popup_get_user_data(struct xdg_popup *xdg_popup)
479{ 544{
480 return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup); 545 return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
481} 546}
482 547
483static inline void 548static inline void
484xdg_popup_destroy(struct xdg_popup *xdg_popup) 549xdg_popup_destroy(struct xdg_popup *xdg_popup)
485{ 550{
486 wl_proxy_marshal((struct wl_proxy *) xdg_popup, 551 wl_proxy_marshal((struct wl_proxy *) xdg_popup,
487 XDG_POPUP_DESTROY); 552 XDG_POPUP_DESTROY);
488 553
489 wl_proxy_destroy((struct wl_proxy *) xdg_popup); 554 wl_proxy_destroy((struct wl_proxy *) xdg_popup);
490} 555}
491 556
492#ifdef __cplusplus 557#ifdef __cplusplus
diff --git a/src/lib/ecore_wayland/xdg-shell-protocol.c b/src/lib/ecore_wayland/xdg-shell-protocol.c
index 81c7519..82433ea 100644
--- a/src/lib/ecore_wayland/xdg-shell-protocol.c
+++ b/src/lib/ecore_wayland/xdg-shell-protocol.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Copyright © 2008-2013 Kristian Høgsberg 2 * Copyright © 2008-2013 Kristian Høgsberg
3 * Copyright © 2013 Rafael Antognolli 3 * Copyright © 2013 Rafael Antognolli
4 * Copyright © 2013 Jasper St. Pierre 4 * Copyright © 2013 Jasper St. Pierre
5 * Copyright © 2010-2013 Intel Corporation 5 * Copyright © 2010-2013 Intel Corporation
6 * 6 *
7 * Permission to use, copy, modify, distribute, and sell this 7 * Permission to use, copy, modify, distribute, and sell this
8 * software and its documentation for any purpose is hereby granted 8 * software and its documentation for any purpose is hereby granted
9 * without fee, provided that the above copyright notice appear in 9 * without fee, provided that the above copyright notice appear in
@@ -15,7 +15,7 @@
15 * representations about the suitability of this software for any 15 * representations about the suitability of this software for any
16 * purpose. It is provided "as is" without express or implied 16 * purpose. It is provided "as is" without express or implied
17 * warranty. 17 * warranty.
18 * 18 *
19 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 19 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
20 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
@@ -37,88 +37,89 @@ extern const struct wl_interface xdg_popup_interface;
37extern const struct wl_interface xdg_surface_interface; 37extern const struct wl_interface xdg_surface_interface;
38 38
39static const struct wl_interface *types[] = { 39static const struct wl_interface *types[] = {
40 NULL, 40 NULL,
41 NULL, 41 NULL,
42 NULL, 42 NULL,
43 NULL, 43 NULL,
44 &xdg_surface_interface, 44 &xdg_surface_interface,
45 &wl_surface_interface, 45 &wl_surface_interface,
46 &xdg_popup_interface, 46 &xdg_popup_interface,
47 &wl_surface_interface, 47 &wl_surface_interface,
48 &wl_surface_interface, 48 &wl_surface_interface,
49 &wl_seat_interface, 49 &wl_seat_interface,
50 NULL, 50 NULL,
51 NULL, 51 NULL,
52 NULL, 52 NULL,
53 NULL, 53 &xdg_surface_interface,
54 &wl_surface_interface, 54 &wl_seat_interface,
55 &wl_seat_interface, 55 NULL,
56 NULL, 56 NULL,
57 NULL, 57 NULL,
58 NULL, 58 &wl_seat_interface,
59 &wl_seat_interface, 59 NULL,
60 NULL, 60 &wl_seat_interface,
61 &wl_seat_interface, 61 NULL,
62 NULL, 62 NULL,
63 NULL, 63 &wl_output_interface,
64 &wl_output_interface,
65}; 64};
66 65
67static const struct wl_message xdg_shell_requests[] = { 66static const struct wl_message xdg_shell_requests[] = {
68 { "use_unstable_version", "i", types + 0 }, 67 { "destroy", "", types + 0 },
69 { "get_xdg_surface", "no", types + 4 }, 68 { "use_unstable_version", "i", types + 0 },
70 { "get_xdg_popup", "nooouiiu", types + 6 }, 69 { "get_xdg_surface", "no", types + 4 },
71 { "pong", "u", types + 0 }, 70 { "get_xdg_popup", "nooouii", types + 6 },
71 { "pong", "u", types + 0 },
72}; 72};
73 73
74static const struct wl_message xdg_shell_events[] = { 74static const struct wl_message xdg_shell_events[] = {
75 { "ping", "u", types + 0 }, 75 { "ping", "u", types + 0 },
76}; 76};
77 77
78WL_EXPORT const struct wl_interface xdg_shell_interface = { 78WL_EXPORT const struct wl_interface xdg_shell_interface = {
79 "xdg_shell", 1, 79 "xdg_shell", 1,
80 4, xdg_shell_requests, 80 5, xdg_shell_requests,
81 1, xdg_shell_events, 81 1, xdg_shell_events,
82}; 82};
83 83
84static const struct wl_message xdg_surface_requests[] = { 84static const struct wl_message xdg_surface_requests[] = {
85 { "destroy", "", types + 0 }, 85 { "destroy", "", types + 0 },
86 { "set_parent", "?o", types + 14 }, 86 { "set_parent", "?o", types + 13 },
87 { "set_title", "s", types + 0 }, 87 { "set_title", "s", types + 0 },
88 { "set_app_id", "s", types + 0 }, 88 { "set_app_id", "s", types + 0 },
89 { "show_window_menu", "ouii", types + 15 }, 89 { "show_window_menu", "ouii", types + 14 },
90 { "move", "ou", types + 19 }, 90 { "move", "ou", types + 18 },
91 { "resize", "ouu", types + 21 }, 91 { "resize", "ouu", types + 20 },
92 { "ack_configure", "u", types + 0 }, 92 { "ack_configure", "u", types + 0 },
93 { "set_window_geometry", "iiii", types + 0 }, 93 { "set_window_geometry", "iiii", types + 0 },
94 { "set_maximized", "", types + 0 }, 94 { "set_maximized", "", types + 0 },
95 { "unset_maximized", "", types + 0 }, 95 { "unset_maximized", "", types + 0 },
96 { "set_fullscreen", "?o", types + 24 }, 96 { "set_fullscreen", "?o", types + 23 },
97 { "unset_fullscreen", "", types + 0 }, 97 { "unset_fullscreen", "", types + 0 },
98 { "set_minimized", "", types + 0 }, 98 { "set_minimized", "", types + 0 },
99}; 99};
100 100
101static const struct wl_message xdg_surface_events[] = { 101static const struct wl_message xdg_surface_events[] = {
102 { "configure", "iiau", types + 0 }, 102 { "configure", "iiau", types + 0 },
103 { "close", "", types + 0 }, 103 { "close", "", types + 0 },
104}; 104};
105 105
106WL_EXPORT const struct wl_interface xdg_surface_interface = { 106WL_EXPORT const struct wl_interface xdg_surface_interface = {
107 "xdg_surface", 1, 107 "xdg_surface", 1,
108 14, xdg_surface_requests, 108 14, xdg_surface_requests,
109 2, xdg_surface_events, 109 2, xdg_surface_events,
110}; 110};
111 111
112static const struct wl_message xdg_popup_requests[] = { 112static const struct wl_message xdg_popup_requests[] = {
113 { "destroy", "", types + 0 }, 113 { "destroy", "", types + 0 },
114}; 114};
115 115
116static const struct wl_message xdg_popup_events[] = { 116static const struct wl_message xdg_popup_events[] = {
117 { "popup_done", "u", types + 0 }, 117 { "popup_done", "", types + 0 },
118}; 118};
119 119
120WL_EXPORT const struct wl_interface xdg_popup_interface = { 120WL_EXPORT const struct wl_interface xdg_popup_interface = {
121 "xdg_popup", 1, 121 "xdg_popup", 1,
122 1, xdg_popup_requests, 122 1, xdg_popup_requests,
123 1, xdg_popup_events, 123 1, xdg_popup_events,
124}; 124};
125