SDL  2.0
SDL_x11video.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 #include "../../SDL_internal.h"
22 
23 #if SDL_VIDEO_DRIVER_X11
24 
25 #include <unistd.h> /* For getpid() and readlink() */
26 
27 #include "SDL_video.h"
28 #include "SDL_mouse.h"
29 #include "SDL_timer.h"
30 #include "../SDL_sysvideo.h"
31 #include "../SDL_pixels_c.h"
32 
33 #include "SDL_x11video.h"
34 #include "SDL_x11framebuffer.h"
35 #include "SDL_x11shape.h"
36 #include "SDL_x11touch.h"
37 #include "SDL_x11xinput2.h"
38 
39 #if SDL_VIDEO_OPENGL_EGL
40 #include "SDL_x11opengles.h"
41 #endif
42 
43 #include "SDL_x11vulkan.h"
44 
45 /* Initialization/Query functions */
46 static int X11_VideoInit(_THIS);
47 static void X11_VideoQuit(_THIS);
48 
49 /* Find out what class name we should use */
50 static char *
51 get_classname()
52 {
53  char *spot;
54 #if defined(__LINUX__) || defined(__FREEBSD__)
55  char procfile[1024];
56  char linkfile[1024];
57  int linksize;
58 #endif
59 
60  /* First allow environment variable override */
61  spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
62  if (spot) {
63  return SDL_strdup(spot);
64  }
65 
66  /* Next look at the application's executable name */
67 #if defined(__LINUX__) || defined(__FREEBSD__)
68 #if defined(__LINUX__)
69  SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
70 #elif defined(__FREEBSD__)
71  SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
72  getpid());
73 #else
74 #error Where can we find the executable name?
75 #endif
76  linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
77  if (linksize > 0) {
78  linkfile[linksize] = '\0';
79  spot = SDL_strrchr(linkfile, '/');
80  if (spot) {
81  return SDL_strdup(spot + 1);
82  } else {
83  return SDL_strdup(linkfile);
84  }
85  }
86 #endif /* __LINUX__ || __FREEBSD__ */
87 
88  /* Finally use the default we've used forever */
89  return SDL_strdup("SDL_App");
90 }
91 
92 /* X11 driver bootstrap functions */
93 
94 static int
95 X11_Available(void)
96 {
97  Display *display = NULL;
98  if (SDL_X11_LoadSymbols()) {
99  display = X11_XOpenDisplay(NULL);
100  if (display != NULL) {
101  X11_XCloseDisplay(display);
102  }
104  }
105  return (display != NULL);
106 }
107 
108 static void
109 X11_DeleteDevice(SDL_VideoDevice * device)
110 {
112  if (device->vulkan_config.loader_handle) {
113  device->Vulkan_UnloadLibrary(device);
114  }
115  if (data->display) {
116  X11_XCloseDisplay(data->display);
117  }
118  SDL_free(data->windowlist);
119  SDL_free(device->driverdata);
120  SDL_free(device);
121 
123 }
124 
125 /* An error handler to reset the vidmode and then call the default handler. */
126 static SDL_bool safety_net_triggered = SDL_FALSE;
127 static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
128 static int
129 X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
130 {
131  SDL_VideoDevice *device = NULL;
132  /* if we trigger an error in our error handler, don't try again. */
133  if (!safety_net_triggered) {
134  safety_net_triggered = SDL_TRUE;
135  device = SDL_GetVideoDevice();
136  if (device != NULL) {
137  int i;
138  for (i = 0; i < device->num_displays; i++) {
139  SDL_VideoDisplay *display = &device->displays[i];
140  if (SDL_memcmp(&display->current_mode, &display->desktop_mode,
141  sizeof (SDL_DisplayMode)) != 0) {
142  X11_SetDisplayMode(device, display, &display->desktop_mode);
143  }
144  }
145  }
146  }
147 
148  if (orig_x11_errhandler != NULL) {
149  return orig_x11_errhandler(d, e); /* probably terminate. */
150  }
151 
152  return 0;
153 }
154 
155 static SDL_VideoDevice *
156 X11_CreateDevice(int devindex)
157 {
160  const char *display = NULL; /* Use the DISPLAY environment variable */
161 
162  if (!SDL_X11_LoadSymbols()) {
163  return NULL;
164  }
165 
166  /* Need for threading gl calls. This is also required for the proprietary
167  nVidia driver to be threaded. */
168  X11_XInitThreads();
169 
170  /* Initialize all variables that we clean on shutdown */
171  device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
172  if (!device) {
173  SDL_OutOfMemory();
174  return NULL;
175  }
176  data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
177  if (!data) {
178  SDL_free(device);
179  SDL_OutOfMemory();
180  return NULL;
181  }
182  device->driverdata = data;
183 
185 
186  /* FIXME: Do we need this?
187  if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) ||
188  (SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) {
189  local_X11 = 1;
190  } else {
191  local_X11 = 0;
192  }
193  */
194  data->display = X11_XOpenDisplay(display);
195 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
196  /* On some systems if linking without -lX11, it fails and you get following message.
197  * Xlib: connection to ":0.0" refused by server
198  * Xlib: XDM authorization key matches an existing client!
199  *
200  * It succeeds if retrying 1 second later
201  * or if running xhost +localhost on shell.
202  */
203  if (data->display == NULL) {
204  SDL_Delay(1000);
205  data->display = X11_XOpenDisplay(display);
206  }
207 #endif
208  if (data->display == NULL) {
209  SDL_free(device->driverdata);
210  SDL_free(device);
211  SDL_SetError("Couldn't open X11 display");
212  return NULL;
213  }
214 #ifdef X11_DEBUG
215  X11_XSynchronize(data->display, True);
216 #endif
217 
218  /* Hook up an X11 error handler to recover the desktop resolution. */
219  safety_net_triggered = SDL_FALSE;
220  orig_x11_errhandler = X11_XSetErrorHandler(X11_SafetyNetErrHandler);
221 
222  /* Set the function pointers */
223  device->VideoInit = X11_VideoInit;
224  device->VideoQuit = X11_VideoQuit;
225  device->ResetTouch = X11_ResetTouch;
232  device->PumpEvents = X11_PumpEvents;
233 
246  device->ShowWindow = X11_ShowWindow;
247  device->HideWindow = X11_HideWindow;
248  device->RaiseWindow = X11_RaiseWindow;
263 
267 
268 #if SDL_VIDEO_OPENGL_GLX
269  device->GL_LoadLibrary = X11_GL_LoadLibrary;
270  device->GL_GetProcAddress = X11_GL_GetProcAddress;
271  device->GL_UnloadLibrary = X11_GL_UnloadLibrary;
272  device->GL_CreateContext = X11_GL_CreateContext;
273  device->GL_MakeCurrent = X11_GL_MakeCurrent;
274  device->GL_SetSwapInterval = X11_GL_SetSwapInterval;
275  device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
276  device->GL_SwapWindow = X11_GL_SwapWindow;
277  device->GL_DeleteContext = X11_GL_DeleteContext;
278 #elif SDL_VIDEO_OPENGL_EGL
279  device->GL_LoadLibrary = X11_GLES_LoadLibrary;
280  device->GL_GetProcAddress = X11_GLES_GetProcAddress;
281  device->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
282  device->GL_CreateContext = X11_GLES_CreateContext;
283  device->GL_MakeCurrent = X11_GLES_MakeCurrent;
284  device->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
285  device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
286  device->GL_SwapWindow = X11_GLES_SwapWindow;
287  device->GL_DeleteContext = X11_GLES_DeleteContext;
288 #endif
289 
296 
297  device->free = X11_DeleteDevice;
298 
299 #if SDL_VIDEO_VULKAN
300  device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary;
301  device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary;
302  device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions;
303  device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface;
304 #endif
305 
306  return device;
307 }
308 
310  "x11", "SDL X11 video driver",
311  X11_Available, X11_CreateDevice
312 };
313 
314 static int (*handler) (Display *, XErrorEvent *) = NULL;
315 static int
316 X11_CheckWindowManagerErrorHandler(Display * d, XErrorEvent * e)
317 {
318  if (e->error_code == BadWindow) {
319  return (0);
320  } else {
321  return (handler(d, e));
322  }
323 }
324 
325 static void
326 X11_CheckWindowManager(_THIS)
327 {
329  Display *display = data->display;
330  Atom _NET_SUPPORTING_WM_CHECK;
331  int status, real_format;
332  Atom real_type;
333  unsigned long items_read = 0, items_left = 0;
334  unsigned char *propdata = NULL;
335  Window wm_window = 0;
336 #ifdef DEBUG_WINDOW_MANAGER
337  char *wm_name;
338 #endif
339 
340  /* Set up a handler to gracefully catch errors */
341  X11_XSync(display, False);
342  handler = X11_XSetErrorHandler(X11_CheckWindowManagerErrorHandler);
343 
344  _NET_SUPPORTING_WM_CHECK = X11_XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
345  status = X11_XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
346  if (status == Success) {
347  if (items_read) {
348  wm_window = ((Window*)propdata)[0];
349  }
350  if (propdata) {
351  X11_XFree(propdata);
352  propdata = NULL;
353  }
354  }
355 
356  if (wm_window) {
357  status = X11_XGetWindowProperty(display, wm_window, _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
358  if (status != Success || !items_read || wm_window != ((Window*)propdata)[0]) {
359  wm_window = None;
360  }
361  if (status == Success && propdata) {
362  X11_XFree(propdata);
363  propdata = NULL;
364  }
365  }
366 
367  /* Reset the error handler, we're done checking */
368  X11_XSync(display, False);
369  X11_XSetErrorHandler(handler);
370 
371  if (!wm_window) {
372 #ifdef DEBUG_WINDOW_MANAGER
373  printf("Couldn't get _NET_SUPPORTING_WM_CHECK property\n");
374 #endif
375  return;
376  }
377  data->net_wm = SDL_TRUE;
378 
379 #ifdef DEBUG_WINDOW_MANAGER
380  wm_name = X11_GetWindowTitle(_this, wm_window);
381  printf("Window manager: %s\n", wm_name);
382  SDL_free(wm_name);
383 #endif
384 }
385 
386 
387 int
388 X11_VideoInit(_THIS)
389 {
391 
392  /* Get the window class name, usually the name of the application */
393  data->classname = get_classname();
394 
395  /* Get the process PID to be associated to the window */
396  data->pid = getpid();
397 
398  /* I have no idea how random this actually is, or has to be. */
399  data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
400 
401  /* Look up some useful Atoms */
402 #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False)
403  GET_ATOM(WM_PROTOCOLS);
404  GET_ATOM(WM_DELETE_WINDOW);
405  GET_ATOM(WM_TAKE_FOCUS);
406  GET_ATOM(_NET_WM_STATE);
407  GET_ATOM(_NET_WM_STATE_HIDDEN);
408  GET_ATOM(_NET_WM_STATE_FOCUSED);
411  GET_ATOM(_NET_WM_STATE_FULLSCREEN);
412  GET_ATOM(_NET_WM_STATE_ABOVE);
413  GET_ATOM(_NET_WM_STATE_SKIP_TASKBAR);
414  GET_ATOM(_NET_WM_STATE_SKIP_PAGER);
415  GET_ATOM(_NET_WM_ALLOWED_ACTIONS);
416  GET_ATOM(_NET_WM_ACTION_FULLSCREEN);
417  GET_ATOM(_NET_WM_NAME);
418  GET_ATOM(_NET_WM_ICON_NAME);
419  GET_ATOM(_NET_WM_ICON);
420  GET_ATOM(_NET_WM_PING);
421  GET_ATOM(_NET_WM_WINDOW_OPACITY);
422  GET_ATOM(_NET_WM_USER_TIME);
423  GET_ATOM(_NET_ACTIVE_WINDOW);
424  GET_ATOM(_NET_FRAME_EXTENTS);
425  GET_ATOM(UTF8_STRING);
426  GET_ATOM(PRIMARY);
427  GET_ATOM(XdndEnter);
428  GET_ATOM(XdndPosition);
429  GET_ATOM(XdndStatus);
430  GET_ATOM(XdndTypeList);
431  GET_ATOM(XdndActionCopy);
432  GET_ATOM(XdndDrop);
433  GET_ATOM(XdndFinished);
434  GET_ATOM(XdndSelection);
435  GET_ATOM(XKLAVIER_STATE);
436 
437  /* Detect the window manager */
438  X11_CheckWindowManager(_this);
439 
440  if (X11_InitModes(_this) < 0) {
441  return -1;
442  }
443 
444  X11_InitXinput2(_this);
445 
446  if (X11_InitKeyboard(_this) != 0) {
447  return -1;
448  }
449  X11_InitMouse(_this);
450 
451  X11_InitTouch(_this);
452 
453 #if SDL_USE_LIBDBUS
454  SDL_DBus_Init();
455 #endif
456 
457  return 0;
458 }
459 
460 void
461 X11_VideoQuit(_THIS)
462 {
463  SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
464 
465  if (data->clipboard_window) {
466  X11_XDestroyWindow(data->display, data->clipboard_window);
467  }
468 
469  SDL_free(data->classname);
470 #ifdef X_HAVE_UTF8_STRING
471  if (data->im) {
472  X11_XCloseIM(data->im);
473  }
474 #endif
475 
476  X11_QuitModes(_this);
477  X11_QuitKeyboard(_this);
478  X11_QuitMouse(_this);
479  X11_QuitTouch(_this);
480 
481 /* !!! FIXME: other subsystems use D-Bus, so we shouldn't quit it here;
482  have SDL.c do this at a higher level, or add refcounting. */
483 #if SDL_USE_LIBDBUS
484  SDL_DBus_Quit();
485 #endif
486 }
487 
488 SDL_bool
490 {
491  return SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ? SDL_FALSE : SDL_TRUE;
492 }
493 
494 #endif /* SDL_VIDEO_DRIVER_X11 */
495 
496 /* vim: set ts=4 sw=4 expandtab: */
int(* Vulkan_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:270
void X11_PumpEvents(_THIS)
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
Definition: SDL_sysvideo.h:186
struct SDL_VideoDevice::@35 vulkan_config
int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
Atom _NET_WM_STATE_FULLSCREEN
Definition: SDL_x11video.h:100
int X11_ResizeWindowShape(SDL_Window *window)
Atom _NET_WM_ALLOWED_ACTIONS
Definition: SDL_x11video.h:104
VideoBootStrap X11_bootstrap
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:227
void X11_SetWindowTitle(_THIS, SDL_Window *window)
int X11_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
Definition: SDL_sysvideo.h:305
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 Uint32 * e
int X11_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void X11_InitXinput2(_THIS)
Atom _NET_WM_STATE_MAXIMIZED_VERT
Definition: SDL_x11video.h:98
char * X11_GetClipboardText(_THIS)
void X11_QuitKeyboard(_THIS)
void X11_SetTextInputRect(_THIS, SDL_Rect *rect)
struct wl_display * display
void(* free)(_THIS)
Definition: SDL_sysvideo.h:390
int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shapeMode)
SDL_bool X11_UseDirectColorVisuals(void)
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:260
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:222
The structure that defines a display mode.
Definition: SDL_video.h:53
void X11_ResetTouch(_THIS)
SDL_WindowData ** windowlist
Definition: SDL_x11video.h:83
void X11_StartTextInput(_THIS)
void(* StartTextInput)(_THIS)
Definition: SDL_sysvideo.h:286
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:215
int X11_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
int(* GetWindowBordersSize)(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
Definition: SDL_sysvideo.h:218
void X11_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Atom _NET_FRAME_EXTENTS
Definition: SDL_x11video.h:113
void X11_MinimizeWindow(_THIS, SDL_Window *window)
Atom _NET_WM_WINDOW_OPACITY
Definition: SDL_x11video.h:110
void X11_InitMouse(_THIS)
void X11_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:254
SDL_bool global_mouse_changed
Definition: SDL_x11video.h:133
int X11_SetWindowOpacity(_THIS, SDL_Window *window, float opacity)
void X11_MaximizeWindow(_THIS, SDL_Window *window)
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:204
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:228
int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect)
Atom _NET_WM_STATE
Definition: SDL_x11video.h:95
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:223
static SDL_AudioDeviceID device
Definition: loopwave.c:37
unsigned int size_t
Atom _NET_WM_STATE_SKIP_TASKBAR
Definition: SDL_x11video.h:102
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:224
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
Definition: SDL_sysvideo.h:61
Atom _NET_WM_STATE_HIDDEN
Definition: SDL_x11video.h:96
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
Definition: SDL_sysvideo.h:288
Atom _NET_WM_USER_TIME
Definition: SDL_x11video.h:111
Atom _NET_ACTIVE_WINDOW
Definition: SDL_x11video.h:112
SDL_bool(* Vulkan_GetInstanceExtensions)(_THIS, SDL_Window *window, unsigned *count, const char **names)
Definition: SDL_sysvideo.h:272
Atom WM_DELETE_WINDOW
Definition: SDL_x11video.h:93
SDL_bool X11_HasClipboardText(_THIS)
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:247
int X11_CreateWindow(_THIS, SDL_Window *window)
void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:257
void X11_SuspendScreenSaver(_THIS)
Atom _NET_WM_STATE_SKIP_PAGER
Definition: SDL_x11video.h:103
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:273
Atom _NET_WM_ICON_NAME
Definition: SDL_x11video.h:107
int X11_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
int X11_InitModes(_THIS)
#define _THIS
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:258
#define SDL_free
int X11_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
void(* Vulkan_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:271
#define SDL_memcmp
int SDL_X11_LoadSymbols(void)
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:216
int X11_SetWindowInputFocus(_THIS, SDL_Window *window)
int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay *sdl_display, float *ddpi, float *hdpi, float *vdpi)
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:132
void X11_RestoreWindow(_THIS, SDL_Window *window)
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:312
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:181
int X11_GetWindowBordersSize(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:234
void(* StopTextInput)(_THIS)
Definition: SDL_sysvideo.h:287
Atom _NET_WM_ACTION_FULLSCREEN
Definition: SDL_x11video.h:105
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:213
Window clipboard_window
Definition: SDL_x11video.h:86
void X11_ShowWindow(_THIS, SDL_Window *window)
void X11_DestroyWindow(_THIS, SDL_Window *window)
void X11_QuitMouse(_THIS)
SDL_WindowShaper * X11_CreateShaper(SDL_Window *window)
#define SDL_Delay
#define SDL_getenv
int X11_SetClipboardText(_THIS, const char *text)
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:237
void(* ResetTouch)(_THIS)
Definition: SDL_sysvideo.h:171
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:256
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:196
void X11_SetWindowMinimumSize(_THIS, SDL_Window *window)
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:217
#define NULL
Definition: begin_code.h:164
int(* CreateSDLWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:210
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_bool
Definition: SDL_stdinc.h:139
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:131
int X11_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
Atom _NET_WM_STATE_MAXIMIZED_HORZ
Definition: SDL_x11video.h:99
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:166
void X11_StopTextInput(_THIS)
#define SDL_SetError
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
Definition: SDL_sysvideo.h:60
#define SDL_calloc
int(* ResizeWindowShape)(SDL_Window *window)
Definition: SDL_sysvideo.h:62
int(* SetWindowOpacity)(_THIS, SDL_Window *window, float opacity)
Definition: SDL_sysvideo.h:219
int X11_InitKeyboard(_THIS)
void X11_QuitModes(_THIS)
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:214
int(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:262
#define SDL_strdup
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:226
Atom _NET_WM_STATE_FOCUSED
Definition: SDL_x11video.h:97
void X11_RaiseWindow(_THIS, SDL_Window *window)
void X11_InitTouch(_THIS)
SDL_bool net_wm
Definition: SDL_x11video.h:89
void X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
char * X11_GetWindowTitle(_THIS, Window xwindow)
int(* SetWindowInputFocus)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:221
SDL_bool(* HasClipboardText)(_THIS)
Definition: SDL_sysvideo.h:299
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:586
SDL_ShapeDriver shape_driver
Definition: SDL_sysvideo.h:244
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:160
#define SDL_snprintf
int(* CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:211
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:230
int(* SetWindowModalFor)(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
Definition: SDL_sysvideo.h:220
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:236
void SDL_X11_UnloadSymbols(void)
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:263
char *(* GetClipboardText)(_THIS)
Definition: SDL_sysvideo.h:298
void X11_SetWindowSize(_THIS, SDL_Window *window)
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:212
void(* SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable)
Definition: SDL_sysvideo.h:229
int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect)
int(* GetDisplayUsableBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:191
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:261
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
int(* SetClipboardText)(_THIS, const char *text)
Definition: SDL_sysvideo.h:297
Atom _NET_WM_STATE_ABOVE
Definition: SDL_x11video.h:101
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:231
void X11_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
void X11_HideWindow(_THIS, SDL_Window *window)
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:283
#define SDL_strrchr
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:233
void X11_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
void X11_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
void * loader_handle
Definition: SDL_sysvideo.h:372
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:235
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:255
Atom WM_TAKE_FOCUS
Definition: SDL_x11video.h:94
SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
void X11_SetWindowMaximumSize(_THIS, SDL_Window *window)
void X11_QuitTouch(_THIS)
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:280
void X11_SetWindowPosition(_THIS, SDL_Window *window)