zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_x11video.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 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_config.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 /* !!! FIXME: move dbus stuff to somewhere under src/core/linux ... */
43 #if SDL_USE_LIBDBUS
44 /* we never link directly to libdbus. */
45 #include "SDL_loadso.h"
46 static const char *dbus_library = "libdbus-1.so.3";
47 static void *dbus_handle = NULL;
48 
49 /* !!! FIXME: this is kinda ugly. */
50 static SDL_bool
51 load_dbus_sym(const char *fn, void **addr)
52 {
53  *addr = SDL_LoadFunction(dbus_handle, fn);
54  if (*addr == NULL) {
55  /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
56  return SDL_FALSE;
57  }
58 
59  return SDL_TRUE;
60 }
61 
62 /* libdbus entry points... */
63 static DBusConnection *(*DBUS_dbus_bus_get_private)(DBusBusType, DBusError *) = NULL;
64 static void (*DBUS_dbus_connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t) = NULL;
65 static dbus_bool_t (*DBUS_dbus_connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *) = NULL;
66 static void (*DBUS_dbus_connection_close)(DBusConnection *) = NULL;
67 static void (*DBUS_dbus_connection_unref)(DBusConnection *) = NULL;
68 static void (*DBUS_dbus_connection_flush)(DBusConnection *) = NULL;
69 static DBusMessage *(*DBUS_dbus_message_new_method_call)(const char *, const char *, const char *, const char *) = NULL;
70 static void (*DBUS_dbus_message_unref)(DBusMessage *) = NULL;
71 static void (*DBUS_dbus_error_init)(DBusError *) = NULL;
72 static dbus_bool_t (*DBUS_dbus_error_is_set)(const DBusError *) = NULL;
73 static void (*DBUS_dbus_error_free)(DBusError *) = NULL;
74 
75 static int
76 load_dbus_syms(void)
77 {
78  /* cast funcs to char* first, to please GCC's strict aliasing rules. */
79  #define SDL_DBUS_SYM(x) \
80  if (!load_dbus_sym(#x, (void **) (char *) &DBUS_##x)) return -1
81 
82  SDL_DBUS_SYM(dbus_bus_get_private);
83  SDL_DBUS_SYM(dbus_connection_set_exit_on_disconnect);
84  SDL_DBUS_SYM(dbus_connection_send);
85  SDL_DBUS_SYM(dbus_connection_close);
86  SDL_DBUS_SYM(dbus_connection_unref);
87  SDL_DBUS_SYM(dbus_connection_flush);
88  SDL_DBUS_SYM(dbus_message_new_method_call);
89  SDL_DBUS_SYM(dbus_message_unref);
90  SDL_DBUS_SYM(dbus_error_init);
91  SDL_DBUS_SYM(dbus_error_is_set);
92  SDL_DBUS_SYM(dbus_error_free);
93 
94  #undef SDL_DBUS_SYM
95 
96  return 0;
97 }
98 
99 static void
100 UnloadDBUSLibrary(void)
101 {
102  if (dbus_handle != NULL) {
103  SDL_UnloadObject(dbus_handle);
104  dbus_handle = NULL;
105  }
106 }
107 
108 static int
109 LoadDBUSLibrary(void)
110 {
111  int retval = 0;
112  if (dbus_handle == NULL) {
113  dbus_handle = SDL_LoadObject(dbus_library);
114  if (dbus_handle == NULL) {
115  retval = -1;
116  /* Don't call SDL_SetError(): SDL_LoadObject already did. */
117  } else {
118  retval = load_dbus_syms();
119  if (retval < 0) {
120  UnloadDBUSLibrary();
121  }
122  }
123  }
124 
125  return retval;
126 }
127 
128 static void
129 X11_InitDBus(_THIS)
130 {
131  if (LoadDBUSLibrary() != -1) {
133  DBusError err;
134  DBUS_dbus_error_init(&err);
135  data->dbus = DBUS_dbus_bus_get_private(DBUS_BUS_SESSION, &err);
136  if (DBUS_dbus_error_is_set(&err)) {
137  DBUS_dbus_error_free(&err);
138  if (data->dbus) {
139  DBUS_dbus_connection_unref(data->dbus);
140  data->dbus = NULL;
141  }
142  return; /* oh well */
143  }
144  DBUS_dbus_connection_set_exit_on_disconnect(data->dbus, 0);
145  }
146 }
147 
148 static void
149 X11_QuitDBus(_THIS)
150 {
152  if (data->dbus) {
153  DBUS_dbus_connection_close(data->dbus);
154  DBUS_dbus_connection_unref(data->dbus);
155  data->dbus = NULL;
156  }
157 }
158 
159 void
160 SDL_dbus_screensaver_tickle(_THIS)
161 {
162  const SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
163  DBusConnection *conn = data->dbus;
164  if (conn != NULL) {
165  DBusMessage *msg = DBUS_dbus_message_new_method_call("org.gnome.ScreenSaver",
166  "/org/gnome/ScreenSaver",
167  "org.gnome.ScreenSaver",
168  "SimulateUserActivity");
169  if (msg != NULL) {
170  if (DBUS_dbus_connection_send(conn, msg, NULL)) {
171  DBUS_dbus_connection_flush(conn);
172  }
173  DBUS_dbus_message_unref(msg);
174  }
175  }
176 }
177 #endif
178 
179 /* Initialization/Query functions */
180 static int X11_VideoInit(_THIS);
181 static void X11_VideoQuit(_THIS);
182 
183 /* Find out what class name we should use */
184 static char *
185 get_classname()
186 {
187  char *spot;
188 #if defined(__LINUX__) || defined(__FREEBSD__)
189  char procfile[1024];
190  char linkfile[1024];
191  int linksize;
192 #endif
193 
194  /* First allow environment variable override */
195  spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
196  if (spot) {
197  return SDL_strdup(spot);
198  }
199 
200  /* Next look at the application's executable name */
201 #if defined(__LINUX__) || defined(__FREEBSD__)
202 #if defined(__LINUX__)
203  SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
204 #elif defined(__FREEBSD__)
205  SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
206  getpid());
207 #else
208 #error Where can we find the executable name?
209 #endif
210  linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
211  if (linksize > 0) {
212  linkfile[linksize] = '\0';
213  spot = SDL_strrchr(linkfile, '/');
214  if (spot) {
215  return SDL_strdup(spot + 1);
216  } else {
217  return SDL_strdup(linkfile);
218  }
219  }
220 #endif /* __LINUX__ || __FREEBSD__ */
221 
222  /* Finally use the default we've used forever */
223  return SDL_strdup("SDL_App");
224 }
225 
226 /* X11 driver bootstrap functions */
227 
228 static int
229 X11_Available(void)
230 {
231  Display *display = NULL;
232  if (SDL_X11_LoadSymbols()) {
233  display = XOpenDisplay(NULL);
234  if (display != NULL) {
235  XCloseDisplay(display);
236  }
238  }
239  return (display != NULL);
240 }
241 
242 static void
243 X11_DeleteDevice(SDL_VideoDevice * device)
244 {
245  SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
246  if (data->display) {
247  XCloseDisplay(data->display);
248  }
249  SDL_free(data->windowlist);
250  SDL_free(device->driverdata);
251  SDL_free(device);
252 
254 }
255 
256 /* An error handler to reset the vidmode and then call the default handler. */
257 static SDL_bool safety_net_triggered = SDL_FALSE;
258 static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
259 static int
260 X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
261 {
262  SDL_VideoDevice *device = NULL;
263  /* if we trigger an error in our error handler, don't try again. */
264  if (!safety_net_triggered) {
265  safety_net_triggered = SDL_TRUE;
266  device = SDL_GetVideoDevice();
267  if (device != NULL) {
268  int i;
269  for (i = 0; i < device->num_displays; i++) {
270  SDL_VideoDisplay *display = &device->displays[i];
271  if (SDL_memcmp(&display->current_mode, &display->desktop_mode,
272  sizeof (SDL_DisplayMode)) != 0) {
273  X11_SetDisplayMode(device, display, &display->desktop_mode);
274  }
275  }
276  }
277  }
278 
279  if (orig_x11_errhandler != NULL) {
280  return orig_x11_errhandler(d, e); /* probably terminate. */
281  }
282 
283  return 0;
284 }
285 
286 static SDL_VideoDevice *
287 X11_CreateDevice(int devindex)
288 {
289  SDL_VideoDevice *device;
291  const char *display = NULL; /* Use the DISPLAY environment variable */
292 
293  if (!SDL_X11_LoadSymbols()) {
294  return NULL;
295  }
296 
297  /* Need for threading gl calls. This is also required for the proprietary
298  nVidia driver to be threaded. */
299  XInitThreads();
300 
301  /* Initialize all variables that we clean on shutdown */
302  device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
303  if (!device) {
304  SDL_OutOfMemory();
305  return NULL;
306  }
307  data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
308  if (!data) {
309  SDL_free(device);
310  SDL_OutOfMemory();
311  return NULL;
312  }
313  device->driverdata = data;
314 
315  /* FIXME: Do we need this?
316  if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
317  (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
318  local_X11 = 1;
319  } else {
320  local_X11 = 0;
321  }
322  */
323  data->display = XOpenDisplay(display);
324 #if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC)
325  /* On Tru64 if linking without -lX11, it fails and you get following message.
326  * Xlib: connection to ":0.0" refused by server
327  * Xlib: XDM authorization key matches an existing client!
328  *
329  * It succeeds if retrying 1 second later
330  * or if running xhost +localhost on shell.
331  */
332  if (data->display == NULL) {
333  SDL_Delay(1000);
334  data->display = XOpenDisplay(display);
335  }
336 #endif
337  if (data->display == NULL) {
338  SDL_free(device->driverdata);
339  SDL_free(device);
340  SDL_SetError("Couldn't open X11 display");
341  return NULL;
342  }
343 #ifdef X11_DEBUG
344  XSynchronize(data->display, True);
345 #endif
346 
347  /* Hook up an X11 error handler to recover the desktop resolution. */
348  safety_net_triggered = SDL_FALSE;
349  orig_x11_errhandler = XSetErrorHandler(X11_SafetyNetErrHandler);
350 
351  /* Set the function pointers */
352  device->VideoInit = X11_VideoInit;
353  device->VideoQuit = X11_VideoQuit;
358  device->PumpEvents = X11_PumpEvents;
359 
360  device->CreateWindow = X11_CreateWindow;
368  device->ShowWindow = X11_ShowWindow;
369  device->HideWindow = X11_HideWindow;
370  device->RaiseWindow = X11_RaiseWindow;
383 
387 
388 #if SDL_VIDEO_OPENGL_GLX
389  device->GL_LoadLibrary = X11_GL_LoadLibrary;
390  device->GL_GetProcAddress = X11_GL_GetProcAddress;
391  device->GL_UnloadLibrary = X11_GL_UnloadLibrary;
392  device->GL_CreateContext = X11_GL_CreateContext;
393  device->GL_MakeCurrent = X11_GL_MakeCurrent;
394  device->GL_SetSwapInterval = X11_GL_SetSwapInterval;
395  device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
396  device->GL_SwapWindow = X11_GL_SwapWindow;
397  device->GL_DeleteContext = X11_GL_DeleteContext;
398 #elif SDL_VIDEO_OPENGL_EGL
399  device->GL_LoadLibrary = X11_GLES_LoadLibrary;
400  device->GL_GetProcAddress = X11_GLES_GetProcAddress;
401  device->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
402  device->GL_CreateContext = X11_GLES_CreateContext;
403  device->GL_MakeCurrent = X11_GLES_MakeCurrent;
404  device->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
405  device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
406  device->GL_SwapWindow = X11_GLES_SwapWindow;
407  device->GL_DeleteContext = X11_GLES_DeleteContext;
408 #endif
409 
413 
414  device->free = X11_DeleteDevice;
415 
416  return device;
417 }
418 
419 VideoBootStrap X11_bootstrap = {
420  "x11", "SDL X11 video driver",
421  X11_Available, X11_CreateDevice
422 };
423 
424 static int (*handler) (Display *, XErrorEvent *) = NULL;
425 static int
426 X11_CheckWindowManagerErrorHandler(Display * d, XErrorEvent * e)
427 {
428  if (e->error_code == BadWindow) {
429  return (0);
430  } else {
431  return (handler(d, e));
432  }
433 }
434 
435 static void
436 X11_CheckWindowManager(_THIS)
437 {
439  Display *display = data->display;
440  Atom _NET_SUPPORTING_WM_CHECK;
441  int status, real_format;
442  Atom real_type;
443  unsigned long items_read, items_left;
444  unsigned char *propdata;
445  Window wm_window = 0;
446 #ifdef DEBUG_WINDOW_MANAGER
447  char *wm_name;
448 #endif
449 
450  /* Set up a handler to gracefully catch errors */
451  XSync(display, False);
452  handler = XSetErrorHandler(X11_CheckWindowManagerErrorHandler);
453 
454  _NET_SUPPORTING_WM_CHECK = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
455  status = XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
456  if (status == Success && items_read) {
457  wm_window = ((Window*)propdata)[0];
458  }
459  if (propdata) {
460  XFree(propdata);
461  }
462 
463  if (wm_window) {
464  status = XGetWindowProperty(display, wm_window, _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
465  if (status != Success || !items_read || wm_window != ((Window*)propdata)[0]) {
466  wm_window = None;
467  }
468  if (propdata) {
469  XFree(propdata);
470  }
471  }
472 
473  /* Reset the error handler, we're done checking */
474  XSync(display, False);
475  XSetErrorHandler(handler);
476 
477  if (!wm_window) {
478 #ifdef DEBUG_WINDOW_MANAGER
479  printf("Couldn't get _NET_SUPPORTING_WM_CHECK property\n");
480 #endif
481  return;
482  }
483  data->net_wm = SDL_TRUE;
484 
485 #ifdef DEBUG_WINDOW_MANAGER
486  wm_name = X11_GetWindowTitle(_this, wm_window);
487  printf("Window manager: %s\n", wm_name);
488  SDL_free(wm_name);
489 #endif
490 }
491 
492 
493 int
494 X11_VideoInit(_THIS)
495 {
497 
498  /* Get the window class name, usually the name of the application */
499  data->classname = get_classname();
500 
501  /* Get the process PID to be associated to the window */
502  data->pid = getpid();
503 
504  /* Open a connection to the X input manager */
505 #ifdef X_HAVE_UTF8_STRING
506  if (SDL_X11_HAVE_UTF8) {
507  data->im =
508  XOpenIM(data->display, NULL, data->classname, data->classname);
509  }
510 #endif
511 
512  /* Look up some useful Atoms */
513 #define GET_ATOM(X) data->X = XInternAtom(data->display, #X, False)
514  GET_ATOM(WM_PROTOCOLS);
515  GET_ATOM(WM_DELETE_WINDOW);
516  GET_ATOM(_NET_WM_STATE);
517  GET_ATOM(_NET_WM_STATE_HIDDEN);
518  GET_ATOM(_NET_WM_STATE_FOCUSED);
521  GET_ATOM(_NET_WM_STATE_FULLSCREEN);
522  GET_ATOM(_NET_WM_ALLOWED_ACTIONS);
523  GET_ATOM(_NET_WM_ACTION_FULLSCREEN);
524  GET_ATOM(_NET_WM_NAME);
525  GET_ATOM(_NET_WM_ICON_NAME);
526  GET_ATOM(_NET_WM_ICON);
527  GET_ATOM(_NET_WM_PING);
528  GET_ATOM(_NET_ACTIVE_WINDOW);
529  GET_ATOM(UTF8_STRING);
530  GET_ATOM(PRIMARY);
531  GET_ATOM(XdndEnter);
532  GET_ATOM(XdndPosition);
533  GET_ATOM(XdndStatus);
534  GET_ATOM(XdndTypeList);
535  GET_ATOM(XdndActionCopy);
536  GET_ATOM(XdndDrop);
537  GET_ATOM(XdndFinished);
538  GET_ATOM(XdndSelection);
539 
540  /* Detect the window manager */
541  X11_CheckWindowManager(_this);
542 
543  if (X11_InitModes(_this) < 0) {
544  return -1;
545  }
546 
548 
549  if (X11_InitKeyboard(_this) != 0) {
550  return -1;
551  }
553 
555 
556 #if SDL_USE_LIBDBUS
557  X11_InitDBus(_this);
558 #endif
559 
560  return 0;
561 }
562 
563 void
564 X11_VideoQuit(_THIS)
565 {
567 
568  SDL_free(data->classname);
569 #ifdef X_HAVE_UTF8_STRING
570  if (data->im) {
571  XCloseIM(data->im);
572  }
573 #endif
574 
579 
580 #if SDL_USE_LIBDBUS
581  X11_QuitDBus(_this);
582 #endif
583 }
584 
585 SDL_bool
587 {
588  return SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ? SDL_FALSE : SDL_TRUE;
589 }
590 
591 #endif /* SDL_VIDEO_DRIVER_X11 */
592 
593 /* vim: set ts=4 sw=4 expandtab: */
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:190
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:169
void X11_PumpEvents(_THIS)
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:195
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer retur XCloseDisplay)
Definition: SDL_x11sym.h:34
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
Definition: SDL_sysvideo.h:204
Display * display
Definition: SDL_x11video.h:75
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:215
Atom _NET_WM_STATE_FULLSCREEN
Definition: SDL_x11video.h:95
int X11_ResizeWindowShape(SDL_Window *window)
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:193
Atom _NET_WM_ALLOWED_ACTIONS
Definition: SDL_x11video.h:96
void X11_SetWindowTitle(_THIS, SDL_Window *window)
int X11_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
int(* SetClipboardText)(_THIS, const char *text)
Definition: SDL_sysvideo.h:254
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
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 int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int retur XOpenDisplay)
Definition: SDL_x11sym.h:92
#define NULL
Definition: ftobjs.h:61
DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt,...)
Definition: SDL_string.c:1277
int X11_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void X11_InitXinput2(_THIS)
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:192
Atom _NET_WM_STATE_MAXIMIZED_VERT
Definition: SDL_x11video.h:93
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:226
GLenum GLvoid * addr
Definition: glew.h:10667
char * X11_GetClipboardText(_THIS)
void X11_QuitKeyboard(_THIS)
SDL_bool
Definition: SDL_stdinc.h:116
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
Definition: SDL_sysvideo.h:164
int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shapeMode)
return Display return Display Bool Bool int int e
Definition: SDL_x11sym.h:30
SDL_bool X11_UseDirectColorVisuals(void)
DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c)
Definition: SDL_string.c:593
DECLSPEC void SDLCALL SDL_free(void *mem)
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:201
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_WindowData ** windowlist
Definition: SDL_x11video.h:81
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:186
int X11_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len)
Definition: SDL_string.c:370
void X11_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
void X11_MinimizeWindow(_THIS, SDL_Window *window)
return Display return Display Bool Bool int d
Definition: SDL_x11sym.h:30
void X11_InitMouse(_THIS)
char * display
Definition: visualinfo.c:85
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:184
if(!yyg->yy_init)
#define SDL_X11_HAVE_UTF8
void X11_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
void(* free)(_THIS)
Definition: SDL_sysvideo.h:327
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 int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int return _Xconst char return Display XEvent return Display Drawable GC XImage int int int int unsigned int unsigned int return Display Window Window Window int int int int unsigned int return Display Window Window int int return Display Window unsigned int unsigned int return Display Window Bool long XEvent return Display GC unsigned long return Display Window int Time return Display Window Window return Display Window unsigned long return Display Window XSizeHints Display Colormap XColor int return char int XTextProperty return XFontStruct _Xconst char int int int int XCharStruct return Display Window return Display Time return Display Colormap return Display Window Window int int unsigned int unsigned int int int return Display Window int return XExtensionInfo Display char XExtensionHooks int XPointer return XExtensionInfo XExtensionInfo Display return Display return Display unsigned long Display GC Display char long Display xReply int Bool retur XSynchronize)
Definition: SDL_x11sym.h:152
void X11_MaximizeWindow(_THIS, SDL_Window *window)
int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect)
Atom _NET_WM_STATE
Definition: SDL_x11video.h:90
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:228
static SDL_VideoDevice * _this
Definition: SDL_video.c:92
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:205
int(* CreateWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:183
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:224
char * classname
Definition: SDL_x11video.h:76
Atom _NET_WM_STATE_HIDDEN
Definition: SDL_x11video.h:91
Atom _NET_ACTIVE_WINDOW
Definition: SDL_x11video.h:102
Atom WM_DELETE_WINDOW
Definition: SDL_x11video.h:89
SDL_bool X11_HasClipboardText(_THIS)
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 int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym retur XInternAtom)
Definition: SDL_x11sym.h:82
int X11_CreateWindow(_THIS, SDL_Window *window)
void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
void X11_SuspendScreenSaver(_THIS)
int
Definition: SDL_systhread.c:37
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
Definition: SDL_sysvideo.h:59
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:148
Atom _NET_WM_ICON_NAME
Definition: SDL_x11video.h:99
int X11_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
int X11_InitModes(_THIS)
#define _THIS
DECLSPEC char *SDLCALL SDL_strdup(const char *str)
Definition: SDL_string.c:511
DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile)
int X11_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
Definition: SDL_sysvideo.h:199
int SDL_X11_LoadSymbols(void)
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
Definition: SDL_systimer.c:70
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:120
void X11_RestoreWindow(_THIS, SDL_Window *window)
SDL_VideoDisplay * displays
Definition: SDL_sysvideo.h:265
DECLSPEC void SDLCALL SDL_UnloadObject(void *handle)
Atom _NET_WM_ACTION_FULLSCREEN
Definition: SDL_x11video.h:97
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
Definition: SDL_error.c:53
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:187
void X11_ShowWindow(_THIS, SDL_Window *window)
void X11_DestroyWindow(_THIS, SDL_Window *window)
void X11_QuitMouse(_THIS)
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:237
SDL_WindowShaper * X11_CreateShaper(SDL_Window *window)
int X11_SetClipboardText(_THIS, const char *text)
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:189
void(* SuspendScreenSaver)(_THIS)
Definition: SDL_sysvideo.h:240
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
Definition: SDL_sysvideo.h:58
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:229
void X11_SetWindowMinimumSize(_THIS, SDL_Window *window)
sizeof(FT_AutofitterRec)
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:119
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:83
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:231
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:194
Atom _NET_WM_STATE_MAXIMIZED_HORZ
Definition: SDL_x11video.h:94
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:202
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:188
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:177
int X11_InitKeyboard(_THIS)
void X11_QuitModes(_THIS)
char *(* GetClipboardText)(_THIS)
Definition: SDL_sysvideo.h:255
Atom _NET_WM_STATE_FOCUSED
Definition: SDL_x11video.h:92
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
void X11_RaiseWindow(_THIS, SDL_Window *window)
void X11_InitTouch(_THIS)
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:222
SDL_bool net_wm
Definition: SDL_x11video.h:85
void X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:230
char * X11_GetWindowTitle(_THIS, Window xwindow)
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:154
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:191
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:548
SDL_ShapeDriver shape_driver
Definition: SDL_sysvideo.h:212
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
Definition: SDL_sysvideo.h:203
SDL_bool(* HasClipboardText)(_THIS)
Definition: SDL_sysvideo.h:256
DECLSPEC char *SDLCALL SDL_getenv(const char *name)
Definition: SDL_getenv.c:179
void SDL_X11_UnloadSymbols(void)
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:185
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
Definition: SDL_sysvideo.h:197
void X11_SetWindowSize(_THIS, SDL_Window *window)
int i
Definition: pngrutil.c:1377
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:198
DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, const char *name)
void X11_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
void X11_HideWindow(_THIS, SDL_Window *window)
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:223
void X11_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
int(* ResizeWindowShape)(SDL_Window *window)
Definition: SDL_sysvideo.h:60
SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
void X11_SetWindowMaximumSize(_THIS, SDL_Window *window)
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:196
void X11_QuitTouch(_THIS)
void X11_SetWindowPosition(_THIS, SDL_Window *window)