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