21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_X11 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" 37 #if SDL_VIDEO_OPENGL_EGL 45 #define _NET_WM_STATE_REMOVE 0l 46 #define _NET_WM_STATE_ADD 1l 47 #define _NET_WM_STATE_TOGGLE 2l 49 static Bool isMapNotify(Display *
dpy, XEvent *ev, XPointer win)
51 return ev->type == MapNotify && ev->xmap.window == *((Window*)win);
53 static Bool isUnmapNotify(Display *
dpy, XEvent *ev, XPointer win)
55 return ev->type == UnmapNotify && ev->xunmap.window == *((Window*)win);
89 XWindowAttributes attr;
91 X11_XGetWindowAttributes(videodata->display, data->
xwindow, &attr);
92 if (attr.map_state != IsUnmapped) {
101 X11_IsActionAllowed(
SDL_Window *window, Atom action)
108 unsigned long remain;
109 unsigned long len,
i;
113 if (X11_XGetWindowProperty(display, data->
xwindow, _NET_WM_ALLOWED_ACTIONS, 0, 1024, False, XA_ATOM, &
type, &form, &len, &remain, (
unsigned char **)&list) == Success)
117 if (list[
i] == action) {
132 Display *display = videodata->
display;
151 atoms[
count++] = _NET_WM_STATE_FOCUSED;
154 atoms[
count++] = _NET_WM_STATE_MAXIMIZED_VERT;
155 atoms[
count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
158 atoms[
count++] = _NET_WM_STATE_FULLSCREEN;
161 X11_XChangeProperty(display, xwindow, _NET_WM_STATE, XA_ATOM, 32,
162 PropModeReplace, (
unsigned char *)atoms,
count);
164 X11_XDeleteProperty(display, xwindow, _NET_WM_STATE);
172 Display *display = videodata->
display;
181 unsigned long i, numItems, bytesAfter;
182 unsigned char *propertyValue =
NULL;
186 if (X11_XGetWindowProperty(display, xwindow, _NET_WM_STATE,
187 0l,
maxLength, False, XA_ATOM, &actualType,
188 &actualFormat, &numItems, &bytesAfter,
189 &propertyValue) == Success) {
190 Atom *atoms = (Atom *) propertyValue;
194 for (i = 0; i < numItems; ++
i) {
195 if (atoms[i] == _NET_WM_STATE_HIDDEN) {
197 }
else if (atoms[i] == _NET_WM_STATE_FOCUSED) {
199 }
else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
201 }
else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
203 }
else if ( atoms[i] == _NET_WM_STATE_FULLSCREEN) {
207 if (maximized == 3) {
209 }
else if (fullscreen == 1) {
212 X11_XFree(propertyValue);
237 #ifdef X_HAVE_UTF8_STRING 238 if (SDL_X11_HAVE_UTF8 && videodata->
im) {
240 X11_XCreateIC(videodata->
im, XNClientWindow, w, XNFocusWindow, w,
241 XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
250 if (numwindows < windowlistlength) {
251 windowlist[numwindows] =
data;
257 1) *
sizeof(*windowlist));
262 windowlist[numwindows] =
data;
270 XWindowAttributes attrib;
273 window->
x = attrib.x;
274 window->
y = attrib.y;
275 window->
w = attrib.width;
276 window->
h = attrib.height;
277 if (attrib.map_state != IsUnmapped) {
282 data->
visual = attrib.visual;
297 if (window->
flags & SDL_WINDOW_INPUT_FOCUS) {
320 Atom WM_HINTS = X11_XInternAtom(display,
"_MOTIF_WM_HINTS", True);
321 if (WM_HINTS != None) {
326 unsigned long functions;
327 unsigned long decorations;
329 unsigned long status;
331 (1L << 1), 0, border ? 1 : 0, 0, 0
334 X11_XChangeProperty(display, window, WM_HINTS, WM_HINTS, 32,
335 PropModeReplace, (
unsigned char *) &MWMHints,
336 sizeof(MWMHints) /
sizeof(
long));
338 X11_XSetTransientForHint(display, window, RootWindow(display, screen));
349 Display *display = data->
display;
350 int screen = displaydata->screen;
353 XSetWindowAttributes xattr;
355 XSizeHints *sizehints;
357 XClassHint *classhints;
358 const long _NET_WM_BYPASS_COMPOSITOR_HINT_ON = 1;
359 Atom _NET_WM_BYPASS_COMPOSITOR;
360 Atom _NET_WM_WINDOW_TYPE;
361 Atom _NET_WM_WINDOW_TYPE_NORMAL;
363 Atom XdndAware, xdnd_version = 5;
366 #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL 369 XVisualInfo *vinfo =
NULL;
371 #if SDL_VIDEO_OPENGL_EGL 377 vinfo = X11_GLES_GetVisual(
_this, display, screen);
381 #if SDL_VIDEO_OPENGL_GLX 382 vinfo = X11_GL_GetVisual(
_this, display, screen);
389 visual = vinfo->visual;
390 depth = vinfo->depth;
395 visual = displaydata->visual;
396 depth = displaydata->depth;
399 xattr.override_redirect = False;
400 xattr.background_pixmap = None;
401 xattr.border_pixel = 0;
403 if (visual->class == DirectColor) {
407 int rmax, gmax, bmax;
408 int rmask, gmask, bmask;
409 int rshift, gshift, bshift;
412 X11_XCreateColormap(display, RootWindow(display, screen),
416 if (!xattr.colormap) {
417 return SDL_SetError(
"Could not create writable colormap");
421 colorcells =
SDL_malloc(visual->map_entries *
sizeof(XColor));
425 ncolors = visual->map_entries;
431 rmask = visual->red_mask;
432 while (0 == (rmask & 1)) {
438 gmask = visual->green_mask;
439 while (0 == (gmask & 1)) {
445 bmask = visual->blue_mask;
446 while (0 == (bmask & 1)) {
452 for (i = 0; i < ncolors; i++) {
457 Uint32 rbits = (rmask *
i) / (ncolors - 1);
458 Uint32 gbits = (gmask *
i) / (ncolors - 1);
459 Uint32 bbits = (bmask *
i) / (ncolors - 1);
462 (rbits << rshift) | (gbits << gshift) | (bbits << bshift);
464 colorcells[
i].pixel = pix;
466 colorcells[
i].red =
red;
467 colorcells[
i].green =
green;
468 colorcells[
i].blue =
blue;
470 colorcells[
i].flags = DoRed | DoGreen | DoBlue;
473 X11_XStoreColors(display, xattr.colormap, colorcells, ncolors);
478 X11_XCreateColormap(display, RootWindow(display, screen),
482 w = X11_XCreateWindow(display, RootWindow(display, screen),
483 window->
x, window->
y, window->
w, window->
h,
484 0, depth, InputOutput, visual,
485 (CWOverrideRedirect | CWBackPixmap | CWBorderPixel |
486 CWColormap), &xattr);
491 SetWindowBordered(display, screen, w,
494 sizehints = X11_XAllocSizeHints();
496 sizehints->flags = 0;
498 sizehints->min_width = sizehints->max_width = window->
w;
499 sizehints->min_height = sizehints->max_height = window->
h;
500 sizehints->flags |= (PMaxSize | PMinSize);
502 sizehints->x = window->
x;
503 sizehints->y = window->
y;
504 sizehints->flags |= USPosition;
507 wmhints = X11_XAllocWMHints();
508 wmhints->input = True;
509 wmhints->flags = InputHint;
512 classhints = X11_XAllocClassHint();
517 X11_XSetWMProperties(display, w,
NULL,
NULL,
NULL, 0, sizehints, wmhints, classhints);
519 X11_XFree(sizehints);
521 X11_XFree(classhints);
524 _NET_WM_PID = X11_XInternAtom(display,
"_NET_WM_PID", False);
525 X11_XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,
526 (
unsigned char *)&data->
pid, 1);
533 _NET_WM_WINDOW_TYPE = X11_XInternAtom(display,
"_NET_WM_WINDOW_TYPE", False);
534 _NET_WM_WINDOW_TYPE_NORMAL = X11_XInternAtom(display,
"_NET_WM_WINDOW_TYPE_NORMAL", False);
535 X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
537 (
unsigned char *)&_NET_WM_WINDOW_TYPE_NORMAL, 1);
539 _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display,
"_NET_WM_BYPASS_COMPOSITOR", False);
540 X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
542 (
unsigned char *)&_NET_WM_BYPASS_COMPOSITOR_HINT_ON, 1);
547 const char *ping_hint;
554 if (!ping_hint ||
SDL_atoi(ping_hint)) {
559 SDL_assert(proto_count <=
sizeof(protocols) /
sizeof(protocols[0]));
561 X11_XSetWMProtocols(display, w, protocols, proto_count);
565 X11_XDestroyWindow(display, w);
573 #if SDL_VIDEO_OPENGL_GLX 577 #if SDL_VIDEO_OPENGL_EGL 578 if (!
_this->egl_data) {
579 X11_XDestroyWindow(display, w);
584 windowdata->
egl_surface = SDL_EGL_CreateSurface(
_this, (NativeWindowType) w);
587 X11_XDestroyWindow(display, w);
588 return SDL_SetError(
"Could not create GLES window surface");
591 return SDL_SetError(
"Could not create GLES window surface (no EGL support available)");
597 #ifdef X_HAVE_UTF8_STRING 598 if (SDL_X11_HAVE_UTF8 && windowdata->
ic) {
599 X11_XGetICValues(windowdata->
ic, XNFilterEvents, &fevent,
NULL);
605 X11_XSelectInput(display, w,
606 (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
607 ExposureMask | ButtonPressMask | ButtonReleaseMask |
608 PointerMotionMask | KeyPressMask | KeyReleaseMask |
609 PropertyChangeMask | StructureNotifyMask |
610 KeymapStateMask | fevent));
612 XdndAware = X11_XInternAtom(display,
"XdndAware", False);
613 X11_XChangeProperty(display, w, XdndAware, XA_ATOM, 32,
615 (
unsigned char*)&xdnd_version, 1);
625 Window w = (Window) data;
639 Display *display = data->
display;
640 int status, real_format;
642 unsigned long items_read, items_left;
643 unsigned char *propdata;
646 status = X11_XGetWindowProperty(display, xwindow, data->
_NET_WM_NAME,
647 0L, 8192L, False, data->
UTF8_STRING, &real_type, &real_format,
648 &items_read, &items_left, &propdata);
649 if (status == Success && propdata) {
653 status = X11_XGetWindowProperty(display, xwindow, XA_WM_NAME,
654 0L, 8192L, False, XA_STRING, &real_type, &real_format,
655 &items_read, &items_left, &propdata);
656 if (status == Success && propdata) {
671 XTextProperty titleprop;
673 const char *title = window->
title ? window->
title :
"";
674 char *title_locale =
NULL;
676 #ifdef X_HAVE_UTF8_STRING
686 status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
689 X11_XSetTextProperty(display, data->
xwindow, &titleprop, XA_WM_NAME);
690 X11_XFree(titleprop.value);
692 #ifdef X_HAVE_UTF8_STRING 693 if (SDL_X11_HAVE_UTF8) {
694 status = X11_Xutf8TextListToTextProperty(display, (
char **) &title, 1,
695 XUTF8StringStyle, &titleprop);
696 if (status == Success) {
697 X11_XSetTextProperty(display, data->
xwindow, &titleprop,
699 X11_XFree(titleprop.value);
720 propsize = 2 + (icon->
w * icon->
h);
721 propdata =
SDL_malloc(propsize *
sizeof(
long));
727 propdata[0] = icon->
w;
728 propdata[1] = icon->
h;
730 for (y = 0; y < icon->
h; ++
y) {
732 for (x = 0; x < icon->
w; ++
x) {
736 X11_XChangeProperty(display, data->
xwindow, _NET_WM_ICON, XA_CARDINAL,
737 32, PropModeReplace, (
unsigned char *) propdata,
742 X11_XDeleteProperty(display, data->
xwindow, _NET_WM_ICON);
753 X11_XMoveWindow(display, data->
xwindow, window->
x, window->
y);
764 XSizeHints *sizehints = X11_XAllocSizeHints();
767 X11_XGetWMNormalHints(display, data->
xwindow, sizehints, &userhints);
769 sizehints->min_width = window->
min_w;
770 sizehints->min_height = window->
min_h;
771 sizehints->flags |= PMinSize;
773 X11_XSetWMNormalHints(display, data->
xwindow, sizehints);
775 X11_XFree(sizehints);
778 X11_XResizeWindow(display, data->
xwindow, window->
w, window->
h);
779 X11_XMoveWindow(display, data->
xwindow, window->
x, window->
y);
780 X11_XRaiseWindow(display, data->
xwindow);
793 XSizeHints *sizehints = X11_XAllocSizeHints();
796 X11_XGetWMNormalHints(display, data->
xwindow, sizehints, &userhints);
798 sizehints->max_width = window->
max_w;
799 sizehints->max_height = window->
max_h;
800 sizehints->flags |= PMaxSize;
802 X11_XSetWMNormalHints(display, data->
xwindow, sizehints);
804 X11_XFree(sizehints);
807 X11_XResizeWindow(display, data->
xwindow, window->
w, window->
h);
808 X11_XMoveWindow(display, data->
xwindow, window->
x, window->
y);
809 X11_XRaiseWindow(display, data->
xwindow);
827 XSizeHints *sizehints = X11_XAllocSizeHints();
830 X11_XGetWMNormalHints(display, data->
xwindow, sizehints, &userhints);
832 sizehints->min_width = sizehints->max_width = window->
w;
833 sizehints->min_height = sizehints->max_height = window->
h;
834 sizehints->flags |= PMinSize | PMaxSize;
836 X11_XSetWMNormalHints(display, data->
xwindow, sizehints);
838 X11_XFree(sizehints);
856 X11_XResizeWindow(display, data->
xwindow, window->
w, window->
h);
857 X11_XMoveWindow(display, data->
xwindow, window->
x, window->
y);
858 X11_XRaiseWindow(display, data->
xwindow);
860 X11_XResizeWindow(display, data->
xwindow, window->
w, window->
h);
877 SetWindowBordered(display, displaydata->screen, data->
xwindow, bordered);
881 XWindowAttributes attr;
883 X11_XSync(display, False);
884 X11_XGetWindowAttributes(display, data->
xwindow, &attr);
885 }
while (attr.map_state != IsViewable);
888 X11_XSetInputFocus(display, data->
xwindow, RevertToParent, CurrentTime);
893 X11_XSync(display, False);
894 X11_XCheckIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->
xwindow);
895 X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->
xwindow);
905 if (!X11_IsWindowMapped(
_this, window)) {
906 X11_XMapRaised(display, data->
xwindow);
910 X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->
xwindow);
916 X11_XSetInputFocus(display, data->
xwindow, RevertToNone, CurrentTime);
929 if (X11_IsWindowMapped(
_this, window)) {
930 X11_XWithdrawWindow(display, data->
xwindow, displaydata->screen);
932 X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->
xwindow);
946 if (X11_IsWindowMapped(
_this, window)) {
950 e.xany.type = ClientMessage;
951 e.xclient.message_type = _NET_ACTIVE_WINDOW;
952 e.xclient.format = 32;
953 e.xclient.window = data->
xwindow;
954 e.xclient.data.l[0] = 1;
955 e.xclient.data.l[1] = CurrentTime;
956 e.xclient.data.l[2] = 0;
958 X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
959 SubstructureNotifyMask | SubstructureRedirectMask, &e);
971 X11_XRaiseWindow(display, data->
xwindow);
972 SetWindowActive(
_this, window);
990 window->
flags &= ~SDL_WINDOW_MAXIMIZED;
993 if (X11_IsWindowMapped(
_this, window)) {
997 e.xany.type = ClientMessage;
998 e.xclient.message_type = _NET_WM_STATE;
999 e.xclient.format = 32;
1000 e.xclient.window = data->
xwindow;
1001 e.xclient.data.l[0] =
1002 maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
1003 e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT;
1004 e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ;
1005 e.xclient.data.l[3] = 0l;
1007 X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
1008 SubstructureNotifyMask | SubstructureRedirectMask, &e);
1012 X11_XFlush(display);
1029 X11_XIconifyWindow(display, data->
xwindow, displaydata->screen);
1030 X11_XFlush(display);
1038 SetWindowActive(
_this, window);
1051 if (X11_IsWindowMapped(
_this, window)) {
1057 XSizeHints *sizehints = X11_XAllocSizeHints();
1059 X11_XGetWMNormalHints(display, data->
xwindow, sizehints, &flags);
1063 sizehints->flags &= ~(PMinSize | PMaxSize);
1066 sizehints->flags |= PMinSize | PMaxSize;
1067 sizehints->min_width = sizehints->max_width = window->
windowed.
w;
1068 sizehints->min_height = sizehints->max_height = window->
windowed.
h;
1070 X11_XSetWMNormalHints(display, data->
xwindow, sizehints);
1071 X11_XFree(sizehints);
1075 e.xany.type = ClientMessage;
1076 e.xclient.message_type = _NET_WM_STATE;
1077 e.xclient.format = 32;
1078 e.xclient.window = data->
xwindow;
1079 e.xclient.data.l[0] =
1080 fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
1081 e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN;
1082 e.xclient.data.l[3] = 0l;
1084 X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
1085 SubstructureNotifyMask | SubstructureRedirectMask, &e);
1089 flags = window->
flags;
1093 flags &= ~SDL_WINDOW_FULLSCREEN;
1098 if (data->
visual->class == DirectColor) {
1100 X11_XInstallColormap(display, data->
colormap);
1102 X11_XUninstallColormap(display, data->
colormap);
1106 X11_XFlush(display);
1115 Visual *visual = data->
visual;
1117 const int screen = displaydata->screen;
1118 Window root = RootWindow(display, screen);
1119 const int def_vis = (visual == DefaultVisual(display, screen));
1120 unsigned long xattrmask = 0;
1121 XSetWindowAttributes xattr;
1132 xattr.override_redirect = True;
1133 xattrmask |= CWOverrideRedirect;
1134 xattr.background_pixel = def_vis ? BlackPixel(display, screen) : 0;
1135 xattrmask |= CWBackPixel;
1136 xattr.border_pixel = 0;
1137 xattrmask |= CWBorderPixel;
1139 xattrmask |= CWColormap;
1141 data->
fswindow = X11_XCreateWindow(display, root,
1142 rect.
x, rect.
y, rect.
w, rect.
h, 0,
1143 displaydata->depth, InputOutput,
1144 visual, xattrmask, &xattr);
1146 X11_XSelectInput(display, data->
fswindow, StructureNotifyMask);
1147 X11_XSetWindowBackground(display, data->
fswindow, 0);
1148 X11_XInstallColormap(display, data->
colormap);
1149 X11_XClearWindow(display, data->
fswindow);
1150 X11_XMapRaised(display, data->
fswindow);
1153 X11_XUngrabPointer(display, CurrentTime);
1154 X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.
x, rect.
y);
1157 X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->
fswindow);
1158 X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->
fswindow);
1160 #if SDL_VIDEO_DRIVER_X11_XVIDMODE 1161 if ( displaydata->use_vidmode ) {
1162 X11_XF86VidModeLockModeSwitch(display, screen, True);
1170 (rect.
w - window->
w) / 2, (rect.
h - window->
h) / 2);
1173 X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.
x, rect.
y);
1176 rect.
x += (rect.
w / 2);
1177 rect.
y += (rect.
h / 2);
1178 X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.
x, rect.
y);
1181 X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->
xwindow);
1182 X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->
xwindow);
1193 const int screen = displaydata->screen;
1194 Window root = RootWindow(display, screen);
1204 #if SDL_VIDEO_DRIVER_X11_VIDMODE 1205 if ( displaydata->use_vidmode ) {
1206 X11_XF86VidModeLockModeSwitch(display, screen, False);
1212 X11_XReparentWindow(display, data->
xwindow, root, window->
x, window->
y);
1215 X11_XSync(display, False);
1216 X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&data->
xwindow);
1217 X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->
xwindow);
1219 SetWindowBordered(display, screen, data->
xwindow,
1222 X11_XWithdrawWindow(display, fswindow, screen);
1225 X11_XIfEvent(display, &ev, &isUnmapNotify, (XPointer)&fswindow);
1226 X11_XDestroyWindow(display, fswindow);
1235 const char *env =
SDL_getenv(
"SDL_VIDEO_X11_LEGACY_FULLSCREEN");
1241 if ( displaydata->use_vidmode ) {
1243 }
else if ( !videodata->
net_wm ) {
1254 X11_BeginWindowFullscreenLegacy(
_this, window, _display);
1256 X11_EndWindowFullscreenLegacy(
_this, window, _display);
1259 X11_SetWindowFullscreenViaWM(
_this, window, _display, fullscreen);
1269 Visual *visual = data->
visual;
1270 Colormap colormap = data->
colormap;
1273 int rmask, gmask, bmask;
1274 int rshift, gshift, bshift;
1277 if (visual->class != DirectColor) {
1278 return SDL_SetError(
"Window doesn't have DirectColor visual");
1281 ncolors = visual->map_entries;
1282 colorcells =
SDL_malloc(ncolors *
sizeof(XColor));
1288 rmask = visual->red_mask;
1289 while (0 == (rmask & 1)) {
1295 gmask = visual->green_mask;
1296 while (0 == (gmask & 1)) {
1302 bmask = visual->blue_mask;
1303 while (0 == (bmask & 1)) {
1309 for (i = 0; i < ncolors; i++) {
1310 Uint32 rbits = (rmask *
i) / (ncolors - 1);
1311 Uint32 gbits = (gmask *
i) / (ncolors - 1);
1312 Uint32 bbits = (bmask *
i) / (ncolors - 1);
1313 Uint32 pix = (rbits << rshift) | (gbits << gshift) | (bbits << bshift);
1315 colorcells[
i].pixel = pix;
1317 colorcells[
i].red = ramp[(0 * 256) + i];
1318 colorcells[
i].green = ramp[(1 * 256) + i];
1319 colorcells[
i].blue = ramp[(2 * 256) + i];
1321 colorcells[
i].flags = DoRed | DoGreen | DoBlue;
1324 X11_XStoreColors(display, colormap, colorcells, ncolors);
1325 X11_XFlush(display);
1344 oldstyle_fullscreen = X11_IsWindowLegacyFullscreen(
_this, window);
1346 if (oldstyle_fullscreen || grabbed) {
1350 X11_XGrabPointer(display, data->
xwindow, True, 0, GrabModeAsync,
1351 GrabModeAsync, data->
xwindow, None, CurrentTime);
1352 if (result == GrabSuccess) {
1359 X11_XRaiseWindow(display, data->
xwindow);
1369 grab_keyboard = oldstyle_fullscreen;
1371 if (grab_keyboard) {
1372 X11_XGrabKeyboard(display, data->
xwindow, True, GrabModeAsync,
1373 GrabModeAsync, CurrentTime);
1376 X11_XUngrabPointer(display, CurrentTime);
1377 X11_XUngrabKeyboard(display, CurrentTime);
1379 X11_XSync(display, False);
1389 Display *display = videodata->
display;
1395 for (i = 0; i < numwindows; ++
i) {
1396 if (windowlist[i] && (windowlist[i]->window == window)) {
1397 windowlist[
i] = windowlist[numwindows - 1];
1398 windowlist[numwindows - 1] =
NULL;
1404 #ifdef X_HAVE_UTF8_STRING 1406 X11_XDestroyIC(data->
ic);
1410 X11_XDestroyWindow(display, data->
xwindow);
1411 X11_XFlush(display);
1427 info->
info.
x11.display = display;
1431 SDL_SetError(
"Application not compiled with SDL %d.%d\n",
void SDL_UpdateWindowGrab(SDL_Window *window)
#define SDL_MINOR_VERSION
int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
Atom _NET_WM_STATE_FULLSCREEN
int X11_ResizeWindowShape(SDL_Window *window)
Atom _NET_WM_ALLOWED_ACTIONS
void X11_SetWindowTitle(_THIS, SDL_Window *window)
#define SDL_IsShapedWindow
void SDL_SetKeyboardFocus(SDL_Window *window)
Uint32 X11_GetNetWMState(_THIS, Window xwindow)
#define SDL_VIDEO_OPENGL_ES
uint32_t Uint32
An unsigned 32-bit integer type.
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 * e
Atom _NET_WM_STATE_MAXIMIZED_VERT
GLint GLint GLint GLint GLint x
#define SDL_MAJOR_VERSION
GLuint GLuint GLsizei count
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display dpy)
struct wl_display * display
A collection of pixels used in software blitting.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
SDL_WindowData ** windowlist
void X11_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
void X11_MinimizeWindow(_THIS, SDL_Window *window)
void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
#define SDL_VIDEO_OPENGL_ES2
void X11_MaximizeWindow(_THIS, SDL_Window *window)
struct SDL_GLDriverData * gl_data
#define SDL_HINT_GRAB_KEYBOARD
A variable controlling whether grabbing input grabs the keyboard.
int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect)
static SDL_VideoDevice * _this
#define SDL_iconv_utf8_locale(S)
Atom _NET_WM_STATE_HIDDEN
#define SDL_HINT_VIDEO_X11_NET_WM_PING
A variable controlling whether the X11 _NET_WM_PING protocol should be supported. ...
GLuint GLuint GLsizei GLenum type
void * SDL_calloc(size_t nmemb, size_t size)
int X11_CreateWindow(_THIS, SDL_Window *window)
GLint GLint GLint GLint GLint GLint y
int X11_SetWindowGammaRamp(_THIS, SDL_Window *window, const Uint16 *ramp)
struct SDL_VideoData * videodata
uint8_t Uint8
An unsigned 8-bit integer type.
int X11_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
#define SDL_static_cast(type, expression)
void X11_RestoreWindow(_THIS, SDL_Window *window)
void X11_ShowWindow(_THIS, SDL_Window *window)
void X11_DestroyWindow(_THIS, SDL_Window *window)
#define SDL_VIDEO_OPENGL_GLX
struct SDL_SysWMinfo::@18::@19 x11
GLenum GLenum GLsizei const GLuint GLboolean enabled
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)
#define SDL_assert(condition)
void X11_SetWindowMinimumSize(_THIS, SDL_Window *window)
#define SDL_OutOfMemory()
GLint GLint GLsizei GLsizei GLsizei depth
Atom _NET_WM_STATE_MAXIMIZED_HORZ
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
The type used to identify a window.
Atom _NET_WM_STATE_FOCUSED
void X11_RaiseWindow(_THIS, SDL_Window *window)
void X11_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
char * X11_GetWindowTitle(_THIS, Window xwindow)
struct SDL_VideoDevice::@28 gl_config
GLint GLint GLsizei GLsizei GLsizei GLint border
uint16_t Uint16
An unsigned 16-bit integer type.
union SDL_SysWMinfo::@18 info
GLubyte GLubyte GLubyte GLubyte w
void X11_SetWindowSize(_THIS, SDL_Window *window)
void X11_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
void X11_HideWindow(_THIS, SDL_Window *window)
void X11_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
A rectangle, with the origin at the upper left.
SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
void X11_SetWindowMaximumSize(_THIS, SDL_Window *window)
void X11_SetWindowPosition(_THIS, SDL_Window *window)