SDL  2.0
SDL_waylandwindow.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #include "../../SDL_internal.h"
23 
24 #if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
25 
26 #include "../SDL_sysvideo.h"
27 #include "../../events/SDL_windowevents_c.h"
28 #include "../SDL_egl_c.h"
29 #include "SDL_waylandevents_c.h"
30 #include "SDL_waylandwindow.h"
31 #include "SDL_waylandvideo.h"
32 #include "SDL_waylandtouch.h"
33 #include "SDL_waylanddyn.h"
34 #include "SDL_hints.h"
35 
38 
39 /* On modern desktops, we probably will use the xdg-shell protocol instead
40  of wl_shell, but wl_shell might be useful on older Wayland installs that
41  don't have the newer protocol, or embedded things that don't have a full
42  window manager. */
43 
44 static void
45 handle_ping_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface,
46  uint32_t serial)
47 {
48  wl_shell_surface_pong(shell_surface, serial);
49 }
50 
51 static void
52 handle_configure_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface,
54 {
56  SDL_Window *window = wind->sdlwindow;
57  struct wl_region *region;
58 
59  /* wl_shell_surface spec states that this is a suggestion.
60  Ignore if less than or greater than max/min size. */
61 
62  if (width == 0 || height == 0) {
63  return;
64  }
65 
66  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
67  if ((window->flags & SDL_WINDOW_RESIZABLE)) {
68  if (window->max_w > 0) {
69  width = SDL_min(width, window->max_w);
70  }
71  width = SDL_max(width, window->min_w);
72 
73  if (window->max_h > 0) {
74  height = SDL_min(height, window->max_h);
75  }
76  height = SDL_max(height, window->min_h);
77  } else {
78  return;
79  }
80  }
81 
82  WAYLAND_wl_egl_window_resize(wind->egl_window, width, height, 0, 0);
84  wl_region_add(region, 0, 0, width, height);
86  wl_region_destroy(region);
87 
89  window->w = width;
90  window->h = height;
91 }
92 
93 static void
94 handle_popup_done_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface)
95 {
96 }
97 
98 static const struct wl_shell_surface_listener shell_surface_listener_wl = {
99  handle_ping_wl_shell_surface,
100  handle_configure_wl_shell_surface,
101  handle_popup_done_wl_shell_surface
102 };
103 
104 
105 
106 
107 static void
108 handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, uint32_t serial)
109 {
111  SDL_Window *window = wind->sdlwindow;
112  struct wl_region *region;
113 
115 
116  WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
117 
119  wl_region_add(region, 0, 0, window->w, window->h);
120  wl_surface_set_opaque_region(wind->surface, region);
121  wl_region_destroy(region);
122  zxdg_surface_v6_ack_configure(zxdg, serial);
123 }
124 
125 static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = {
126  handle_configure_zxdg_shell_surface
127 };
128 
129 
130 static void
131 handle_configure_zxdg_toplevel(void *data,
132  struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
133  int32_t width,
134  int32_t height,
135  struct wl_array *states)
136 {
138  SDL_Window *window = wind->sdlwindow;
139 
140  /* wl_shell_surface spec states that this is a suggestion.
141  Ignore if less than or greater than max/min size. */
142 
143  if (width == 0 || height == 0) {
144  return;
145  }
146 
147  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
148  if ((window->flags & SDL_WINDOW_RESIZABLE)) {
149  if (window->max_w > 0) {
150  width = SDL_min(width, window->max_w);
151  }
152  width = SDL_max(width, window->min_w);
153 
154  if (window->max_h > 0) {
155  height = SDL_min(height, window->max_h);
156  }
157  height = SDL_max(height, window->min_h);
158  } else {
159  return;
160  }
161  }
162 
164  window->w = width;
165  window->h = height;
166 }
167 
168 static void
169 handle_close_zxdg_toplevel(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
170 {
173 }
174 
175 static const struct zxdg_toplevel_v6_listener toplevel_listener_zxdg = {
176  handle_configure_zxdg_toplevel,
177  handle_close_zxdg_toplevel
178 };
179 
180 
181 
182 static void
183 handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t serial)
184 {
186  SDL_Window *window = wind->sdlwindow;
187  struct wl_region *region;
188 
190 
191  WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
192 
194  wl_region_add(region, 0, 0, window->w, window->h);
195  wl_surface_set_opaque_region(wind->surface, region);
196  wl_region_destroy(region);
197  xdg_surface_ack_configure(xdg, serial);
198 }
199 
200 static const struct xdg_surface_listener shell_surface_listener_xdg = {
201  handle_configure_xdg_shell_surface
202 };
203 
204 
205 static void
206 handle_configure_xdg_toplevel(void *data,
207  struct xdg_toplevel *xdg_toplevel,
208  int32_t width,
209  int32_t height,
210  struct wl_array *states)
211 {
213  SDL_Window *window = wind->sdlwindow;
214 
215  /* wl_shell_surface spec states that this is a suggestion.
216  Ignore if less than or greater than max/min size. */
217 
218  if (width == 0 || height == 0) {
219  return;
220  }
221 
222  if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
223  if ((window->flags & SDL_WINDOW_RESIZABLE)) {
224  if (window->max_w > 0) {
225  width = SDL_min(width, window->max_w);
226  }
227  width = SDL_max(width, window->min_w);
228 
229  if (window->max_h > 0) {
230  height = SDL_min(height, window->max_h);
231  }
232  height = SDL_max(height, window->min_h);
233  } else {
234  return;
235  }
236  }
237 
238  if (width == window->w && height == window->h) {
239  return;
240  }
241 
243  window->w = width;
244  window->h = height;
245 }
246 
247 static void
248 handle_close_xdg_toplevel(void *data, struct xdg_toplevel *xdg_toplevel)
249 {
252 }
253 
254 static const struct xdg_toplevel_listener toplevel_listener_xdg = {
255  handle_configure_xdg_toplevel,
256  handle_close_xdg_toplevel
257 };
258 
259 
260 
261 
262 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
263 static void
264 handle_onscreen_visibility(void *data,
265  struct qt_extended_surface *qt_extended_surface, int32_t visible)
266 {
267 }
268 
269 static void
270 handle_set_generic_property(void *data,
271  struct qt_extended_surface *qt_extended_surface, const char *name,
272  struct wl_array *value)
273 {
274 }
275 
276 static void
277 handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
278 {
281 }
282 
283 static const struct qt_extended_surface_listener extended_surface_listener = {
284  handle_onscreen_visibility,
285  handle_set_generic_property,
286  handle_close,
287 };
288 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
289 
290 SDL_bool
292 {
293  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
294  const Uint32 version = ((((Uint32) info->version.major) * 1000000) +
295  (((Uint32) info->version.minor) * 10000) +
296  (((Uint32) info->version.patch)));
297 
298  /* Before 2.0.6, it was possible to build an SDL with Wayland support
299  (SDL_SysWMinfo will be large enough to hold Wayland info), but build
300  your app against SDL headers that didn't have Wayland support
301  (SDL_SysWMinfo could be smaller than Wayland needs. This would lead
302  to an app properly using SDL_GetWindowWMInfo() but we'd accidentally
303  overflow memory on the stack or heap. To protect against this, we've
304  padded out the struct unconditionally in the headers and Wayland will
305  just return an error for older apps using this function. Those apps
306  will need to be recompiled against newer headers or not use Wayland,
307  maybe by forcing SDL_VIDEODRIVER=x11. */
308  if (version < 2000006) {
310  SDL_SetError("Version must be 2.0.6 or newer");
311  return SDL_FALSE;
312  }
313 
314  info->info.wl.display = data->waylandData->display;
315  info->info.wl.surface = data->surface;
316  info->info.wl.shell_surface = data->shell_surface.wl;
318 
319  return SDL_TRUE;
320 }
321 
322 int
324 {
325  return 0; /* just succeed, the real work is done elsewhere. */
326 }
327 
328 static void
329 SetFullscreen(_THIS, SDL_Window * window, struct wl_output *output)
330 {
331  const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
332  SDL_WindowData *wind = window->driverdata;
333 
334  if (viddata->shell.xdg) {
335  if (output) {
337  } else {
339  }
340  } else if (viddata->shell.zxdg) {
341  if (output) {
343  } else {
345  }
346  } else {
347  if (output) {
350  0, output);
351  } else {
353  }
354  }
355 
356  WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
357 }
358 
360 {
361  struct wl_output *output = (struct wl_output *) window->fullscreen_mode.driverdata;
362  SetFullscreen(_this, window, (window->flags & SDL_WINDOW_FULLSCREEN) ? output : NULL);
363 }
364 
365 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
366 static void SDLCALL
367 QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
368  const char *oldValue, const char *newValue)
369 {
370  struct qt_extended_surface *qt_extended_surface = userdata;
371 
372  if (name == NULL) {
373  return;
374  }
375 
376  if (strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) {
377  int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
378 
379  if (newValue != NULL) {
380  if (strcmp(newValue, "portrait") == 0) {
381  orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
382  } else if (strcmp(newValue, "landscape") == 0) {
383  orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
384  } else if (strcmp(newValue, "inverted-portrait") == 0) {
385  orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
386  } else if (strcmp(newValue, "inverted-landscape") == 0) {
387  orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
388  }
389  }
390 
391  qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
392  } else if (strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) {
393  uint32_t flags = 0;
394 
395  if (newValue != NULL) {
396  char *tmp = strdup(newValue);
397  char *saveptr = NULL;
398 
399  char *flag = strtok_r(tmp, " ", &saveptr);
400  while (flag) {
401  if (strcmp(flag, "OverridesSystemGestures") == 0) {
402  flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
403  } else if (strcmp(flag, "StaysOnTop") == 0) {
404  flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
405  } else if (strcmp(flag, "BypassWindowManager") == 0) {
406  // See https://github.com/qtproject/qtwayland/commit/fb4267103d
407  flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */;
408  }
409 
410  flag = strtok_r(NULL, " ", &saveptr);
411  }
412 
413  free(tmp);
414  }
415 
416  qt_extended_surface_set_window_flags(qt_extended_surface, flags);
417  }
418 }
419 
420 static void QtExtendedSurface_Subscribe(struct qt_extended_surface *surface, const char *name)
421 {
422  SDL_AddHintCallback(name, QtExtendedSurface_OnHintChanged, surface);
423 }
424 
425 static void QtExtendedSurface_Unsubscribe(struct qt_extended_surface *surface, const char *name)
426 {
427  SDL_DelHintCallback(name, QtExtendedSurface_OnHintChanged, surface);
428 }
429 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
430 
431 void
433  SDL_VideoDisplay * _display, SDL_bool fullscreen)
434 {
435  struct wl_output *output = (struct wl_output *) _display->driverdata;
436  SetFullscreen(_this, window, fullscreen ? output : NULL);
437 }
438 
439 void
441 {
442  SDL_WindowData *wind = window->driverdata;
443  const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
444 
445  if (viddata->shell.xdg) {
446  } else if (viddata->shell.zxdg) {
447  } else {
449  }
450 
451  WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
452 }
453 
454 void
456 {
457  SDL_WindowData *wind = window->driverdata;
459 
460  if (viddata->shell.xdg) {
462  } else if (viddata->shell.zxdg) {
464  } else {
466  }
467 
468  WAYLAND_wl_display_flush( viddata->display );
469 }
470 
472 {
474  SDL_VideoData *c;
475  struct wl_region *region;
476 
477  data = calloc(1, sizeof *data);
478  if (data == NULL)
479  return SDL_OutOfMemory();
480 
481  c = _this->driverdata;
482  window->driverdata = data;
483 
484  if (!(window->flags & SDL_WINDOW_OPENGL)) {
486  window->flags |= SDL_WINDOW_OPENGL;
487  }
488 
489  if (window->x == SDL_WINDOWPOS_UNDEFINED) {
490  window->x = 0;
491  }
492  if (window->y == SDL_WINDOWPOS_UNDEFINED) {
493  window->y = 0;
494  }
495 
496  data->waylandData = c;
497  data->sdlwindow = window;
498 
499  data->surface =
500  wl_compositor_create_surface(c->compositor);
502 
503  if (c->shell.xdg) {
504  data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface);
505  /* !!! FIXME: add popup role */
506  data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface);
507  xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data);
508  xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname);
509  } else if (c->shell.zxdg) {
510  data->shell_surface.zxdg.surface = zxdg_shell_v6_get_xdg_surface(c->shell.zxdg, data->surface);
511  /* !!! FIXME: add popup role */
512  data->shell_surface.zxdg.roleobj.toplevel = zxdg_surface_v6_get_toplevel(data->shell_surface.zxdg.surface);
513  zxdg_toplevel_v6_add_listener(data->shell_surface.zxdg.roleobj.toplevel, &toplevel_listener_zxdg, data);
514  zxdg_toplevel_v6_set_app_id(data->shell_surface.zxdg.roleobj.toplevel, c->classname);
515  } else {
516  data->shell_surface.wl = wl_shell_get_shell_surface(c->shell.wl, data->surface);
517  wl_shell_surface_set_class(data->shell_surface.wl, c->classname);
518  }
519 
520 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
521  if (c->surface_extension) {
522  data->extended_surface = qt_surface_extension_get_extended_surface(
523  c->surface_extension, data->surface);
524 
525  QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
526  QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
527  }
528 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
529 
530  data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
531  window->w, window->h);
532 
533  /* Create the GLES window surface */
534  data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window);
535 
536  if (data->egl_surface == EGL_NO_SURFACE) {
537  return SDL_SetError("failed to create a window surface");
538  }
539 
540  if (c->shell.xdg) {
541  if (data->shell_surface.xdg.surface) {
542  xdg_surface_set_user_data(data->shell_surface.xdg.surface, data);
543  xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data);
544  }
545  } else if (c->shell.zxdg) {
546  if (data->shell_surface.zxdg.surface) {
547  zxdg_surface_v6_set_user_data(data->shell_surface.zxdg.surface, data);
548  zxdg_surface_v6_add_listener(data->shell_surface.zxdg.surface, &shell_surface_listener_zxdg, data);
549  }
550  } else {
551  if (data->shell_surface.wl) {
552  wl_shell_surface_set_user_data(data->shell_surface.wl, data);
553  wl_shell_surface_add_listener(data->shell_surface.wl, &shell_surface_listener_wl, data);
554  }
555  }
556 
557 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
558  if (data->extended_surface) {
559  qt_extended_surface_set_user_data(data->extended_surface, data);
560  qt_extended_surface_add_listener(data->extended_surface,
561  &extended_surface_listener, data);
562  }
563 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
564 
565  region = wl_compositor_create_region(c->compositor);
566  wl_region_add(region, 0, 0, window->w, window->h);
567  wl_surface_set_opaque_region(data->surface, region);
568  wl_region_destroy(region);
569 
570  if (c->relative_mouse_mode) {
572  }
573 
574  wl_surface_commit(data->surface);
575  WAYLAND_wl_display_flush(c->display);
576 
577  /* we have to wait until the surface gets a "configure" event, or
578  use of this surface will fail. This is a new rule for xdg_shell. */
579  if (c->shell.xdg) {
580  if (data->shell_surface.xdg.surface) {
581  while (!data->shell_surface.xdg.initial_configure_seen) {
582  WAYLAND_wl_display_flush(c->display);
583  WAYLAND_wl_display_dispatch(c->display);
584  }
585  }
586  } else if (c->shell.zxdg) {
587  if (data->shell_surface.zxdg.surface) {
588  while (!data->shell_surface.zxdg.initial_configure_seen) {
589  WAYLAND_wl_display_flush(c->display);
590  WAYLAND_wl_display_dispatch(c->display);
591  }
592  }
593  }
594 
595  return 0;
596 }
597 
599 {
601  SDL_WindowData *wind = window->driverdata;
602  struct wl_region *region;
603 
604  WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
605 
606  region =wl_compositor_create_region(data->compositor);
607  wl_region_add(region, 0, 0, window->w, window->h);
608  wl_surface_set_opaque_region(wind->surface, region);
609  wl_region_destroy(region);
610 }
611 
613 {
614  SDL_WindowData *wind = window->driverdata;
616 
617  if (window->title != NULL) {
618  if (viddata->shell.xdg) {
620  } else if (viddata->shell.zxdg) {
622  } else {
624  }
625  }
626 
627  WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
628 }
629 
631 {
633  SDL_WindowData *wind = window->driverdata;
634 
635  if (data) {
636  SDL_EGL_DestroySurface(_this, wind->egl_surface);
637  WAYLAND_wl_egl_window_destroy(wind->egl_window);
638 
639  if (data->shell.xdg) {
640  if (wind->shell_surface.xdg.roleobj.toplevel) {
642  }
643  if (wind->shell_surface.zxdg.surface) {
645  }
646  } else if (data->shell.zxdg) {
647  if (wind->shell_surface.zxdg.roleobj.toplevel) {
649  }
650  if (wind->shell_surface.zxdg.surface) {
652  }
653  } else {
654  if (wind->shell_surface.wl) {
656  }
657  }
658 
659 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
660  if (wind->extended_surface) {
661  QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
662  QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
663  qt_extended_surface_destroy(wind->extended_surface);
664  }
665 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
667 
668  SDL_free(wind);
669  WAYLAND_wl_display_flush(data->display);
670  }
671  window->driverdata = NULL;
672 }
673 
674 #endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
675 
676 /* vi: set ts=4 sw=4 expandtab: */
SDL_SYSWM_UNKNOWN
@ SDL_SYSWM_UNKNOWN
Definition: SDL_syswm.h:118
zxdg_toplevel_v6_unset_fullscreen
static void zxdg_toplevel_v6_unset_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
Definition: xdg-shell-unstable-v6-client-protocol.h:1552
SDL_zxdg_shell_surface::toplevel
struct zxdg_toplevel_v6 * toplevel
Definition: SDL_waylandwindow.h:37
SDL_waylandvideo.h
SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
A variable describing the content orientation on QtWayland-based platforms.
Definition: SDL_hints.h:602
wl_compositor_create_surface
static struct wl_surface * wl_compositor_create_surface(struct wl_compositor *wl_compositor)
Definition: wayland-client-protocol.h:1191
SDL_waylandevents_c.h
wl_shell_get_shell_surface
static struct wl_shell_surface * wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
Definition: wayland-client-protocol.h:2761
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_HINT_QTWAYLAND_WINDOW_FLAGS
#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS
Flags to set on QtWayland windows to integrate with the native window manager.
Definition: SDL_hints.h:613
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:381
wl_surface_set_user_data
static void wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
Definition: wayland-client-protocol.h:3368
SDL_VideoData::zxdg
struct zxdg_shell_v6 * zxdg
Definition: SDL_waylandvideo.h:58
wl_surface_commit
static void wl_surface_commit(struct wl_surface *wl_surface)
Definition: wayland-client-protocol.h:3619
wl_surface_set_opaque_region
static void wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
Definition: wayland-client-protocol.h:3558
NULL
#define NULL
Definition: begin_code.h:164
surface
EGLSurface surface
Definition: eglext.h:248
xdg_toplevel_listener
Definition: xdg-shell-client-protocol.h:1068
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_WINDOWEVENT_CLOSE
@ SDL_WINDOWEVENT_CLOSE
Definition: SDL_video.h:167
NativeWindowType
EGLNativeWindowType NativeWindowType
Definition: eglplatform.h:112
SDL_SysWMinfo
Definition: SDL_syswm.h:195
SDL_xdg_shell_surface::roleobj
union SDL_xdg_shell_surface::@37 roleobj
wl_shell_surface_pong
static void wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
Definition: wayland-client-protocol.h:3034
zxdg_toplevel_v6_destroy
static void zxdg_toplevel_v6_destroy(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
Definition: xdg-shell-unstable-v6-client-protocol.h:1218
wl_shell_surface_add_listener
static int wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, const struct wl_shell_surface_listener *listener, void *data)
Definition: wayland-client-protocol.h:2928
SDL_WindowData
Definition: SDL_androidwindow.h:36
SDL_version::minor
Uint8 minor
Definition: SDL_version.h:54
SDLCALL
#define SDLCALL
Definition: SDL_internal.h:45
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:100
zxdg_surface_v6_get_toplevel
static struct zxdg_toplevel_v6 * zxdg_surface_v6_get_toplevel(struct zxdg_surface_v6 *zxdg_surface_v6)
Definition: xdg-shell-unstable-v6-client-protocol.h:900
Wayland_MaximizeWindow
void Wayland_MaximizeWindow(_THIS, SDL_Window *window)
SDL_WINDOW_OPENGL
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:101
SDL_WINDOWEVENT_RESIZED
@ SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:155
SDL_xdg_shell_surface::surface
struct xdg_surface * surface
Definition: SDL_waylandwindow.h:44
wl_region_add
static void wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
Definition: wayland-client-protocol.h:5283
SDL_WINDOWPOS_UNDEFINED
#define SDL_WINDOWPOS_UNDEFINED
Definition: SDL_video.h:130
xdg_toplevel_set_fullscreen
static void xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
Definition: xdg-shell-client-protocol.h:1589
SDL_GL_LoadLibrary
#define SDL_GL_LoadLibrary
Definition: SDL_dynapi_overrides.h:553
SDL_zxdg_shell_surface::surface
struct zxdg_surface_v6 * surface
Definition: SDL_waylandwindow.h:35
xdg_toplevel_set_app_id
static void xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
Definition: xdg-shell-client-protocol.h:1312
zxdg_toplevel_v6_set_maximized
static void zxdg_toplevel_v6_set_maximized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
Definition: xdg-shell-unstable-v6-client-protocol.h:1494
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_WindowData::wl
struct wl_shell_surface * wl
Definition: SDL_waylandwindow.h:59
xdg_surface_destroy
static void xdg_surface_destroy(struct xdg_surface *xdg_surface)
Definition: xdg-shell-client-protocol.h:891
SDL_SYSWM_WAYLAND
@ SDL_SYSWM_WAYLAND
Definition: SDL_syswm.h:124
xdg_toplevel_unset_fullscreen
static void xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
Definition: xdg-shell-client-protocol.h:1616
zxdg_surface_v6_listener
Definition: xdg-shell-unstable-v6-client-protocol.h:782
SDL_VideoData::compositor
struct wl_compositor * compositor
Definition: SDL_waylandvideo.h:52
zxdg_surface_v6_ack_configure
static void zxdg_surface_v6_ack_configure(struct zxdg_surface_v6 *zxdg_surface_v6, uint32_t serial)
Definition: xdg-shell-unstable-v6-client-protocol.h:989
xdg_toplevel_add_listener
static int xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel, const struct xdg_toplevel_listener *listener, void *data)
Definition: xdg-shell-client-protocol.h:1119
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:105
SDL_WindowData::waylandData
SDL_VideoData * waylandData
Definition: SDL_waylandwindow.h:54
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:74
xdg_surface_add_listener
static int xdg_surface_add_listener(struct xdg_surface *xdg_surface, const struct xdg_surface_listener *listener, void *data)
Definition: xdg-shell-client-protocol.h:825
xdg_toplevel_set_title
static void xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
Definition: xdg-shell-client-protocol.h:1281
xdg-shell-unstable-v6-client-protocol.h
zxdg_toplevel_v6_add_listener
static int zxdg_toplevel_v6_add_listener(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const struct zxdg_toplevel_v6_listener *listener, void *data)
Definition: xdg-shell-unstable-v6-client-protocol.h:1102
zxdg_toplevel_v6_listener
Definition: xdg-shell-unstable-v6-client-protocol.h:1051
wl_region_destroy
static void wl_region_destroy(struct wl_region *wl_region)
Definition: wayland-client-protocol.h:5269
wl_shell_surface_set_class
static void wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
Definition: wayland-client-protocol.h:3236
wl_compositor_create_region
static struct wl_region * wl_compositor_create_region(struct wl_compositor *wl_compositor)
Definition: wayland-client-protocol.h:1207
Wayland_ShowWindow
void Wayland_ShowWindow(_THIS, SDL_Window *window)
xdg_toplevel_destroy
static void xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
Definition: xdg-shell-client-protocol.h:1234
wl_shell_surface_destroy
static void wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
Definition: wayland-client-protocol.h:3022
Wayland_SetWindowTitle
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
xdg_wm_base_get_xdg_surface
static struct xdg_surface * xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
Definition: xdg-shell-client-protocol.h:507
wl_shell_surface_set_title
static void wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
Definition: wayland-client-protocol.h:3219
SDL_WindowData::surface
SDL_Surface * surface
Definition: SDL_emscriptenvideo.h:41
SDL_SysWMinfo::subsystem
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:197
xdg_surface_listener
Definition: xdg-shell-client-protocol.h:791
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
EGL_NO_SURFACE
#define EGL_NO_SURFACE
Definition: egl.h:100
int32_t
signed int int32_t
Definition: SDL_config_windows.h:62
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_SysWMinfo::info
union SDL_SysWMinfo::@18 info
xdg_surface_ack_configure
static void xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
Definition: xdg-shell-client-protocol.h:1006
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:407
SDL_waylandwindow.h
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
Wayland_RestoreWindow
void Wayland_RestoreWindow(_THIS, SDL_Window *window)
SDL_xdg_shell_surface::initial_configure_seen
SDL_bool initial_configure_seen
Definition: SDL_waylandwindow.h:49
zxdg_toplevel_v6_set_title
static void zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *title)
Definition: xdg-shell-unstable-v6-client-protocol.h:1256
xdg_surface_get_toplevel
static struct xdg_toplevel * xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
Definition: xdg-shell-client-protocol.h:909
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
@ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT
Definition: wayland-client-protocol.h:2853
SDL_WindowData::xdg
SDL_xdg_shell_surface xdg
Definition: SDL_waylandwindow.h:57
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
Wayland_GetWindowWMInfo
SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
xdg_surface_set_user_data
static void xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
Definition: xdg-shell-client-protocol.h:866
Wayland_DestroyWindow
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
zxdg_surface_v6_add_listener
static int zxdg_surface_v6_add_listener(struct zxdg_surface_v6 *zxdg_surface_v6, const struct zxdg_surface_v6_listener *listener, void *data)
Definition: xdg-shell-unstable-v6-client-protocol.h:816
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:139
wl_shell_surface_set_maximized
static void wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
Definition: wayland-client-protocol.h:3201
SDL_WindowData::egl_window
struct wl_egl_window * egl_window
Definition: SDL_waylandwindow.h:61
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
zxdg_surface_v6_set_user_data
static void zxdg_surface_v6_set_user_data(struct zxdg_surface_v6 *zxdg_surface_v6, void *user_data)
Definition: xdg-shell-unstable-v6-client-protocol.h:857
SDL_zxdg_shell_surface::initial_configure_seen
SDL_bool initial_configure_seen
Definition: SDL_waylandwindow.h:40
SDL_VideoData::display
struct wl_display * display
Definition: SDL_waylandvideo.h:50
wl_shell_surface_set_fullscreen
static void wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
Definition: wayland-client-protocol.h:3142
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
xdg-shell-client-protocol.h
SDL_AddHintCallback
#define SDL_AddHintCallback
Definition: SDL_dynapi_overrides.h:192
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:196
sort_controllers.output
output
Definition: sort_controllers.py:10
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_waylandtouch.h
SDL_VideoDisplay
Definition: SDL_sysvideo.h:126
SDL_waylanddyn.h
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
Wayland_SetWindowFullscreen
void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
SDL_WindowData::shell_surface
union SDL_WindowData::@38 shell_surface
SDL_WindowData::zxdg
SDL_zxdg_shell_surface zxdg
Definition: SDL_waylandwindow.h:58
SDL_hints.h
SDL_SendWindowEvent
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
Definition: SDL_windowevents.c:74
Wayland_input_lock_pointer
int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
SDL_xdg_shell_surface::toplevel
struct xdg_toplevel * toplevel
Definition: SDL_waylandwindow.h:46
Wayland_SetWindowHitTest
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
enabled
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: SDL_opengl_glext.h:2479
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
zxdg_shell_v6_get_xdg_surface
static struct zxdg_surface_v6 * zxdg_shell_v6_get_xdg_surface(struct zxdg_shell_v6 *zxdg_shell_v6, struct wl_surface *surface)
Definition: xdg-shell-unstable-v6-client-protocol.h:469
zxdg_toplevel_v6_set_app_id
static void zxdg_toplevel_v6_set_app_id(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *app_id)
Definition: xdg-shell-unstable-v6-client-protocol.h:1287
SDL_WindowData::sdlwindow
SDL_Window * sdlwindow
Definition: SDL_waylandwindow.h:53
SDL_DelHintCallback
#define SDL_DelHintCallback
Definition: SDL_dynapi_overrides.h:193
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
wl_shell_surface_listener
Definition: wayland-client-protocol.h:2873
wl_surface_destroy
static void wl_surface_destroy(struct wl_surface *wl_surface)
Definition: wayland-client-protocol.h:3392
SDL_version::patch
Uint8 patch
Definition: SDL_version.h:55
xdg_toplevel_set_maximized
static void xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
Definition: xdg-shell-client-protocol.h:1523
SDL_zxdg_shell_surface::roleobj
union SDL_zxdg_shell_surface::@36 roleobj
SDL_version::major
Uint8 major
Definition: SDL_version.h:53
wl_shell_surface_set_user_data
static void wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
Definition: wayland-client-protocol.h:3002
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480
SDL_VideoData::shell
struct SDL_VideoData::@35 shell
wl_shell_surface_set_toplevel
static void wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
Definition: wayland-client-protocol.h:3080
free
SDL_EventEntry * free
Definition: SDL_events.c:84
SDL_WindowData::egl_surface
EGLSurface egl_surface
Definition: SDL_androidwindow.h:37
zxdg_surface_v6_destroy
static void zxdg_surface_v6_destroy(struct zxdg_surface_v6 *zxdg_surface_v6)
Definition: xdg-shell-unstable-v6-client-protocol.h:882
SDL_SysWMinfo::wl
struct SDL_SysWMinfo::@18::@20 wl
zxdg_toplevel_v6_set_fullscreen
static void zxdg_toplevel_v6_set_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_output *output)
Definition: xdg-shell-unstable-v6-client-protocol.h:1542
SDL_VideoData
Definition: SDL_androidvideo.h:36
SDL_VideoData::xdg
struct xdg_wm_base * xdg
Definition: SDL_waylandvideo.h:57
Wayland_CreateWindow
int Wayland_CreateWindow(_THIS, SDL_Window *window)
Wayland_SetWindowSize
void Wayland_SetWindowSize(_THIS, SDL_Window *window)