SDL  2.0
SDL_waylandvideo.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2019 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
25 
26 #include "SDL_video.h"
27 #include "SDL_mouse.h"
28 #include "SDL_stdinc.h"
29 #include "../../events/SDL_events_c.h"
30 
31 #include "SDL_waylandvideo.h"
32 #include "SDL_waylandevents_c.h"
33 #include "SDL_waylandwindow.h"
34 #include "SDL_waylandopengles.h"
35 #include "SDL_waylandmouse.h"
36 #include "SDL_waylandtouch.h"
37 #include "SDL_waylandclipboard.h"
38 #include "SDL_waylandvulkan.h"
39 
40 #include <sys/types.h>
41 #include <unistd.h>
42 #include <fcntl.h>
43 #include <xkbcommon/xkbcommon.h>
44 
45 #include "SDL_waylanddyn.h"
46 #include <wayland-util.h>
47 
52 
53 #define WAYLANDVID_DRIVER_NAME "wayland"
54 
55 /* Initialization/Query functions */
56 static int
57 Wayland_VideoInit(_THIS);
58 
59 static void
60 Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display);
61 static int
62 Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
63 
64 static void
65 Wayland_VideoQuit(_THIS);
66 
67 /* Find out what class name we should use
68  * Based on src/video/x11/SDL_x11video.c */
69 static char *
70 get_classname()
71 {
72 /* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
73  "The surface class identifies the general class of applications
74  to which the surface belongs. A common convention is to use the
75  file name (or the full path if it is a non-standard location) of
76  the application's .desktop file as the class." */
77 
78  char *spot;
79 #if defined(__LINUX__) || defined(__FREEBSD__)
80  char procfile[1024];
81  char linkfile[1024];
82  int linksize;
83 #endif
84 
85  /* First allow environment variable override */
86  spot = SDL_getenv("SDL_VIDEO_WAYLAND_WMCLASS");
87  if (spot) {
88  return SDL_strdup(spot);
89  } else {
90  /* Fallback to the "old" envvar */
91  spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
92  if (spot) {
93  return SDL_strdup(spot);
94  }
95  }
96 
97  /* Next look at the application's executable name */
98 #if defined(__LINUX__) || defined(__FREEBSD__)
99 #if defined(__LINUX__)
100  SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
101 #elif defined(__FREEBSD__)
102  SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
103  getpid());
104 #else
105 #error Where can we find the executable name?
106 #endif
107  linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
108  if (linksize > 0) {
109  linkfile[linksize] = '\0';
110  spot = SDL_strrchr(linkfile, '/');
111  if (spot) {
112  return SDL_strdup(spot + 1);
113  } else {
114  return SDL_strdup(linkfile);
115  }
116  }
117 #endif /* __LINUX__ || __FREEBSD__ */
118 
119  /* Finally use the default we've used forever */
120  return SDL_strdup("SDL_App");
121 }
122 
123 /* Wayland driver bootstrap functions */
124 static int
125 Wayland_Available(void)
126 {
127  struct wl_display *display = NULL;
128  if (SDL_WAYLAND_LoadSymbols()) {
129  display = WAYLAND_wl_display_connect(NULL);
130  if (display != NULL) {
131  WAYLAND_wl_display_disconnect(display);
132  }
134  }
135 
136  return (display != NULL);
137 }
138 
139 static void
140 Wayland_DeleteDevice(SDL_VideoDevice *device)
141 {
142  SDL_free(device);
144 }
145 
146 static SDL_VideoDevice *
147 Wayland_CreateDevice(int devindex)
148 {
150 
151  if (!SDL_WAYLAND_LoadSymbols()) {
152  return NULL;
153  }
154 
155  /* Initialize all variables that we clean on shutdown */
156  device = SDL_calloc(1, sizeof(SDL_VideoDevice));
157  if (!device) {
159  SDL_OutOfMemory();
160  return NULL;
161  }
162 
163  /* Set the function pointers */
164  device->VideoInit = Wayland_VideoInit;
165  device->VideoQuit = Wayland_VideoQuit;
166  device->SetDisplayMode = Wayland_SetDisplayMode;
167  device->GetDisplayModes = Wayland_GetDisplayModes;
169 
170  device->PumpEvents = Wayland_PumpEvents;
171 
182 
184  device->ShowWindow = Wayland_ShowWindow;
193 
197 
198 #if SDL_VIDEO_VULKAN
199  device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary;
200  device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary;
201  device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions;
202  device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface;
203  device->Vulkan_GetDrawableSize = Wayland_Vulkan_GetDrawableSize;
204 #endif
205 
206  device->free = Wayland_DeleteDevice;
207 
208  return device;
209 }
210 
212  WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver",
213  Wayland_Available, Wayland_CreateDevice
214 };
215 
216 static void
217 display_handle_geometry(void *data,
218  struct wl_output *output,
219  int x, int y,
220  int physical_width,
221  int physical_height,
222  int subpixel,
223  const char *make,
224  const char *model,
225  int transform)
226 
227 {
228  SDL_VideoDisplay *display = data;
229 
230  display->name = SDL_strdup(model);
231  ((SDL_WaylandOutputData*)display->driverdata)->transform = transform;
232 }
233 
234 static void
235 display_handle_mode(void *data,
236  struct wl_output *output,
237  uint32_t flags,
238  int width,
239  int height,
240  int refresh)
241 {
243  SDL_VideoDisplay *display = data;
244  SDL_WaylandOutputData* driverdata = display->driverdata;
245 
246  if (flags & WL_OUTPUT_MODE_CURRENT) {
247  driverdata->width = width;
248  driverdata->height = height;
249  driverdata->refresh = refresh;
250  }
251 }
252 
253 static void
254 display_handle_done(void *data,
255  struct wl_output *output)
256 {
257  /* !!! FIXME: this will fail on any further property changes! */
258  SDL_VideoDisplay *display = data;
259  SDL_WaylandOutputData* driverdata = display->driverdata;
261 
262  SDL_zero(mode);
264  mode.w = driverdata->width / driverdata->scale_factor;
265  mode.h = driverdata->height / driverdata->scale_factor;
266  if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) {
267  mode.w = driverdata->height / driverdata->scale_factor;
268  mode.h = driverdata->width / driverdata->scale_factor;
269  }
270  mode.refresh_rate = driverdata->refresh / 1000; // mHz to Hz
271  mode.driverdata = driverdata->output;
272  SDL_AddDisplayMode(display, &mode);
273  display->current_mode = mode;
274  display->desktop_mode = mode;
275 
276  SDL_AddVideoDisplay(display);
277  wl_output_set_user_data(output, display->driverdata);
278  SDL_free(display->name);
279  SDL_free(display);
280 }
281 
282 static void
283 display_handle_scale(void *data,
284  struct wl_output *output,
285  int32_t factor)
286 {
287  SDL_VideoDisplay *display = data;
288  ((SDL_WaylandOutputData*)display->driverdata)->scale_factor = factor;
289 }
290 
291 static const struct wl_output_listener output_listener = {
292  display_handle_geometry,
293  display_handle_mode,
294  display_handle_done,
295  display_handle_scale
296 };
297 
298 static void
299 Wayland_add_display(SDL_VideoData *d, uint32_t id)
300 {
301  struct wl_output *output;
303  SDL_VideoDisplay *display = SDL_malloc(sizeof *display);
304  if (!display) {
305  SDL_OutOfMemory();
306  return;
307  }
308  SDL_zero(*display);
309 
310  output = wl_registry_bind(d->registry, id, &wl_output_interface, 2);
311  if (!output) {
312  SDL_SetError("Failed to retrieve output.");
313  SDL_free(display);
314  return;
315  }
316  data = SDL_malloc(sizeof *data);
317  data->output = output;
318  data->scale_factor = 1.0;
319  display->driverdata = data;
320 
321  wl_output_add_listener(output, &output_listener, display);
322 }
323 
324 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
325 static void
326 windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager,
327  int32_t show_is_fullscreen)
328 {
329 }
330 
331 static void
332 windowmanager_quit(void *data, struct qt_windowmanager *qt_windowmanager)
333 {
334  SDL_SendQuit();
335 }
336 
337 static const struct qt_windowmanager_listener windowmanager_listener = {
338  windowmanager_hints,
339  windowmanager_quit,
340 };
341 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
342 
343 
344 static void
345 handle_ping_zxdg_shell(void *data, struct zxdg_shell_v6 *zxdg, uint32_t serial)
346 {
347  zxdg_shell_v6_pong(zxdg, serial);
348 }
349 
350 static const struct zxdg_shell_v6_listener shell_listener_zxdg = {
351  handle_ping_zxdg_shell
352 };
353 
354 
355 static void
356 handle_ping_xdg_wm_base(void *data, struct xdg_wm_base *xdg, uint32_t serial)
357 {
358  xdg_wm_base_pong(xdg, serial);
359 }
360 
361 static const struct xdg_wm_base_listener shell_listener_xdg = {
362  handle_ping_xdg_wm_base
363 };
364 
365 
366 static void
367 display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
368  const char *interface, uint32_t version)
369 {
370  SDL_VideoData *d = data;
371 
372  /*printf("WAYLAND INTERFACE: %s\n", interface);*/
373 
374  if (strcmp(interface, "wl_compositor") == 0) {
376  } else if (strcmp(interface, "wl_output") == 0) {
377  Wayland_add_display(d, id);
378  } else if (strcmp(interface, "wl_seat") == 0) {
380  } else if (strcmp(interface, "xdg_wm_base") == 0) {
382  xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL);
383  } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
385  zxdg_shell_v6_add_listener(d->shell.zxdg, &shell_listener_zxdg, NULL);
386  } else if (strcmp(interface, "wl_shell") == 0) {
388  } else if (strcmp(interface, "wl_shm") == 0) {
389  d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
390  d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
391  } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
393  } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
395  } else if (strcmp(interface, "wl_data_device_manager") == 0) {
397  } else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0) {
399  } else if (strcmp(interface, "org_kde_kwin_server_decoration_manager") == 0) {
401 
402 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
403  } else if (strcmp(interface, "qt_touch_extension") == 0) {
404  Wayland_touch_create(d, id);
405  } else if (strcmp(interface, "qt_surface_extension") == 0) {
406  d->surface_extension = wl_registry_bind(registry, id,
407  &qt_surface_extension_interface, 1);
408  } else if (strcmp(interface, "qt_windowmanager") == 0) {
409  d->windowmanager = wl_registry_bind(registry, id,
410  &qt_windowmanager_interface, 1);
411  qt_windowmanager_add_listener(d->windowmanager, &windowmanager_listener, d);
412 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
413  }
414 }
415 
416 static void
417 display_remove_global(void *data, struct wl_registry *registry, uint32_t id) {}
418 
419 static const struct wl_registry_listener registry_listener = {
420  display_handle_global,
421  display_remove_global
422 };
423 
424 int
425 Wayland_VideoInit(_THIS)
426 {
427  SDL_VideoData *data = SDL_calloc(1, sizeof(*data));
428  if (data == NULL)
429  return SDL_OutOfMemory();
430 
431  _this->driverdata = data;
432 
433  data->xkb_context = WAYLAND_xkb_context_new(0);
434  if (!data->xkb_context) {
435  return SDL_SetError("Failed to create XKB context");
436  }
437 
438  data->display = WAYLAND_wl_display_connect(NULL);
439  if (data->display == NULL) {
440  return SDL_SetError("Failed to connect to a Wayland display");
441  }
442 
444  if (data->registry == NULL) {
445  return SDL_SetError("Failed to get the Wayland registry");
446  }
447 
448  wl_registry_add_listener(data->registry, &registry_listener, data);
449 
450  // First roundtrip to receive all registry objects.
451  WAYLAND_wl_display_roundtrip(data->display);
452 
453  // Second roundtrip to receive all output events.
454  WAYLAND_wl_display_roundtrip(data->display);
455 
456  Wayland_InitMouse();
457 
458  /* Get the surface class name, usually the name of the application */
459  data->classname = get_classname();
460 
461  WAYLAND_wl_display_flush(data->display);
462 
463  return 0;
464 }
465 
466 static void
467 Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
468 {
469  // Nothing to do here, everything was already done in the wl_output
470  // callbacks.
471 }
472 
473 static int
474 Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
475 {
476  return SDL_Unsupported();
477 }
478 
479 void
480 Wayland_VideoQuit(_THIS)
481 {
482  SDL_VideoData *data = _this->driverdata;
483  int i, j;
484 
485  Wayland_FiniMouse ();
486 
487  for (i = 0; i < _this->num_displays; ++i) {
488  SDL_VideoDisplay *display = &_this->displays[i];
489 
490  wl_output_destroy(((SDL_WaylandOutputData*)display->driverdata)->output);
491  SDL_free(display->driverdata);
492  display->driverdata = NULL;
493 
494  for (j = display->num_display_modes; j--;) {
495  display->display_modes[j].driverdata = NULL;
496  }
497  display->desktop_mode.driverdata = NULL;
498  }
499 
503 
504  if (data->xkb_context) {
505  WAYLAND_xkb_context_unref(data->xkb_context);
506  data->xkb_context = NULL;
507  }
508 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
509  if (data->windowmanager)
510  qt_windowmanager_destroy(data->windowmanager);
511 
512  if (data->surface_extension)
513  qt_surface_extension_destroy(data->surface_extension);
514 
515  Wayland_touch_destroy(data);
516 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
517 
518  if (data->shm)
519  wl_shm_destroy(data->shm);
520 
521  if (data->cursor_theme)
522  WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
523 
524  if (data->shell.wl)
525  wl_shell_destroy(data->shell.wl);
526 
527  if (data->shell.xdg)
529 
530  if (data->shell.zxdg)
532 
533  if (data->compositor)
535 
536  if (data->registry)
538 
539  if (data->display) {
540  WAYLAND_wl_display_flush(data->display);
541  WAYLAND_wl_display_disconnect(data->display);
542  }
543 
544  SDL_free(data->classname);
545  SDL_free(data);
546  _this->driverdata = NULL;
547 }
548 
549 #endif /* SDL_VIDEO_DRIVER_WAYLAND */
550 
551 /* vi: set ts=4 sw=4 expandtab: */
int(* Vulkan_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:271
static void wl_registry_destroy(struct wl_registry *wl_registry)
static struct wl_registry * wl_display_get_registry(struct wl_display *wl_display)
void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d)
void Wayland_SetWindowSize(_THIS, SDL_Window *window)
const struct wl_interface xdg_wm_base_interface
struct SDL_VideoData::@264 shell
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:228
const struct wl_interface wl_shm_interface
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d)
void SDL_WAYLAND_UnloadSymbols(void)
char * Wayland_GetClipboardText(_THIS)
static void xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial)
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:306
const struct wl_interface org_kde_kwin_server_decoration_manager_interface
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
signed int int32_t
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
struct xdg_wm_base * xdg
struct wl_display * display
void Wayland_MaximizeWindow(_THIS, SDL_Window *window)
VideoBootStrap Wayland_bootstrap
void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
void(* free)(_THIS)
Definition: SDL_sysvideo.h:394
void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id)
int Wayland_SetClipboardText(_THIS, const char *text)
static void wl_shell_destroy(struct wl_shell *wl_shell)
#define Wayland_GLES_UnloadLibrary
static void wl_output_set_user_data(struct wl_output *wl_output, void *user_data)
static void * wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:261
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:223
The structure that defines a display mode.
Definition: SDL_video.h:53
const struct wl_interface zxdg_decoration_manager_v1_interface
void Wayland_ShowWindow(_THIS, SDL_Window *window)
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:216
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
#define Wayland_GLES_GetSwapInterval
struct wl_cursor_theme * cursor_theme
int Wayland_CreateWindow(_THIS, SDL_Window *window)
struct wl_output * output
const struct wl_interface wl_output_interface
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
Definition: SDL_video.c:603
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:255
static void wl_compositor_destroy(struct wl_compositor *wl_compositor)
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:205
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:229
SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window *window)
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:260
void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id)
static SDL_VideoDevice * _this
Definition: SDL_video.c:118
static SDL_AudioDeviceID device
Definition: loopwave.c:37
struct zxdg_decoration_manager_v1 * decoration_manager
static void xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
const struct wl_interface zxdg_shell_v6_interface
SDL_bool(* Vulkan_GetInstanceExtensions)(_THIS, SDL_Window *window, unsigned *count, const char **names)
Definition: SDL_sysvideo.h:273
#define Wayland_GLES_SetSwapInterval
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:248
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:258
struct wl_data_device_manager * data_device_manager
void Wayland_SetWindowTitle(_THIS, SDL_Window *window)
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
void(* Vulkan_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
Definition: SDL_sysvideo.h:275
void Wayland_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
SDL_bool(* Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface)
Definition: SDL_sysvideo.h:274
#define _THIS
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:259
#define SDL_free
void * driverdata
Definition: SDL_video.h:59
void(* Vulkan_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:272
static void wl_shm_destroy(struct wl_shm *wl_shm)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:50
struct xkb_context * xkb_context
int SDL_WAYLAND_LoadSymbols(void)
SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
SDL_DisplayMode * display_modes
Definition: SDL_sysvideo.h:130
static int xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base, const struct xdg_wm_base_listener *listener, void *data)
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:132
GLenum mode
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:316
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:235
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
struct wl_shell * wl
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
int Wayland_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
static void zxdg_shell_v6_destroy(struct zxdg_shell_v6 *zxdg_shell_v6)
void Wayland_display_add_input(SDL_VideoData *d, uint32_t id)
#define SDL_getenv
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:257
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:197
int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
#define Wayland_GLES_GetProcAddress
static int wl_output_add_listener(struct wl_output *wl_output, const struct wl_output_listener *listener, void *data)
static void wl_output_destroy(struct wl_output *wl_output)
#define NULL
Definition: begin_code.h:167
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:211
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:131
void Wayland_GLES_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
unsigned int uint32_t
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:167
#define SDL_SetError
const struct wl_interface wl_compositor_interface
GLbitfield flags
struct wl_compositor * compositor
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
void Wayland_RestoreWindow(_THIS, SDL_Window *window)
#define SDL_calloc
const struct wl_interface wl_shell_interface
void Wayland_display_destroy_input(SDL_VideoData *d)
void Wayland_PumpEvents(_THIS)
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:263
#define SDL_strdup
GLuint GLenum GLenum transform
struct wl_registry * registry
struct org_kde_kwin_server_decoration_manager * kwin_server_decoration_manager
SDL_bool Wayland_HasClipboardText(_THIS)
SDL_bool(* HasClipboardText)(_THIS)
Definition: SDL_sysvideo.h:300
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
Definition: SDL_video.c:751
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:161
#define SDL_snprintf
struct zxdg_shell_v6 * zxdg
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:231
#define SDL_malloc
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:264
char *(* GetClipboardText)(_THIS)
Definition: SDL_sysvideo.h:299
Uint32 format
Definition: SDL_video.h:55
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:213
const struct wl_interface wl_data_device_manager_interface
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:262
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:226
int(* SetClipboardText)(_THIS, const char *text)
Definition: SDL_sysvideo.h:298
int Wayland_GLES_LoadLibrary(_THIS, const char *path)
static void zxdg_shell_v6_pong(struct zxdg_shell_v6 *zxdg_shell_v6, uint32_t serial)
struct wl_shm * shm
#define SDL_strrchr
#define SDL_Unsupported()
Definition: SDL_error.h:53
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:256
int SDL_SendQuit(void)
Definition: SDL_quit.c:201
static int wl_registry_add_listener(struct wl_registry *wl_registry, const struct wl_registry_listener *listener, void *data)
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:281
static int zxdg_shell_v6_add_listener(struct zxdg_shell_v6 *zxdg_shell_v6, const struct zxdg_shell_v6_listener *listener, void *data)