SDL  2.0
SDL_x11window.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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 "SDL_assert.h"
26 #include "SDL_hints.h"
27 #include "../SDL_sysvideo.h"
28 #include "../SDL_pixels_c.h"
29 #include "../../events/SDL_keyboard_c.h"
30 #include "../../events/SDL_mouse_c.h"
31 
32 #include "SDL_x11video.h"
33 #include "SDL_x11mouse.h"
34 #include "SDL_x11shape.h"
35 #include "SDL_x11xinput2.h"
36 
37 #if SDL_VIDEO_OPENGL_EGL
38 #include "SDL_x11opengles.h"
39 #endif
40 
41 #include "SDL_timer.h"
42 #include "SDL_syswm.h"
43 #include "SDL_log.h"
44 
45 #define _NET_WM_STATE_REMOVE 0l
46 #define _NET_WM_STATE_ADD 1l
47 
48 static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win)
49 {
50  return ev->type == MapNotify && ev->xmap.window == *((Window*)win);
51 }
52 static Bool isUnmapNotify(Display *dpy, XEvent *ev, XPointer win)
53 {
54  return ev->type == UnmapNotify && ev->xunmap.window == *((Window*)win);
55 }
56 
57 /*
58 static Bool isConfigureNotify(Display *dpy, XEvent *ev, XPointer win)
59 {
60  return ev->type == ConfigureNotify && ev->xconfigure.window == *((Window*)win);
61 }
62 static Bool
63 X11_XIfEventTimeout(Display *display, XEvent *event_return, Bool (*predicate)(), XPointer arg, int timeoutMS)
64 {
65  Uint32 start = SDL_GetTicks();
66 
67  while (!X11_XCheckIfEvent(display, event_return, predicate, arg)) {
68  if (SDL_TICKS_PASSED(SDL_GetTicks(), start + timeoutMS)) {
69  return False;
70  }
71  }
72  return True;
73 }
74 */
75 
76 static SDL_bool
77 X11_IsWindowLegacyFullscreen(_THIS, SDL_Window * window)
78 {
79  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
80  return (data->fswindow != 0);
81 }
82 
83 static SDL_bool
84 X11_IsWindowMapped(_THIS, SDL_Window * window)
85 {
86  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
87  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
88  XWindowAttributes attr;
89 
90  X11_XGetWindowAttributes(videodata->display, data->xwindow, &attr);
91  if (attr.map_state != IsUnmapped) {
92  return SDL_TRUE;
93  } else {
94  return SDL_FALSE;
95  }
96 }
97 
98 #if 0
99 static SDL_bool
100 X11_IsActionAllowed(SDL_Window *window, Atom action)
101 {
102  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
103  Atom _NET_WM_ALLOWED_ACTIONS = data->videodata->_NET_WM_ALLOWED_ACTIONS;
104  Atom type;
105  Display *display = data->videodata->display;
106  int form;
107  unsigned long remain;
108  unsigned long len, i;
109  Atom *list;
110  SDL_bool ret = SDL_FALSE;
111 
112  if (X11_XGetWindowProperty(display, data->xwindow, _NET_WM_ALLOWED_ACTIONS, 0, 1024, False, XA_ATOM, &type, &form, &len, &remain, (unsigned char **)&list) == Success)
113  {
114  for (i=0; i<len; ++i)
115  {
116  if (list[i] == action) {
117  ret = SDL_TRUE;
118  break;
119  }
120  }
121  X11_XFree(list);
122  }
123  return ret;
124 }
125 #endif /* 0 */
126 
127 void
128 X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
129 {
130  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
131  Display *display = videodata->display;
132  /* !!! FIXME: just dereference videodata below instead of copying to locals. */
133  Atom _NET_WM_STATE = videodata->_NET_WM_STATE;
134  /* Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN; */
135  Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED;
136  Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT;
137  Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
138  Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN;
139  Atom _NET_WM_STATE_ABOVE = videodata->_NET_WM_STATE_ABOVE;
140  Atom _NET_WM_STATE_SKIP_TASKBAR = videodata->_NET_WM_STATE_SKIP_TASKBAR;
141  Atom _NET_WM_STATE_SKIP_PAGER = videodata->_NET_WM_STATE_SKIP_PAGER;
142  Atom atoms[16];
143  int count = 0;
144 
145  /* The window manager sets this property, we shouldn't set it.
146  If we did, this would indicate to the window manager that we don't
147  actually want to be mapped during X11_XMapRaised(), which would be bad.
148  *
149  if (flags & SDL_WINDOW_HIDDEN) {
150  atoms[count++] = _NET_WM_STATE_HIDDEN;
151  }
152  */
153 
155  atoms[count++] = _NET_WM_STATE_ABOVE;
156  }
158  atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR;
159  atoms[count++] = _NET_WM_STATE_SKIP_PAGER;
160  }
162  atoms[count++] = _NET_WM_STATE_FOCUSED;
163  }
164  if (flags & SDL_WINDOW_MAXIMIZED) {
165  atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT;
166  atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
167  }
169  atoms[count++] = _NET_WM_STATE_FULLSCREEN;
170  }
171 
172  SDL_assert(count <= SDL_arraysize(atoms));
173 
174  if (count > 0) {
175  X11_XChangeProperty(display, xwindow, _NET_WM_STATE, XA_ATOM, 32,
176  PropModeReplace, (unsigned char *)atoms, count);
177  } else {
178  X11_XDeleteProperty(display, xwindow, _NET_WM_STATE);
179  }
180 }
181 
182 Uint32
183 X11_GetNetWMState(_THIS, Window xwindow)
184 {
185  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
186  Display *display = videodata->display;
187  Atom _NET_WM_STATE = videodata->_NET_WM_STATE;
188  Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN;
189  Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED;
190  Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT;
191  Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
192  Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN;
193  Atom actualType;
194  int actualFormat;
195  unsigned long i, numItems, bytesAfter;
196  unsigned char *propertyValue = NULL;
197  long maxLength = 1024;
198  Uint32 flags = 0;
199 
200  if (X11_XGetWindowProperty(display, xwindow, _NET_WM_STATE,
201  0l, maxLength, False, XA_ATOM, &actualType,
202  &actualFormat, &numItems, &bytesAfter,
203  &propertyValue) == Success) {
204  Atom *atoms = (Atom *) propertyValue;
205  int maximized = 0;
206  int fullscreen = 0;
207 
208  for (i = 0; i < numItems; ++i) {
209  if (atoms[i] == _NET_WM_STATE_HIDDEN) {
211  } else if (atoms[i] == _NET_WM_STATE_FOCUSED) {
213  } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
214  maximized |= 1;
215  } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
216  maximized |= 2;
217  } else if ( atoms[i] == _NET_WM_STATE_FULLSCREEN) {
218  fullscreen = 1;
219  }
220  }
221  if (maximized == 3) {
223  }
224 
225  if (fullscreen == 1) {
227  }
228 
229  /* If the window is unmapped, numItems will be zero and _NET_WM_STATE_HIDDEN
230  * will not be set. Do an additional check to see if the window is unmapped
231  * and mark it as SDL_WINDOW_HIDDEN if it is.
232  */
233  {
234  XWindowAttributes attr;
235  SDL_memset(&attr,0,sizeof(attr));
236  X11_XGetWindowAttributes(videodata->display, xwindow, &attr);
237  if (attr.map_state == IsUnmapped) {
239  }
240  }
241  X11_XFree(propertyValue);
242  }
243 
244  /* FIXME, check the size hints for resizable */
245  /* flags |= SDL_WINDOW_RESIZABLE; */
246 
247  return flags;
248 }
249 
250 static int
251 SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
252 {
253  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
255  int numwindows = videodata->numwindows;
256  int windowlistlength = videodata->windowlistlength;
257  SDL_WindowData **windowlist = videodata->windowlist;
258 
259  /* Allocate the window data */
260  data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
261  if (!data) {
262  return SDL_OutOfMemory();
263  }
264  data->window = window;
265  data->xwindow = w;
266 #ifdef X_HAVE_UTF8_STRING
267  if (SDL_X11_HAVE_UTF8 && videodata->im) {
268  data->ic =
269  X11_XCreateIC(videodata->im, XNClientWindow, w, XNFocusWindow, w,
270  XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
271  NULL);
272  }
273 #endif
274  data->created = created;
275  data->videodata = videodata;
276 
277  /* Associate the data with the window */
278 
279  if (numwindows < windowlistlength) {
280  windowlist[numwindows] = data;
281  videodata->numwindows++;
282  } else {
283  windowlist =
284  (SDL_WindowData **) SDL_realloc(windowlist,
285  (numwindows +
286  1) * sizeof(*windowlist));
287  if (!windowlist) {
288  SDL_free(data);
289  return SDL_OutOfMemory();
290  }
291  windowlist[numwindows] = data;
292  videodata->numwindows++;
293  videodata->windowlistlength++;
294  videodata->windowlist = windowlist;
295  }
296 
297  /* Fill in the SDL window with the window data */
298  {
299  XWindowAttributes attrib;
300 
301  X11_XGetWindowAttributes(data->videodata->display, w, &attrib);
302  window->x = attrib.x;
303  window->y = attrib.y;
304  window->w = attrib.width;
305  window->h = attrib.height;
306  if (attrib.map_state != IsUnmapped) {
307  window->flags |= SDL_WINDOW_SHOWN;
308  } else {
309  window->flags &= ~SDL_WINDOW_SHOWN;
310  }
311  data->visual = attrib.visual;
312  data->colormap = attrib.colormap;
313  }
314 
315  window->flags |= X11_GetNetWMState(_this, w);
316 
317  {
318  Window FocalWindow;
319  int RevertTo=0;
320  X11_XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
321  if (FocalWindow==w)
322  {
323  window->flags |= SDL_WINDOW_INPUT_FOCUS;
324  }
325 
326  if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
327  SDL_SetKeyboardFocus(data->window);
328  }
329 
330  if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
331  /* Tell x11 to clip mouse */
332  }
333  }
334 
335  /* All done! */
336  window->driverdata = data;
337  return 0;
338 }
339 
340 static void
341 SetWindowBordered(Display *display, int screen, Window window, SDL_bool border)
342 {
343  /*
344  * this code used to check for KWM_WIN_DECORATION, but KDE hasn't
345  * supported it for years and years. It now respects _MOTIF_WM_HINTS.
346  * Gnome is similar: just use the Motif atom.
347  */
348 
349  Atom WM_HINTS = X11_XInternAtom(display, "_MOTIF_WM_HINTS", True);
350  if (WM_HINTS != None) {
351  /* Hints used by Motif compliant window managers */
352  struct
353  {
354  unsigned long flags;
355  unsigned long functions;
356  unsigned long decorations;
357  long input_mode;
358  unsigned long status;
359  } MWMHints = {
360  (1L << 1), 0, border ? 1 : 0, 0, 0
361  };
362 
363  X11_XChangeProperty(display, window, WM_HINTS, WM_HINTS, 32,
364  PropModeReplace, (unsigned char *) &MWMHints,
365  sizeof(MWMHints) / sizeof(long));
366  } else { /* set the transient hints instead, if necessary */
367  X11_XSetTransientForHint(display, window, RootWindow(display, screen));
368  }
369 }
370 
371 int
373 {
375  SDL_DisplayData *displaydata =
377  SDL_WindowData *windowdata;
378  Display *display = data->display;
379  int screen = displaydata->screen;
380  Visual *visual;
381  int depth;
382  XSetWindowAttributes xattr;
383  Window w;
384  XSizeHints *sizehints;
385  XWMHints *wmhints;
386  XClassHint *classhints;
387  Atom _NET_WM_BYPASS_COMPOSITOR;
388  Atom _NET_WM_WINDOW_TYPE;
389  Atom wintype;
390  const char *wintype_name = NULL;
391  long compositor = 1;
392  Atom _NET_WM_PID;
393  long fevent = 0;
394 
395 #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL
396  const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID);
397 
398  if (forced_visual_id != NULL && forced_visual_id[0] != '\0')
399  {
400  XVisualInfo *vi, template;
401  int nvis;
402 
403  SDL_zero(template);
404  template.visualid = SDL_strtol(forced_visual_id, NULL, 0);
405  vi = X11_XGetVisualInfo(display, VisualIDMask, &template, &nvis);
406  if (vi) {
407  visual = vi->visual;
408  depth = vi->depth;
409  X11_XFree(vi);
410  }
411  else
412  {
413  return -1;
414  }
415  }
416  else if ((window->flags & SDL_WINDOW_OPENGL) &&
417  !SDL_getenv("SDL_VIDEO_X11_VISUALID")) {
418  XVisualInfo *vinfo = NULL;
419 
420 #if SDL_VIDEO_OPENGL_EGL
424  && ( !_this->gl_data || X11_GL_UseEGL(_this) )
425 #endif
426  ) {
427  vinfo = X11_GLES_GetVisual(_this, display, screen);
428  } else
429 #endif
430  {
431 #if SDL_VIDEO_OPENGL_GLX
432  vinfo = X11_GL_GetVisual(_this, display, screen);
433 #endif
434  }
435 
436  if (!vinfo) {
437  return -1;
438  }
439  visual = vinfo->visual;
440  depth = vinfo->depth;
441  X11_XFree(vinfo);
442  } else
443 #endif
444  {
445  visual = displaydata->visual;
446  depth = displaydata->depth;
447  }
448 
449  xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False;
450  xattr.background_pixmap = None;
451  xattr.border_pixel = 0;
452 
453  if (visual->class == DirectColor) {
454  XColor *colorcells;
455  int i;
456  int ncolors;
457  int rmax, gmax, bmax;
458  int rmask, gmask, bmask;
459  int rshift, gshift, bshift;
460 
461  xattr.colormap =
462  X11_XCreateColormap(display, RootWindow(display, screen),
463  visual, AllocAll);
464 
465  /* If we can't create a colormap, then we must die */
466  if (!xattr.colormap) {
467  return SDL_SetError("Could not create writable colormap");
468  }
469 
470  /* OK, we got a colormap, now fill it in as best as we can */
471  colorcells = SDL_malloc(visual->map_entries * sizeof(XColor));
472  if (!colorcells) {
473  return SDL_OutOfMemory();
474  }
475  ncolors = visual->map_entries;
476  rmax = 0xffff;
477  gmax = 0xffff;
478  bmax = 0xffff;
479 
480  rshift = 0;
481  rmask = visual->red_mask;
482  while (0 == (rmask & 1)) {
483  rshift++;
484  rmask >>= 1;
485  }
486 
487  gshift = 0;
488  gmask = visual->green_mask;
489  while (0 == (gmask & 1)) {
490  gshift++;
491  gmask >>= 1;
492  }
493 
494  bshift = 0;
495  bmask = visual->blue_mask;
496  while (0 == (bmask & 1)) {
497  bshift++;
498  bmask >>= 1;
499  }
500 
501  /* build the color table pixel values */
502  for (i = 0; i < ncolors; i++) {
503  Uint32 red = (rmax * i) / (ncolors - 1);
504  Uint32 green = (gmax * i) / (ncolors - 1);
505  Uint32 blue = (bmax * i) / (ncolors - 1);
506 
507  Uint32 rbits = (rmask * i) / (ncolors - 1);
508  Uint32 gbits = (gmask * i) / (ncolors - 1);
509  Uint32 bbits = (bmask * i) / (ncolors - 1);
510 
511  Uint32 pix =
512  (rbits << rshift) | (gbits << gshift) | (bbits << bshift);
513 
514  colorcells[i].pixel = pix;
515 
516  colorcells[i].red = red;
517  colorcells[i].green = green;
518  colorcells[i].blue = blue;
519 
520  colorcells[i].flags = DoRed | DoGreen | DoBlue;
521  }
522 
523  X11_XStoreColors(display, xattr.colormap, colorcells, ncolors);
524 
525  SDL_free(colorcells);
526  } else {
527  xattr.colormap =
528  X11_XCreateColormap(display, RootWindow(display, screen),
529  visual, AllocNone);
530  }
531 
532  w = X11_XCreateWindow(display, RootWindow(display, screen),
533  window->x, window->y, window->w, window->h,
534  0, depth, InputOutput, visual,
535  (CWOverrideRedirect | CWBackPixmap | CWBorderPixel |
536  CWColormap), &xattr);
537  if (!w) {
538  return SDL_SetError("Couldn't create window");
539  }
540 
541  SetWindowBordered(display, screen, w,
542  (window->flags & SDL_WINDOW_BORDERLESS) == 0);
543 
544  sizehints = X11_XAllocSizeHints();
545  /* Setup the normal size hints */
546  sizehints->flags = 0;
547  if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
548  sizehints->min_width = sizehints->max_width = window->w;
549  sizehints->min_height = sizehints->max_height = window->h;
550  sizehints->flags |= (PMaxSize | PMinSize);
551  }
552  sizehints->x = window->x;
553  sizehints->y = window->y;
554  sizehints->flags |= USPosition;
555 
556  /* Setup the input hints so we get keyboard input */
557  wmhints = X11_XAllocWMHints();
558  wmhints->input = True;
559  wmhints->window_group = data->window_group;
560  wmhints->flags = InputHint | WindowGroupHint;
561 
562  /* Setup the class hints so we can get an icon (AfterStep) */
563  classhints = X11_XAllocClassHint();
564  classhints->res_name = data->classname;
565  classhints->res_class = data->classname;
566 
567  /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */
568  X11_XSetWMProperties(display, w, NULL, NULL, NULL, 0, sizehints, wmhints, classhints);
569 
570  X11_XFree(sizehints);
571  X11_XFree(wmhints);
572  X11_XFree(classhints);
573  /* Set the PID related to the window for the given hostname, if possible */
574  if (data->pid > 0) {
575  long pid = (long) data->pid;
576  _NET_WM_PID = X11_XInternAtom(display, "_NET_WM_PID", False);
577  X11_XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,
578  (unsigned char *) &pid, 1);
579  }
580 
581  /* Set the window manager state */
583 
584  compositor = 2; /* don't disable compositing except for "normal" windows */
585 
586  if (window->flags & SDL_WINDOW_UTILITY) {
587  wintype_name = "_NET_WM_WINDOW_TYPE_UTILITY";
588  } else if (window->flags & SDL_WINDOW_TOOLTIP) {
589  wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP";
590  } else if (window->flags & SDL_WINDOW_POPUP_MENU) {
591  wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU";
592  } else {
593  wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL";
594  compositor = 1; /* disable compositing for "normal" windows */
595  }
596 
597  /* Let the window manager know what type of window we are. */
598  _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
599  wintype = X11_XInternAtom(display, wintype_name, False);
600  X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
601  PropModeReplace, (unsigned char *)&wintype, 1);
603  _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False);
604  X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
605  PropModeReplace,
606  (unsigned char *)&compositor, 1);
607  }
608 
609  {
610  Atom protocols[3];
611  int proto_count = 0;
612 
613  protocols[proto_count++] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */
614  protocols[proto_count++] = data->WM_TAKE_FOCUS; /* Since we will want to set input focus explicitly */
615 
616  /* Default to using ping if there is no hint */
618  protocols[proto_count++] = data->_NET_WM_PING; /* Respond so WM knows we're alive */
619  }
620 
621  SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0]));
622 
623  X11_XSetWMProtocols(display, w, protocols, proto_count);
624  }
625 
626  if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
627  X11_XDestroyWindow(display, w);
628  return -1;
629  }
630  windowdata = (SDL_WindowData *) window->driverdata;
631 
633  if ((window->flags & SDL_WINDOW_OPENGL) &&
637  && ( !_this->gl_data || X11_GL_UseEGL(_this) )
638 #endif
639  ) {
640 #if SDL_VIDEO_OPENGL_EGL
641  if (!_this->egl_data) {
642  return -1;
643  }
644 
645  /* Create the GLES window surface */
646  windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) w);
647 
648  if (windowdata->egl_surface == EGL_NO_SURFACE) {
649  return SDL_SetError("Could not create GLES window surface");
650  }
651 #else
652  return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
653 #endif /* SDL_VIDEO_OPENGL_EGL */
654  }
655 #endif
656 
657 
658 #ifdef X_HAVE_UTF8_STRING
659  if (SDL_X11_HAVE_UTF8 && windowdata->ic) {
660  X11_XGetICValues(windowdata->ic, XNFilterEvents, &fevent, NULL);
661  }
662 #endif
663 
665 
666  X11_XSelectInput(display, w,
667  (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
668  ExposureMask | ButtonPressMask | ButtonReleaseMask |
669  PointerMotionMask | KeyPressMask | KeyReleaseMask |
670  PropertyChangeMask | StructureNotifyMask |
671  KeymapStateMask | fevent));
672 
673  X11_XFlush(display);
674 
675  return 0;
676 }
677 
678 int
680 {
681  Window w = (Window) data;
682 
683  window->title = X11_GetWindowTitle(_this, w);
684 
685  if (SetupWindowData(_this, window, w, SDL_FALSE) < 0) {
686  return -1;
687  }
688  return 0;
689 }
690 
691 char *
692 X11_GetWindowTitle(_THIS, Window xwindow)
693 {
695  Display *display = data->display;
696  int status, real_format;
697  Atom real_type;
698  unsigned long items_read, items_left;
699  unsigned char *propdata;
700  char *title = NULL;
701 
702  status = X11_XGetWindowProperty(display, xwindow, data->_NET_WM_NAME,
703  0L, 8192L, False, data->UTF8_STRING, &real_type, &real_format,
704  &items_read, &items_left, &propdata);
705  if (status == Success && propdata) {
706  title = SDL_strdup(SDL_static_cast(char*, propdata));
707  X11_XFree(propdata);
708  } else {
709  status = X11_XGetWindowProperty(display, xwindow, XA_WM_NAME,
710  0L, 8192L, False, XA_STRING, &real_type, &real_format,
711  &items_read, &items_left, &propdata);
712  if (status == Success && propdata) {
713  title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*, propdata), items_read+1);
714  X11_XFree(propdata);
715  } else {
716  title = SDL_strdup("");
717  }
718  }
719  return title;
720 }
721 
722 void
724 {
725  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
726  Display *display = data->videodata->display;
727  XTextProperty titleprop;
728  Status status;
729  const char *title = window->title ? window->title : "";
730  char *title_locale = NULL;
731 
732 #ifdef X_HAVE_UTF8_STRING
733  Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME;
734 #endif
735 
736  title_locale = SDL_iconv_utf8_locale(title);
737  if (!title_locale) {
738  SDL_OutOfMemory();
739  return;
740  }
741 
742  status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
743  SDL_free(title_locale);
744  if (status) {
745  X11_XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME);
746  X11_XFree(titleprop.value);
747  }
748 #ifdef X_HAVE_UTF8_STRING
749  if (SDL_X11_HAVE_UTF8) {
750  status = X11_Xutf8TextListToTextProperty(display, (char **) &title, 1,
751  XUTF8StringStyle, &titleprop);
752  if (status == Success) {
753  X11_XSetTextProperty(display, data->xwindow, &titleprop,
754  _NET_WM_NAME);
755  X11_XFree(titleprop.value);
756  }
757  }
758 #endif
759 
760  X11_XFlush(display);
761 }
762 
763 void
765 {
766  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
767  Display *display = data->videodata->display;
768  Atom _NET_WM_ICON = data->videodata->_NET_WM_ICON;
769 
770  if (icon) {
771  int propsize;
772  long *propdata;
773 
774  /* Set the _NET_WM_ICON property */
776  propsize = 2 + (icon->w * icon->h);
777  propdata = SDL_malloc(propsize * sizeof(long));
778  if (propdata) {
779  int x, y;
780  Uint32 *src;
781  long *dst;
782 
783  propdata[0] = icon->w;
784  propdata[1] = icon->h;
785  dst = &propdata[2];
786  for (y = 0; y < icon->h; ++y) {
787  src = (Uint32*)((Uint8*)icon->pixels + y * icon->pitch);
788  for (x = 0; x < icon->w; ++x) {
789  *dst++ = *src++;
790  }
791  }
792  X11_XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL,
793  32, PropModeReplace, (unsigned char *) propdata,
794  propsize);
795  }
796  SDL_free(propdata);
797  } else {
798  X11_XDeleteProperty(display, data->xwindow, _NET_WM_ICON);
799  }
800  X11_XFlush(display);
801 }
802 
803 void
805 {
806  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
807  Display *display = data->videodata->display;
808  unsigned int childCount;
809  Window childReturn, root, parent;
810  Window* children;
811  XWindowAttributes attrs;
812  int orig_x, orig_y;
813  Uint32 timeout;
814 
815  X11_XSync(display, False);
816  X11_XQueryTree(display, data->xwindow, &root, &parent, &children, &childCount);
817  X11_XGetWindowAttributes(display, data->xwindow, &attrs);
818  X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display),
819  attrs.x, attrs.y, &orig_x, &orig_y, &childReturn);
820 
821  /*Attempt to move the window*/
822  X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
823 
824  /* Wait a brief time to see if the window manager decided to let this move happen.
825  If the window changes at all, even to an unexpected value, we break out. */
826  timeout = SDL_GetTicks() + 100;
827  while (SDL_TRUE) {
828  int x, y;
829  X11_XSync(display, False);
830  X11_XGetWindowAttributes(display, data->xwindow, &attrs);
831  X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display),
832  attrs.x, attrs.y, &x, &y, &childReturn);
833 
834  if ((x != orig_x) || (y != orig_y)) {
835  window->x = x;
836  window->y = y;
837  break; /* window moved, time to go. */
838  } else if ((x == window->x) && (y == window->y)) {
839  break; /* we're at the place we wanted to be anyhow, drop out. */
840  }
841 
843  break;
844  }
845 
846  SDL_Delay(10);
847  }
848 }
849 
850 void
852 {
853  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
854  Display *display = data->videodata->display;
855 
856  if (window->flags & SDL_WINDOW_RESIZABLE) {
857  XSizeHints *sizehints = X11_XAllocSizeHints();
858  long userhints;
859 
860  X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
861 
862  sizehints->min_width = window->min_w;
863  sizehints->min_height = window->min_h;
864  sizehints->flags |= PMinSize;
865 
866  X11_XSetWMNormalHints(display, data->xwindow, sizehints);
867 
868  X11_XFree(sizehints);
869 
870  /* See comment in X11_SetWindowSize. */
871  X11_XResizeWindow(display, data->xwindow, window->w, window->h);
872  X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
873  X11_XRaiseWindow(display, data->xwindow);
874  }
875 
876  X11_XFlush(display);
877 }
878 
879 void
881 {
882  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
883  Display *display = data->videodata->display;
884 
885  if (window->flags & SDL_WINDOW_RESIZABLE) {
886  XSizeHints *sizehints = X11_XAllocSizeHints();
887  long userhints;
888 
889  X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
890 
891  sizehints->max_width = window->max_w;
892  sizehints->max_height = window->max_h;
893  sizehints->flags |= PMaxSize;
894 
895  X11_XSetWMNormalHints(display, data->xwindow, sizehints);
896 
897  X11_XFree(sizehints);
898 
899  /* See comment in X11_SetWindowSize. */
900  X11_XResizeWindow(display, data->xwindow, window->w, window->h);
901  X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
902  X11_XRaiseWindow(display, data->xwindow);
903  }
904 
905  X11_XFlush(display);
906 }
907 
908 void
910 {
911  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
912  Display *display = data->videodata->display;
913  XWindowAttributes attrs;
914  int orig_w, orig_h;
915  Uint32 timeout;
916 
917  X11_XSync(display, False);
918  X11_XGetWindowAttributes(display, data->xwindow, &attrs);
919  orig_w = attrs.width;
920  orig_h = attrs.height;
921 
922  if (SDL_IsShapedWindow(window)) {
924  }
925  if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
926  /* Apparently, if the X11 Window is set to a 'non-resizable' window, you cannot resize it using the X11_XResizeWindow, thus
927  we must set the size hints to adjust the window size. */
928  XSizeHints *sizehints = X11_XAllocSizeHints();
929  long userhints;
930 
931  X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
932 
933  sizehints->min_width = sizehints->max_width = window->w;
934  sizehints->min_height = sizehints->max_height = window->h;
935  sizehints->flags |= PMinSize | PMaxSize;
936 
937  X11_XSetWMNormalHints(display, data->xwindow, sizehints);
938 
939  X11_XFree(sizehints);
940 
941  /* From Pierre-Loup:
942  WMs each have their little quirks with that. When you change the
943  size hints, they get a ConfigureNotify event with the
944  WM_NORMAL_SIZE_HINTS Atom. They all save the hints then, but they
945  don't all resize the window right away to enforce the new hints.
946 
947  Some of them resize only after:
948  - A user-initiated move or resize
949  - A code-initiated move or resize
950  - Hiding & showing window (Unmap & map)
951 
952  The following move & resize seems to help a lot of WMs that didn't
953  properly update after the hints were changed. We don't do a
954  hide/show, because there are supposedly subtle problems with doing so
955  and transitioning from windowed to fullscreen in Unity.
956  */
957  X11_XResizeWindow(display, data->xwindow, window->w, window->h);
958  X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
959  X11_XRaiseWindow(display, data->xwindow);
960  } else {
961  X11_XResizeWindow(display, data->xwindow, window->w, window->h);
962  }
963 
964  /* Wait a brief time to see if the window manager decided to let this resize happen.
965  If the window changes at all, even to an unexpected value, we break out. */
966  timeout = SDL_GetTicks() + 100;
967  while (SDL_TRUE) {
968  X11_XSync(display, False);
969  X11_XGetWindowAttributes(display, data->xwindow, &attrs);
970 
971  if ((attrs.width != orig_w) || (attrs.height != orig_h)) {
972  window->w = attrs.width;
973  window->h = attrs.height;
974  break; /* window changed, time to go. */
975  } else if ((attrs.width == window->w) && (attrs.height == window->h)) {
976  break; /* we're at the place we wanted to be anyhow, drop out. */
977  }
978 
980  break;
981  }
982 
983  SDL_Delay(10);
984  }
985 }
986 
987 int
989 {
990  SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
991 
992  *left = data->border_left;
993  *right = data->border_right;
994  *top = data->border_top;
995  *bottom = data->border_bottom;
996 
997  return 0;
998 }
999 
1000 int
1001 X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
1002 {
1003  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1004  Display *display = data->videodata->display;
1005  Atom _NET_WM_WINDOW_OPACITY = data->videodata->_NET_WM_WINDOW_OPACITY;
1006 
1007  if (opacity == 1.0f) {
1008  X11_XDeleteProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY);
1009  } else {
1010  const Uint32 FullyOpaque = 0xFFFFFFFF;
1011  const long alpha = (long) ((double)opacity * (double)FullyOpaque);
1012  X11_XChangeProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32,
1013  PropModeReplace, (unsigned char *)&alpha, 1);
1014  }
1015 
1016  return 0;
1017 }
1018 
1019 int
1020 X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window) {
1021  SDL_WindowData *data = (SDL_WindowData *) modal_window->driverdata;
1022  SDL_WindowData *parent_data = (SDL_WindowData *) parent_window->driverdata;
1023  Display *display = data->videodata->display;
1024 
1025  X11_XSetTransientForHint(display, data->xwindow, parent_data->xwindow);
1026  return 0;
1027 }
1028 
1029 int
1031 {
1032  if (X11_IsWindowMapped(_this, window)) {
1033  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1034  Display *display = data->videodata->display;
1035  X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
1036  X11_XFlush(display);
1037  return 0;
1038  }
1039  return -1;
1040 }
1041 
1042 void
1044 {
1045  const SDL_bool focused = ((window->flags & SDL_WINDOW_INPUT_FOCUS) != 0);
1046  const SDL_bool visible = ((window->flags & SDL_WINDOW_HIDDEN) == 0);
1047  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1048  SDL_DisplayData *displaydata =
1050  Display *display = data->videodata->display;
1051  XEvent event;
1052 
1053  SetWindowBordered(display, displaydata->screen, data->xwindow, bordered);
1054  X11_XFlush(display);
1055 
1056  if (visible) {
1057  XWindowAttributes attr;
1058  do {
1059  X11_XSync(display, False);
1060  X11_XGetWindowAttributes(display, data->xwindow, &attr);
1061  } while (attr.map_state != IsViewable);
1062 
1063  if (focused) {
1064  X11_XSetInputFocus(display, data->xwindow, RevertToParent, CurrentTime);
1065  }
1066  }
1067 
1068  /* make sure these don't make it to the real event queue if they fired here. */
1069  X11_XSync(display, False);
1070  X11_XCheckIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
1071  X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
1072 }
1073 
1074 void
1076 {
1077  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1078  Display *display = data->videodata->display;
1079 
1080  XSizeHints *sizehints = X11_XAllocSizeHints();
1081  long userhints;
1082 
1083  X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
1084 
1085  if (resizable) {
1086  /* FIXME: Is there a better way to get max window size from X? -flibit */
1087  const int maxsize = 0x7FFFFFFF;
1088  sizehints->min_width = window->min_w;
1089  sizehints->min_height = window->min_h;
1090  sizehints->max_width = (window->max_w == 0) ? maxsize : window->max_w;
1091  sizehints->max_height = (window->max_h == 0) ? maxsize : window->max_h;
1092  } else {
1093  sizehints->min_width = window->w;
1094  sizehints->min_height = window->h;
1095  sizehints->max_width = window->w;
1096  sizehints->max_height = window->h;
1097  }
1098  sizehints->flags |= PMinSize | PMaxSize;
1099 
1100  X11_XSetWMNormalHints(display, data->xwindow, sizehints);
1101 
1102  X11_XFree(sizehints);
1103 
1104  /* See comment in X11_SetWindowSize. */
1105  X11_XResizeWindow(display, data->xwindow, window->w, window->h);
1106  X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
1107  X11_XRaiseWindow(display, data->xwindow);
1108 
1109  X11_XFlush(display);
1110 }
1111 
1112 void
1114 {
1115  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1116  Display *display = data->videodata->display;
1117  XEvent event;
1118 
1119  if (!X11_IsWindowMapped(_this, window)) {
1120  X11_XMapRaised(display, data->xwindow);
1121  /* Blocking wait for "MapNotify" event.
1122  * We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type,
1123  * and XCheckTypedWindowEvent doesn't block */
1124  if(!(window->flags & SDL_WINDOW_FOREIGN))
1125  X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
1126  X11_XFlush(display);
1127  }
1128 
1129  if (!data->videodata->net_wm) {
1130  /* no WM means no FocusIn event, which confuses us. Force it. */
1131  X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
1132  X11_XFlush(display);
1133  }
1134 }
1135 
1136 void
1138 {
1139  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1141  Display *display = data->videodata->display;
1142  XEvent event;
1143 
1144  if (X11_IsWindowMapped(_this, window)) {
1145  X11_XWithdrawWindow(display, data->xwindow, displaydata->screen);
1146  /* Blocking wait for "UnmapNotify" event */
1147  if(!(window->flags & SDL_WINDOW_FOREIGN))
1148  X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
1149  X11_XFlush(display);
1150  }
1151 }
1152 
1153 static void
1154 SetWindowActive(_THIS, SDL_Window * window)
1155 {
1156  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1157  SDL_DisplayData *displaydata =
1159  Display *display = data->videodata->display;
1160  Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW;
1161 
1162  if (X11_IsWindowMapped(_this, window)) {
1163  XEvent e;
1164 
1165  /*printf("SDL Window %p: sending _NET_ACTIVE_WINDOW with timestamp %lu\n", window, data->user_time);*/
1166 
1167  SDL_zero(e);
1168  e.xany.type = ClientMessage;
1169  e.xclient.message_type = _NET_ACTIVE_WINDOW;
1170  e.xclient.format = 32;
1171  e.xclient.window = data->xwindow;
1172  e.xclient.data.l[0] = 1; /* source indication. 1 = application */
1173  e.xclient.data.l[1] = data->user_time;
1174  e.xclient.data.l[2] = 0;
1175 
1176  X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
1177  SubstructureNotifyMask | SubstructureRedirectMask, &e);
1178 
1179  X11_XFlush(display);
1180  }
1181 }
1182 
1183 void
1185 {
1186  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1187  Display *display = data->videodata->display;
1188 
1189  X11_XRaiseWindow(display, data->xwindow);
1190  SetWindowActive(_this, window);
1191  X11_XFlush(display);
1192 }
1193 
1194 static void
1195 SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
1196 {
1197  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1198  SDL_DisplayData *displaydata =
1200  Display *display = data->videodata->display;
1201  Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
1202  Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
1203  Atom _NET_WM_STATE_MAXIMIZED_HORZ = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
1204 
1205  if (maximized) {
1206  window->flags |= SDL_WINDOW_MAXIMIZED;
1207  } else {
1208  window->flags &= ~SDL_WINDOW_MAXIMIZED;
1209  }
1210 
1211  if (X11_IsWindowMapped(_this, window)) {
1212  XEvent e;
1213 
1214  SDL_zero(e);
1215  e.xany.type = ClientMessage;
1216  e.xclient.message_type = _NET_WM_STATE;
1217  e.xclient.format = 32;
1218  e.xclient.window = data->xwindow;
1219  e.xclient.data.l[0] =
1220  maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
1221  e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT;
1222  e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ;
1223  e.xclient.data.l[3] = 0l;
1224 
1225  X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
1226  SubstructureNotifyMask | SubstructureRedirectMask, &e);
1227  } else {
1228  X11_SetNetWMState(_this, data->xwindow, window->flags);
1229  }
1230  X11_XFlush(display);
1231 }
1232 
1233 void
1235 {
1236  SetWindowMaximized(_this, window, SDL_TRUE);
1237 }
1238 
1239 void
1241 {
1242  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1243  SDL_DisplayData *displaydata =
1245  Display *display = data->videodata->display;
1246 
1247  X11_XIconifyWindow(display, data->xwindow, displaydata->screen);
1248  X11_XFlush(display);
1249 }
1250 
1251 void
1253 {
1254  SetWindowMaximized(_this, window, SDL_FALSE);
1256  SetWindowActive(_this, window);
1257 }
1258 
1259 /* This asks the Window Manager to handle fullscreen for us. This is the modern way. */
1260 static void
1261 X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen)
1262 {
1263  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1264  SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
1265  Display *display = data->videodata->display;
1266  Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
1267  Atom _NET_WM_STATE_FULLSCREEN = data->videodata->_NET_WM_STATE_FULLSCREEN;
1268 
1269  if (X11_IsWindowMapped(_this, window)) {
1270  XEvent e;
1271 
1272  if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
1273  /* Compiz refuses fullscreen toggle if we're not resizable, so update the hints so we
1274  can be resized to the fullscreen resolution (or reset so we're not resizable again) */
1275  XSizeHints *sizehints = X11_XAllocSizeHints();
1276  long flags = 0;
1277  X11_XGetWMNormalHints(display, data->xwindow, sizehints, &flags);
1278  /* set the resize flags on */
1279  if (fullscreen) {
1280  /* we are going fullscreen so turn the flags off */
1281  sizehints->flags &= ~(PMinSize | PMaxSize);
1282  } else {
1283  /* Reset the min/max width height to make the window non-resizable again */
1284  sizehints->flags |= PMinSize | PMaxSize;
1285  sizehints->min_width = sizehints->max_width = window->windowed.w;
1286  sizehints->min_height = sizehints->max_height = window->windowed.h;
1287  }
1288  X11_XSetWMNormalHints(display, data->xwindow, sizehints);
1289  X11_XFree(sizehints);
1290  }
1291 
1292  SDL_zero(e);
1293  e.xany.type = ClientMessage;
1294  e.xclient.message_type = _NET_WM_STATE;
1295  e.xclient.format = 32;
1296  e.xclient.window = data->xwindow;
1297  e.xclient.data.l[0] =
1298  fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
1299  e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN;
1300  e.xclient.data.l[3] = 0l;
1301 
1302  X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
1303  SubstructureNotifyMask | SubstructureRedirectMask, &e);
1304 
1305  /* Fullscreen windows sometimes end up being marked maximized by
1306  window managers. Force it back to how we expect it to be. */
1307  if (!fullscreen && ((window->flags & SDL_WINDOW_MAXIMIZED) == 0)) {
1308  SDL_zero(e);
1309  e.xany.type = ClientMessage;
1310  e.xclient.message_type = _NET_WM_STATE;
1311  e.xclient.format = 32;
1312  e.xclient.window = data->xwindow;
1313  e.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
1314  e.xclient.data.l[1] = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
1315  e.xclient.data.l[2] = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
1316  e.xclient.data.l[3] = 0l;
1317  X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
1318  SubstructureNotifyMask | SubstructureRedirectMask, &e);
1319  }
1320  } else {
1321  Uint32 flags;
1322 
1323  flags = window->flags;
1324  if (fullscreen) {
1326  } else {
1328  }
1329  X11_SetNetWMState(_this, data->xwindow, flags);
1330  }
1331 
1332  if (data->visual->class == DirectColor) {
1333  if ( fullscreen ) {
1334  X11_XInstallColormap(display, data->colormap);
1335  } else {
1336  X11_XUninstallColormap(display, data->colormap);
1337  }
1338  }
1339 
1340  X11_XFlush(display);
1341 }
1342 
1343 /* This handles fullscreen itself, outside the Window Manager. */
1344 static void
1345 X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display)
1346 {
1347  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1348  SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
1349  Visual *visual = data->visual;
1350  Display *display = data->videodata->display;
1351  const int screen = displaydata->screen;
1352  Window root = RootWindow(display, screen);
1353  const int def_vis = (visual == DefaultVisual(display, screen));
1354  unsigned long xattrmask = 0;
1355  XSetWindowAttributes xattr;
1356  XEvent ev;
1357  SDL_Rect rect;
1358 
1359  if ( data->fswindow ) {
1360  return; /* already fullscreen, I hope. */
1361  }
1362 
1363  X11_GetDisplayBounds(_this, _display, &rect);
1364 
1365  SDL_zero(xattr);
1366  xattr.override_redirect = True;
1367  xattrmask |= CWOverrideRedirect;
1368  xattr.background_pixel = def_vis ? BlackPixel(display, screen) : 0;
1369  xattrmask |= CWBackPixel;
1370  xattr.border_pixel = 0;
1371  xattrmask |= CWBorderPixel;
1372  xattr.colormap = data->colormap;
1373  xattrmask |= CWColormap;
1374 
1375  data->fswindow = X11_XCreateWindow(display, root,
1376  rect.x, rect.y, rect.w, rect.h, 0,
1377  displaydata->depth, InputOutput,
1378  visual, xattrmask, &xattr);
1379 
1380  X11_XSelectInput(display, data->fswindow, StructureNotifyMask);
1381  X11_XSetWindowBackground(display, data->fswindow, 0);
1382  X11_XInstallColormap(display, data->colormap);
1383  X11_XClearWindow(display, data->fswindow);
1384  X11_XMapRaised(display, data->fswindow);
1385 
1386  /* Make sure the fswindow is in view by warping mouse to the corner */
1387  X11_XUngrabPointer(display, CurrentTime);
1388  X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
1389 
1390  /* Wait to be mapped, filter Unmap event out if it arrives. */
1391  X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->fswindow);
1392  X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->fswindow);
1393 
1394 #if SDL_VIDEO_DRIVER_X11_XVIDMODE
1395  if ( displaydata->use_vidmode ) {
1396  X11_XF86VidModeLockModeSwitch(display, screen, True);
1397  }
1398 #endif
1399 
1400  SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE);
1401 
1402  /* Center actual window within our cover-the-screen window. */
1403  X11_XReparentWindow(display, data->xwindow, data->fswindow,
1404  (rect.w - window->w) / 2, (rect.h - window->h) / 2);
1405 
1406  /* Move the mouse to the upper left to make sure it's on-screen */
1407  X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
1408 
1409  /* Center mouse in the fullscreen window. */
1410  rect.x += (rect.w / 2);
1411  rect.y += (rect.h / 2);
1412  X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
1413 
1414  /* Wait to be mapped, filter Unmap event out if it arrives. */
1415  X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
1416  X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow);
1417 
1419 }
1420 
1421 static void
1422 X11_EndWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display)
1423 {
1424  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1425  SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
1426  Display *display = data->videodata->display;
1427  const int screen = displaydata->screen;
1428  Window root = RootWindow(display, screen);
1429  Window fswindow = data->fswindow;
1430  XEvent ev;
1431 
1432  if (!data->fswindow) {
1433  return; /* already not fullscreen, I hope. */
1434  }
1435 
1436  data->fswindow = None;
1437 
1438 #if SDL_VIDEO_DRIVER_X11_VIDMODE
1439  if ( displaydata->use_vidmode ) {
1440  X11_XF86VidModeLockModeSwitch(display, screen, False);
1441  }
1442 #endif
1443 
1445 
1446  X11_XReparentWindow(display, data->xwindow, root, window->x, window->y);
1447 
1448  /* flush these events so they don't confuse normal event handling */
1449  X11_XSync(display, False);
1450  X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
1451  X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow);
1452 
1453  SetWindowBordered(display, screen, data->xwindow,
1454  (window->flags & SDL_WINDOW_BORDERLESS) == 0);
1455 
1456  X11_XWithdrawWindow(display, fswindow, screen);
1457 
1458  /* Wait to be unmapped. */
1459  X11_XIfEvent(display, &ev, &isUnmapNotify, (XPointer)&fswindow);
1460  X11_XDestroyWindow(display, fswindow);
1461 }
1462 
1463 
1464 void
1466 {
1467  /* !!! FIXME: SDL_Hint? */
1468  SDL_bool legacy = SDL_FALSE;
1469  const char *env = SDL_getenv("SDL_VIDEO_X11_LEGACY_FULLSCREEN");
1470  if (env) {
1471  legacy = SDL_atoi(env);
1472  } else {
1473  SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
1474  SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
1475  if ( displaydata->use_vidmode ) {
1476  legacy = SDL_TRUE; /* the new stuff only works with XRandR. */
1477  } else if ( !videodata->net_wm ) {
1478  legacy = SDL_TRUE; /* The window manager doesn't support it */
1479  } else {
1480  /* !!! FIXME: look at the window manager name, and blacklist certain ones? */
1481  /* http://stackoverflow.com/questions/758648/find-the-name-of-the-x-window-manager */
1482  legacy = SDL_FALSE; /* try the new way. */
1483  }
1484  }
1485 
1486  if (legacy) {
1487  if (fullscreen) {
1488  X11_BeginWindowFullscreenLegacy(_this, window, _display);
1489  } else {
1490  X11_EndWindowFullscreenLegacy(_this, window, _display);
1491  }
1492  } else {
1493  X11_SetWindowFullscreenViaWM(_this, window, _display, fullscreen);
1494  }
1495 }
1496 
1497 
1498 int
1500 {
1501  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1502  Display *display = data->videodata->display;
1503  Visual *visual = data->visual;
1504  Colormap colormap = data->colormap;
1505  XColor *colorcells;
1506  int ncolors;
1507  int rmask, gmask, bmask;
1508  int rshift, gshift, bshift;
1509  int i;
1510 
1511  if (visual->class != DirectColor) {
1512  return SDL_SetError("Window doesn't have DirectColor visual");
1513  }
1514 
1515  ncolors = visual->map_entries;
1516  colorcells = SDL_malloc(ncolors * sizeof(XColor));
1517  if (!colorcells) {
1518  return SDL_OutOfMemory();
1519  }
1520 
1521  rshift = 0;
1522  rmask = visual->red_mask;
1523  while (0 == (rmask & 1)) {
1524  rshift++;
1525  rmask >>= 1;
1526  }
1527 
1528  gshift = 0;
1529  gmask = visual->green_mask;
1530  while (0 == (gmask & 1)) {
1531  gshift++;
1532  gmask >>= 1;
1533  }
1534 
1535  bshift = 0;
1536  bmask = visual->blue_mask;
1537  while (0 == (bmask & 1)) {
1538  bshift++;
1539  bmask >>= 1;
1540  }
1541 
1542  /* build the color table pixel values */
1543  for (i = 0; i < ncolors; i++) {
1544  Uint32 rbits = (rmask * i) / (ncolors - 1);
1545  Uint32 gbits = (gmask * i) / (ncolors - 1);
1546  Uint32 bbits = (bmask * i) / (ncolors - 1);
1547  Uint32 pix = (rbits << rshift) | (gbits << gshift) | (bbits << bshift);
1548 
1549  colorcells[i].pixel = pix;
1550 
1551  colorcells[i].red = ramp[(0 * 256) + i];
1552  colorcells[i].green = ramp[(1 * 256) + i];
1553  colorcells[i].blue = ramp[(2 * 256) + i];
1554 
1555  colorcells[i].flags = DoRed | DoGreen | DoBlue;
1556  }
1557 
1558  X11_XStoreColors(display, colormap, colorcells, ncolors);
1559  X11_XFlush(display);
1560  SDL_free(colorcells);
1561 
1562  return 0;
1563 }
1564 
1565 void
1567 {
1568  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1569  Display *display = data->videodata->display;
1570  SDL_bool oldstyle_fullscreen;
1571  SDL_bool grab_keyboard;
1572 
1573  /* ICCCM2.0-compliant window managers can handle fullscreen windows
1574  If we're using XVidMode to change resolution we need to confine
1575  the cursor so we don't pan around the virtual desktop.
1576  */
1577  oldstyle_fullscreen = X11_IsWindowLegacyFullscreen(_this, window);
1578 
1579  if (oldstyle_fullscreen || grabbed) {
1580  /* Try to grab the mouse */
1581  if (!data->videodata->broken_pointer_grab) {
1582  const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask;
1583  int attempts;
1584  int result;
1585 
1586  /* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */
1587  for (attempts = 0; attempts < 100; attempts++) {
1588  result = X11_XGrabPointer(display, data->xwindow, True, mask, GrabModeAsync,
1589  GrabModeAsync, data->xwindow, None, CurrentTime);
1590  if (result == GrabSuccess) {
1591  break;
1592  }
1593  SDL_Delay(50);
1594  }
1595 
1596  if (result != GrabSuccess) {
1597  SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "The X server refused to let us grab the mouse. You might experience input bugs.");
1598  data->videodata->broken_pointer_grab = SDL_TRUE; /* don't try again. */
1599  }
1600  }
1601 
1602  /* Raise the window if we grab the mouse */
1603  X11_XRaiseWindow(display, data->xwindow);
1604 
1605  /* Now grab the keyboard */
1607  grab_keyboard = SDL_TRUE;
1608  } else {
1609  /* We need to do this with the old style override_redirect
1610  fullscreen window otherwise we won't get keyboard focus.
1611  */
1612  grab_keyboard = oldstyle_fullscreen;
1613  }
1614  if (grab_keyboard) {
1615  X11_XGrabKeyboard(display, data->xwindow, True, GrabModeAsync,
1616  GrabModeAsync, CurrentTime);
1617  }
1618  } else {
1619  X11_XUngrabPointer(display, CurrentTime);
1620  X11_XUngrabKeyboard(display, CurrentTime);
1621  }
1622  X11_XSync(display, False);
1623 }
1624 
1625 void
1627 {
1628  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1629 
1630  if (data) {
1631  SDL_VideoData *videodata = (SDL_VideoData *) data->videodata;
1632  Display *display = videodata->display;
1633  int numwindows = videodata->numwindows;
1634  SDL_WindowData **windowlist = videodata->windowlist;
1635  int i;
1636 
1637  if (windowlist) {
1638  for (i = 0; i < numwindows; ++i) {
1639  if (windowlist[i] && (windowlist[i]->window == window)) {
1640  windowlist[i] = windowlist[numwindows - 1];
1641  windowlist[numwindows - 1] = NULL;
1642  videodata->numwindows--;
1643  break;
1644  }
1645  }
1646  }
1647 #ifdef X_HAVE_UTF8_STRING
1648  if (data->ic) {
1649  X11_XDestroyIC(data->ic);
1650  }
1651 #endif
1652  if (data->created) {
1653  X11_XDestroyWindow(display, data->xwindow);
1654  X11_XFlush(display);
1655  }
1656  SDL_free(data);
1657  }
1658  window->driverdata = NULL;
1659 }
1660 
1661 SDL_bool
1663 {
1664  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1665  Display *display = data->videodata->display;
1666 
1667  if (info->version.major == SDL_MAJOR_VERSION &&
1668  info->version.minor == SDL_MINOR_VERSION) {
1669  info->subsystem = SDL_SYSWM_X11;
1670  info->info.x11.display = display;
1671  info->info.x11.window = data->xwindow;
1672  return SDL_TRUE;
1673  } else {
1674  SDL_SetError("Application not compiled with SDL %d.%d",
1676  return SDL_FALSE;
1677  }
1678 }
1679 
1680 int
1682 {
1683  return 0; /* just succeed, the real work is done elsewhere. */
1684 }
1685 
1686 void
1688 {
1689  SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
1690  Display *display = data->videodata->display;
1691  Atom XdndAware = X11_XInternAtom(display, "XdndAware", False);
1692 
1693  if (accept) {
1694  Atom xdnd_version = 5;
1695  X11_XChangeProperty(display, data->xwindow, XdndAware, XA_ATOM, 32,
1696  PropModeReplace, (unsigned char*)&xdnd_version, 1);
1697  } else {
1698  X11_XDeleteProperty(display, data->xwindow, XdndAware);
1699  }
1700 }
1701 
1702 #endif /* SDL_VIDEO_DRIVER_X11 */
1703 
1704 /* vi: set ts=4 sw=4 expandtab: */
SDL_VideoData::net_wm
SDL_bool net_wm
Definition: SDL_x11video.h:89
X11_MaximizeWindow
void X11_MaximizeWindow(_THIS, SDL_Window *window)
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:418
X11_DestroyWindow
void X11_DestroyWindow(_THIS, SDL_Window *window)
SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL
Definition: SDL_config.h:382
SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
Definition: SDL_hints.h:245
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
X11_SetWindowIcon
void X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
X11_MinimizeWindow
void X11_MinimizeWindow(_THIS, SDL_Window *window)
screen
SDL_Renderer * screen
Definition: testgamecontroller.c:64
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:389
SDL_VideoData::_NET_WM_STATE_ABOVE
Atom _NET_WM_STATE_ABOVE
Definition: SDL_x11video.h:101
SDL_static_cast
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:138
right
GLdouble GLdouble right
Definition: SDL_opengl_glext.h:6106
SDL_x11video.h
SDL_WindowData::border_left
int border_left
Definition: SDL_x11window.h:59
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:660
SDL_x11mouse.h
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:70
SDL_WINDOW_ALWAYS_ON_TOP
@ SDL_WINDOW_ALWAYS_ON_TOP
Definition: SDL_video.h:116
if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
Definition: pixman-arm-neon-asm.h:469
SDL_VIDEO_OPENGL_GLX
#define SDL_VIDEO_OPENGL_GLX
Definition: SDL_config.h:383
SDL_IsShapedWindow
#define SDL_IsShapedWindow
Definition: SDL_dynapi_overrides.h:371
NULL
#define NULL
Definition: begin_code.h:167
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:320
SDL_timer.h
endif
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
Definition: pixman-arm-neon-asm.h:549
timeout
GLbitfield GLuint64 timeout
Definition: SDL_opengl_glext.h:1486
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:76
NativeWindowType
EGLNativeWindowType NativeWindowType
Definition: eglplatform.h:112
SDL_SysWMinfo
Definition: SDL_syswm.h:201
dpy
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display dpy)
Definition: SDL_x11sym.h:44
SDL_log.h
SDL_Surface::w
int w
Definition: SDL_surface.h:74
SDL_WindowData
Definition: SDL_androidwindow.h:38
SDL_x11shape.h
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
SDL_version::minor
Uint8 minor
Definition: SDL_version.h:54
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1110
X11_SetWindowHitTest
int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
SDL_WINDOW_FULLSCREEN
@ SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:99
X11_RestoreWindow
void X11_RestoreWindow(_THIS, SDL_Window *window)
SDL_WINDOW_OPENGL
@ SDL_WINDOW_OPENGL
Definition: SDL_video.h:100
SDL_VideoDevice::gl_data
struct SDL_GLDriverData * gl_data
Definition: SDL_sysvideo.h:390
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:376
top
GLdouble GLdouble GLdouble GLdouble top
Definition: SDL_opengl_glext.h:6106
X11_GetWindowBordersSize
int X11_GetWindowBordersSize(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right)
red
const GLubyte GLuint red
Definition: SDL_glfuncs.h:80
SDL_VideoData::windowlistlength
int windowlistlength
Definition: SDL_x11video.h:84
SDL_SetKeyboardFocus
void SDL_SetKeyboardFocus(SDL_Window *window)
Definition: SDL_keyboard.c:630
SDL_WINDOW_FOREIGN
@ SDL_WINDOW_FOREIGN
Definition: SDL_video.h:111
SDL_iconv_utf8_locale
#define SDL_iconv_utf8_locale(S)
Definition: SDL_stdinc.h:571
SDL_VideoDevice::profile_mask
int profile_mask
Definition: SDL_sysvideo.h:354
SDL_WINDOW_MAXIMIZED
@ SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:106
bottom
GLint GLint bottom
Definition: SDL_opengl_glext.h:1952
X11_SetWindowMinimumSize
void X11_SetWindowMinimumSize(_THIS, SDL_Window *window)
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:191
SDL_HINT_VIDEO_X11_WINDOW_VISUALID
#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID
A variable forcing the visual ID chosen for new X11 windows.
Definition: SDL_hints.h:219
SDL_VideoData::windowlist
SDL_WindowData ** windowlist
Definition: SDL_x11video.h:83
SDL_Rect::x
int x
Definition: SDL_rect.h:79
X11_GetWindowWMInfo
SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
X11_SetWindowOpacity
int X11_SetWindowOpacity(_THIS, SDL_Window *window, float opacity)
SDL_WINDOW_INPUT_FOCUS
@ SDL_WINDOW_INPUT_FOCUS
Definition: SDL_video.h:108
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
SDL_WINDOW_RESIZABLE
@ SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:104
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_Rect::w
int w
Definition: SDL_rect.h:80
X11_HideWindow
void X11_HideWindow(_THIS, SDL_Window *window)
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:74
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:415
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
SDL_Surface::pitch
int pitch
Definition: SDL_surface.h:75
X11_GetWindowTitle
char * X11_GetWindowTitle(_THIS, Window xwindow)
SDL_VIDEO_OPENGL_ES
#define SDL_VIDEO_OPENGL_ES
Definition: SDL_config_android.h:159
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@255 gl_config
X11_SetWindowInputFocus
int X11_SetWindowInputFocus(_THIS, SDL_Window *window)
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
SDL_WINDOW_POPUP_MENU
@ SDL_WINDOW_POPUP_MENU
Definition: SDL_video.h:120
SDL_GetHintBoolean
#define SDL_GetHintBoolean
Definition: SDL_dynapi_overrides.h:608
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2652
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_VideoData::numwindows
int numwindows
Definition: SDL_x11video.h:82
SDL_SysWMinfo::x11
struct SDL_SysWMinfo::@10::@11 x11
X11_SetWindowPosition
void X11_SetWindowPosition(_THIS, SDL_Window *window)
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:121
SDL_MINOR_VERSION
#define SDL_MINOR_VERSION
Definition: SDL_version.h:61
SDL_VideoData::_NET_WM_STATE_MAXIMIZED_HORZ
Atom _NET_WM_STATE_MAXIMIZED_HORZ
Definition: SDL_x11video.h:99
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_SysWMinfo::subsystem
SDL_SYSWM_TYPE subsystem
Definition: SDL_syswm.h:204
SDL_HINT_GRAB_KEYBOARD
#define SDL_HINT_GRAB_KEYBOARD
A variable controlling whether grabbing input grabs the keyboard.
Definition: SDL_hints.h:295
X11_ShowWindow
void X11_ShowWindow(_THIS, SDL_Window *window)
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
EGL_NO_SURFACE
#define EGL_NO_SURFACE
Definition: egl.h:100
SDL_Rect::y
int y
Definition: SDL_rect.h:79
SDL_Rect::h
int h
Definition: SDL_rect.h:80
X11_SetWindowModalFor
int X11_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_window)
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
SDL_VideoData::im
XIM im
Definition: SDL_x11video.h:80
SDL_VideoData::_NET_WM_STATE_SKIP_TASKBAR
Atom _NET_WM_STATE_SKIP_TASKBAR
Definition: SDL_x11video.h:102
X11_SetWindowTitle
void X11_SetWindowTitle(_THIS, SDL_Window *window)
SDL_SYSWM_X11
@ SDL_SYSWM_X11
Definition: SDL_syswm.h:126
SDL_VideoData::_NET_WM_STATE_HIDDEN
Atom _NET_WM_STATE_HIDDEN
Definition: SDL_x11video.h:96
SDL_HINT_VIDEO_X11_NET_WM_PING
#define SDL_HINT_VIDEO_X11_NET_WM_PING
A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
Definition: SDL_hints.h:233
SDL_strtol
#define SDL_strtol
Definition: SDL_dynapi_overrides.h:412
SDL_VideoData::_NET_WM_STATE_MAXIMIZED_VERT
Atom _NET_WM_STATE_MAXIMIZED_VERT
Definition: SDL_x11video.h:98
rect
SDL_Rect rect
Definition: testrelative.c:27
X11_AcceptDragAndDrop
void X11_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept)
SDL_GL_CONTEXT_PROFILE_ES
@ SDL_GL_CONTEXT_PROFILE_ES
Definition: SDL_video.h:232
SDL_WINDOW_TOOLTIP
@ SDL_WINDOW_TOOLTIP
Definition: SDL_video.h:119
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
X11_SetWindowResizable
void X11_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
SDL_assert.h
SDL_GetTicks
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
X11_RaiseWindow
void X11_RaiseWindow(_THIS, SDL_Window *window)
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
SDL_UpdateWindowGrab
void SDL_UpdateWindowGrab(SDL_Window *window)
Definition: SDL_video.c:2541
SDL_WINDOW_INPUT_GRABBED
@ SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:107
X11_SetWindowBordered
void X11_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
SDL_Delay
#define SDL_Delay
Definition: SDL_dynapi_overrides.h:486
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:251
blue
GLbyte GLbyte blue
Definition: SDL_opengl_glext.h:382
green
GLbyte green
Definition: SDL_opengl_glext.h:382
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
depth
GLint GLint GLsizei GLsizei GLsizei depth
Definition: SDL_opengl.h:1572
SDL_WINDOW_SHOWN
@ SDL_WINDOW_SHOWN
Definition: SDL_video.h:101
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:140
SDL_DisplayData
Definition: SDL_cocoamodes.h:26
SDL_x11opengles.h
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDevice::flags
int flags
Definition: SDL_sysvideo.h:353
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_WINDOW_UTILITY
@ SDL_WINDOW_UTILITY
Definition: SDL_video.h:118
SDL_HINT_VIDEO_X11_FORCE_EGL
#define SDL_HINT_VIDEO_X11_FORCE_EGL
A variable controlling whether X11 should use GLX or EGL by default.
Definition: SDL_hints.h:256
SDL_VideoData::_NET_WM_ALLOWED_ACTIONS
Atom _NET_WM_ALLOWED_ACTIONS
Definition: SDL_x11video.h:104
action
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF lsl PF lsl PF lsl PF endif SIZE macro preload_middle scratch_holds_offset if bpp if else PF PF endif endif endif endm macro preload_trailing base if bpp if bpp *pix_per_block PF PF lsl PF PF PF PF PF else PF lsl PF lsl PF PF PF PF PF base if bpp if narrow_case &&bpp<=dst_w_bpp) PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, LSL #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 90f PF pld,[WK1]90:.else PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, lsl #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 92f91:PF add, WK0, WK0, #32 PF cmp, WK0, WK1 PF pld,[WK0] PF bne, 91b92:.endif .endif.endm.macro conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx process_head cond, numbytes, firstreg, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond X, X, #8 *numbytes/dst_w_bpp .endif process_tail cond, numbytes, firstreg .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst cond, numbytes, firstreg, DST .endif.endm.macro conditional_process1 cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_BRANCH_OVER .ifc cond, mi bpl 100f .endif .ifc cond, cs bcc 100f .endif .ifc cond, ne beq 100f .endif conditional_process1_helper, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx100:.else conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .endif.endm.macro conditional_process2 test, cond1, cond2, process_head, process_tail, numbytes1, numbytes2, firstreg1, firstreg2, unaligned_src, unaligned_mask, decrementx .if(flags) &(FLAG_DST_READWRITE|FLAG_BRANCH_OVER|FLAG_PROCESS_CORRUPTS_PSR|FLAG_PROCESS_DOES_STORE) test conditional_process1 cond1, process_head, process_tail, numbytes1, firstreg1, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_PROCESS_CORRUPTS_PSR test .endif conditional_process1 cond2, process_head, process_tail, numbytes2, firstreg2, unaligned_src, unaligned_mask, decrementx .else test process_head cond1, numbytes1, firstreg1, unaligned_src, unaligned_mask, 0 process_head cond2, numbytes2, firstreg2, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond1 X, X, #8 *numbytes1/dst_w_bpp sub &cond2 X, X, #8 *numbytes2/dst_w_bpp .endif process_tail cond1, numbytes1, firstreg1 process_tail cond2, numbytes2, firstreg2 pixst cond1, numbytes1, firstreg1, DST pixst cond2, numbytes2, firstreg2, DST .endif.endm.macro test_bits_1_0_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-1 .else movs SCRATCH, WK0, lsl #32-1 .endif.endm.macro test_bits_3_2_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-3 .else movs SCRATCH, WK0, lsl #32-3 .endif.endm.macro leading_15bytes process_head, process_tail .set DECREMENT_X, 1 .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 .set DECREMENT_X, 0 sub X, X, WK0, lsr #dst_bpp_shift str X,[sp, #LINE_SAVED_REG_COUNT *4] mov X, WK0 .endif .if dst_w_bpp==8 conditional_process2 test_bits_1_0_ptr, mi, cs, process_head, process_tail, 1, 2, 1, 2, 1, 1, DECREMENT_X .elseif dst_w_bpp==16 test_bits_1_0_ptr conditional_process1 cs, process_head, process_tail, 2, 2, 1, 1, DECREMENT_X .endif conditional_process2 test_bits_3_2_ptr, mi, cs, process_head, process_tail, 4, 8, 1, 2, 1, 1, DECREMENT_X .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 ldr X,[sp, #LINE_SAVED_REG_COUNT *4] .endif.endm.macro test_bits_3_2_pix movs SCRATCH, X, lsl #dst_bpp_shift+32-3.endm.macro test_bits_1_0_pix .if dst_w_bpp==8 movs SCRATCH, X, lsl #dst_bpp_shift+32-1 .else movs SCRATCH, X, lsr #1 .endif.endm.macro trailing_15bytes process_head, process_tail, unaligned_src, unaligned_mask conditional_process2 test_bits_3_2_pix, cs, mi, process_head, process_tail, 8, 4, 0, 2, unaligned_src, unaligned_mask, 0 .if dst_w_bpp==16 test_bits_1_0_pix conditional_process1 cs, process_head, process_tail, 2, 0, unaligned_src, unaligned_mask, 0 .elseif dst_w_bpp==8 conditional_process2 test_bits_1_0_pix, cs, mi, process_head, process_tail, 2, 1, 0, 1, unaligned_src, unaligned_mask, 0 .endif.endm.macro wide_case_inner_loop process_head, process_tail, unaligned_src, unaligned_mask, dst_alignment110:.set SUBBLOCK, 0 .rept pix_per_block *dst_w_bpp/128 process_head, 16, 0, unaligned_src, unaligned_mask, 1 .if(src_bpp > 0) &&(mask_bpp==0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle src_bpp, SRC, 1 .elseif(src_bpp==0) &&(mask_bpp > 0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle mask_bpp, MASK, 1 .else preload_middle src_bpp, SRC, 0 preload_middle mask_bpp, MASK, 0 .endif .if(dst_r_bpp > 0) &&((SUBBLOCK % 2)==0) &&(((flags) &FLAG_NO_PRELOAD_DST)==0) PF pld,[DST, #32 *prefetch_distance - dst_alignment] .endif process_tail, 16, 0 .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst, 16, 0, DST .endif .set SUBBLOCK, SUBBLOCK+1 .endr subs X, X, #pix_per_block bhs 110b.endm.macro wide_case_inner_loop_and_trailing_pixels process_head, process_tail, process_inner_loop, exit_label, unaligned_src, unaligned_mask .if dst_r_bpp > tst bne process_inner_loop DST_PRELOAD_BIAS endif preload_trailing SRC preload_trailing MASK DST endif add medium_case_inner_loop_and_trailing_pixels unaligned_mask endm macro medium_case_inner_loop_and_trailing_pixels DST endif subs bhs tst beq exit_label trailing_15bytes unaligned_mask endm macro narrow_case_inner_loop_and_trailing_pixels unaligned_mask tst conditional_process1 trailing_15bytes unaligned_mask endm macro switch_on_alignment action
Definition: pixman-arm-simd-asm.h:510
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
SDL_Surface::h
int h
Definition: SDL_surface.h:74
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:410
SDL_VideoData::display
struct wl_display * display
Definition: SDL_waylandvideo.h:50
X11_CreateWindow
int X11_CreateWindow(_THIS, SDL_Window *window)
X11_GetNetWMState
Uint32 X11_GetNetWMState(_THIS, Window xwindow)
SDL_Window::driverdata
void * driverdata
Definition: SDL_sysvideo.h:112
src
GLenum src
Definition: SDL_opengl_glext.h:1740
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:378
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
X11_SetWindowGrab
void X11_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
l
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 int int int return Display long XVisualInfo int return Display Window Atom long long Bool Atom Atom int unsigned long unsigned long unsigned char * l)
Definition: SDL_x11sym.h:80
SDL_WINDOW_HIDDEN
@ SDL_WINDOW_HIDDEN
Definition: SDL_video.h:102
SDL_WindowData::ic
XIC ic
Definition: SDL_x11window.h:57
X11_SetWindowGammaRamp
int X11_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:203
SDL_iconv_string
#define SDL_iconv_string
Definition: SDL_dynapi_overrides.h:441
X11_SetWindowMaximumSize
void X11_SetWindowMaximumSize(_THIS, SDL_Window *window)
SDL_VideoDisplay
Definition: SDL_sysvideo.h:126
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
X11_GetDisplayBounds
int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect)
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:77
SDL_x11xinput2.h
SDL_hints.h
e
const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char const char const SDL_SCANF_FORMAT_STRING 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
Definition: SDL_dynapi_procs.h:117
left
GLint left
Definition: SDL_opengl_glext.h:1952
SDL_VideoData::_NET_WM_STATE
Atom _NET_WM_STATE
Definition: SDL_x11video.h:95
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:397
SDL_SysWMinfo::info
union SDL_SysWMinfo::@10 info
enabled
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: SDL_opengl_glext.h:2482
SDL_TICKS_PASSED
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
Definition: SDL_timer.h:56
SDL_WindowData::videodata
struct SDL_VideoData * videodata
Definition: SDL_cocoawindow.h:121
SDL_VideoData::_NET_WM_STATE_SKIP_PAGER
Atom _NET_WM_STATE_SKIP_PAGER
Definition: SDL_x11video.h:103
SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2
Definition: SDL_config.h:379
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_version::major
Uint8 major
Definition: SDL_version.h:53
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1483
SDL_MAJOR_VERSION
#define SDL_MAJOR_VERSION
Definition: SDL_version.h:60
X11_SetWindowSize
void X11_SetWindowSize(_THIS, SDL_Window *window)
X11_CreateWindowFrom
int X11_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
SDL_LogWarn
#define SDL_LogWarn
Definition: SDL_dynapi_overrides.h:35
X11_SetWindowFullscreen
void X11_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
X11_Xinput2SelectTouch
void X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
SDL_WINDOW_SKIP_TASKBAR
@ SDL_WINDOW_SKIP_TASKBAR
Definition: SDL_video.h:117
SDL_WindowData::egl_surface
EGLSurface egl_surface
Definition: SDL_androidwindow.h:40
border
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: SDL_opengl.h:1572
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:73
type
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
X11_SetNetWMState
void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
maxLength
GLsizei maxLength
Definition: SDL_opengl_glext.h:3647
X11_ResizeWindowShape
int X11_ResizeWindowShape(SDL_Window *window)
i
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
SDL_VideoData::_NET_WM_STATE_FULLSCREEN
Atom _NET_WM_STATE_FULLSCREEN
Definition: SDL_x11video.h:100
SDL_VideoData
Definition: SDL_androidvideo.h:36
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_VideoData::_NET_WM_STATE_FOCUSED
Atom _NET_WM_STATE_FOCUSED
Definition: SDL_x11video.h:97
SDL_syswm.h
SDL_WINDOW_BORDERLESS
@ SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:103
SDL_LOG_CATEGORY_VIDEO
@ SDL_LOG_CATEGORY_VIDEO
Definition: SDL_log.h:71
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179