early-access version 1667
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11dyn.c
vendored
2
externals/SDL/src/video/x11/SDL_x11dyn.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11dyn.h
vendored
2
externals/SDL/src/video/x11/SDL_x11dyn.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
16
externals/SDL/src/video/x11/SDL_x11events.c
vendored
16
externals/SDL/src/video/x11/SDL_x11events.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -676,6 +676,7 @@ X11_DispatchEvent(_THIS)
|
||||
Display *display;
|
||||
SDL_WindowData *data;
|
||||
XEvent xevent;
|
||||
XkbEvent* xkbEvent;
|
||||
int orig_event_type;
|
||||
KeyCode orig_keycode;
|
||||
XClientMessageEvent m;
|
||||
@@ -688,6 +689,7 @@ X11_DispatchEvent(_THIS)
|
||||
|
||||
SDL_zero(xevent); /* valgrind fix. --ryan. */
|
||||
X11_XNextEvent(display, &xevent);
|
||||
xkbEvent = (XkbEvent*) &xevent;
|
||||
|
||||
/* Save the original keycode for dead keys, which are filtered out by
|
||||
the XFilterEvent() call below.
|
||||
@@ -768,7 +770,7 @@ X11_DispatchEvent(_THIS)
|
||||
if (SDL_GetKeyboardFocus() != NULL) {
|
||||
X11_ReconcileKeyboardState(_this);
|
||||
}
|
||||
} else if (xevent.type == MappingNotify) {
|
||||
} else if (xevent.type == MappingNotify || xkbEvent->any.xkb_type == XkbStateNotify) {
|
||||
/* Has the keyboard layout changed? */
|
||||
const int request = xevent.xmapping.request;
|
||||
|
||||
@@ -808,6 +810,9 @@ X11_DispatchEvent(_THIS)
|
||||
if (!mouse->relative_mode) {
|
||||
SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y);
|
||||
}
|
||||
|
||||
/* We ungrab in LeaveNotify, so we may need to grab again here */
|
||||
SDL_UpdateWindowGrab(data->window);
|
||||
}
|
||||
break;
|
||||
/* Losing mouse coverage? */
|
||||
@@ -829,6 +834,13 @@ X11_DispatchEvent(_THIS)
|
||||
if (xevent.xcrossing.mode != NotifyGrab &&
|
||||
xevent.xcrossing.mode != NotifyUngrab &&
|
||||
xevent.xcrossing.detail != NotifyInferior) {
|
||||
|
||||
/* In order for interaction with the window decorations and menu to work properly
|
||||
on Mutter, we need to ungrab the keyboard when the the mouse leaves. */
|
||||
if (!(data->window->flags & SDL_WINDOW_FULLSCREEN)) {
|
||||
X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE);
|
||||
}
|
||||
|
||||
SDL_SetMouseFocus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11events.h
vendored
2
externals/SDL/src/video/x11/SDL_x11events.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
4
externals/SDL/src/video/x11/SDL_x11modes.c
vendored
4
externals/SDL/src/video/x11/SDL_x11modes.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -257,7 +257,7 @@ static int
|
||||
CalculateXRandRRefreshRate(const XRRModeInfo *info)
|
||||
{
|
||||
return (info->hTotal && info->vTotal) ?
|
||||
round(((double)info->dotClock / (double)(info->hTotal * info->vTotal))) : 0;
|
||||
SDL_round(((double)info->dotClock / (double)(info->hTotal * info->vTotal))) : 0;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11modes.h
vendored
2
externals/SDL/src/video/x11/SDL_x11modes.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11mouse.c
vendored
2
externals/SDL/src/video/x11/SDL_x11mouse.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11mouse.h
vendored
2
externals/SDL/src/video/x11/SDL_x11mouse.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11opengl.c
vendored
2
externals/SDL/src/video/x11/SDL_x11opengl.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11opengl.h
vendored
2
externals/SDL/src/video/x11/SDL_x11opengl.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11shape.c
vendored
2
externals/SDL/src/video/x11/SDL_x11shape.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11shape.h
vendored
2
externals/SDL/src/video/x11/SDL_x11shape.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
3
externals/SDL/src/video/x11/SDL_x11sym.h
vendored
3
externals/SDL/src/video/x11/SDL_x11sym.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -182,6 +182,7 @@ SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b
|
||||
SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
|
||||
SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
|
||||
SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return)
|
||||
SDL_X11_SYM(Bool,XkbSelectEvents,(Display* a, unsigned int b, unsigned int c, unsigned int d),(a,b,c,d),return)
|
||||
#endif
|
||||
|
||||
#if NeedWidePrototypes
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11touch.c
vendored
2
externals/SDL/src/video/x11/SDL_x11touch.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11touch.h
vendored
2
externals/SDL/src/video/x11/SDL_x11touch.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
12
externals/SDL/src/video/x11/SDL_x11video.c
vendored
12
externals/SDL/src/video/x11/SDL_x11video.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -222,9 +222,11 @@ X11_CreateDevice(int devindex)
|
||||
device->RestoreWindow = X11_RestoreWindow;
|
||||
device->SetWindowBordered = X11_SetWindowBordered;
|
||||
device->SetWindowResizable = X11_SetWindowResizable;
|
||||
device->SetWindowAlwaysOnTop = X11_SetWindowAlwaysOnTop;
|
||||
device->SetWindowFullscreen = X11_SetWindowFullscreen;
|
||||
device->SetWindowGammaRamp = X11_SetWindowGammaRamp;
|
||||
device->SetWindowGrab = X11_SetWindowGrab;
|
||||
device->SetWindowMouseGrab = X11_SetWindowMouseGrab;
|
||||
device->SetWindowKeyboardGrab = X11_SetWindowKeyboardGrab;
|
||||
device->DestroyWindow = X11_DestroyWindow;
|
||||
device->CreateWindowFramebuffer = X11_CreateWindowFramebuffer;
|
||||
device->UpdateWindowFramebuffer = X11_UpdateWindowFramebuffer;
|
||||
@@ -456,12 +458,6 @@ X11_VideoQuit(_THIS)
|
||||
X11_QuitKeyboard(_this);
|
||||
X11_QuitMouse(_this);
|
||||
X11_QuitTouch(_this);
|
||||
|
||||
/* !!! FIXME: other subsystems use D-Bus, so we shouldn't quit it here;
|
||||
have SDL.c do this at a higher level, or add refcounting. */
|
||||
#if SDL_USE_LIBDBUS
|
||||
SDL_DBus_Quit();
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11video.h
vendored
2
externals/SDL/src/video/x11/SDL_x11video.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11vulkan.c
vendored
2
externals/SDL/src/video/x11/SDL_x11vulkan.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11vulkan.h
vendored
2
externals/SDL/src/video/x11/SDL_x11vulkan.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
79
externals/SDL/src/video/x11/SDL_x11window.c
vendored
79
externals/SDL/src/video/x11/SDL_x11window.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -325,7 +325,7 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
|
||||
SDL_SetKeyboardFocus(data->window);
|
||||
}
|
||||
|
||||
if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
|
||||
if (window->flags & SDL_WINDOW_MOUSE_GRABBED) {
|
||||
/* Tell x11 to clip mouse */
|
||||
}
|
||||
}
|
||||
@@ -445,6 +445,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
|
||||
}
|
||||
|
||||
xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False;
|
||||
xattr.backing_store = NotUseful;
|
||||
xattr.background_pixmap = None;
|
||||
xattr.border_pixel = 0;
|
||||
|
||||
@@ -531,7 +532,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
|
||||
window->x, window->y, window->w, window->h,
|
||||
0, depth, InputOutput, visual,
|
||||
(CWOverrideRedirect | CWBackPixmap | CWBorderPixel |
|
||||
CWColormap), &xattr);
|
||||
CWBackingStore | CWColormap), &xattr);
|
||||
if (!w) {
|
||||
return SDL_SetError("Couldn't create window");
|
||||
}
|
||||
@@ -668,6 +669,8 @@ X11_CreateWindow(_THIS, SDL_Window * window)
|
||||
PropertyChangeMask | StructureNotifyMask |
|
||||
KeymapStateMask | fevent));
|
||||
|
||||
X11_XkbSelectEvents(display, XkbUseCoreKbd, XkbStateNotifyMask, XkbStateNotifyMask);
|
||||
|
||||
X11_XFlush(display);
|
||||
|
||||
return 0;
|
||||
@@ -1107,6 +1110,36 @@ X11_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
|
||||
X11_XFlush(display);
|
||||
}
|
||||
|
||||
void
|
||||
X11_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_top)
|
||||
{
|
||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||
Display *display = data->videodata->display;
|
||||
Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
|
||||
Atom _NET_WM_STATE_ABOVE = data->videodata->_NET_WM_STATE_ABOVE;
|
||||
|
||||
if (X11_IsWindowMapped(_this, window)) {
|
||||
XEvent e;
|
||||
|
||||
SDL_zero(e);
|
||||
e.xany.type = ClientMessage;
|
||||
e.xclient.message_type = _NET_WM_STATE;
|
||||
e.xclient.format = 32;
|
||||
e.xclient.window = data->xwindow;
|
||||
e.xclient.data.l[0] =
|
||||
on_top ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
e.xclient.data.l[1] = _NET_WM_STATE_ABOVE;
|
||||
e.xclient.data.l[3] = 0l;
|
||||
|
||||
X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask, &e);
|
||||
} else {
|
||||
X11_SetNetWMState(_this, data->xwindow, window->flags);
|
||||
}
|
||||
X11_XFlush(display);
|
||||
}
|
||||
|
||||
void
|
||||
X11_ShowWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
@@ -1126,6 +1159,7 @@ X11_ShowWindow(_THIS, SDL_Window * window)
|
||||
|
||||
if (!data->videodata->net_wm) {
|
||||
/* no WM means no FocusIn event, which confuses us. Force it. */
|
||||
X11_XSync(display, False);
|
||||
X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
|
||||
X11_XFlush(display);
|
||||
}
|
||||
@@ -1561,12 +1595,11 @@ X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
|
||||
}
|
||||
|
||||
void
|
||||
X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||
X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||
{
|
||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||
Display *display = data->videodata->display;
|
||||
SDL_bool oldstyle_fullscreen;
|
||||
SDL_bool grab_keyboard;
|
||||
|
||||
/* ICCCM2.0-compliant window managers can handle fullscreen windows
|
||||
If we're using XVidMode to change resolution we need to confine
|
||||
@@ -1607,21 +1640,33 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||
/* Raise the window if we grab the mouse */
|
||||
X11_XRaiseWindow(display, data->xwindow);
|
||||
|
||||
/* Now grab the keyboard */
|
||||
if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE)) {
|
||||
grab_keyboard = SDL_TRUE;
|
||||
} else {
|
||||
/* We need to do this with the old style override_redirect
|
||||
fullscreen window otherwise we won't get keyboard focus.
|
||||
*/
|
||||
grab_keyboard = oldstyle_fullscreen;
|
||||
}
|
||||
if (grab_keyboard) {
|
||||
X11_XGrabKeyboard(display, data->xwindow, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
/* Now grab the keyboard on old-style fullscreen */
|
||||
if (oldstyle_fullscreen) {
|
||||
X11_SetWindowKeyboardGrab(_this, window, SDL_TRUE);
|
||||
}
|
||||
} else {
|
||||
X11_XUngrabPointer(display, CurrentTime);
|
||||
}
|
||||
X11_XSync(display, False);
|
||||
}
|
||||
|
||||
void
|
||||
X11_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||
{
|
||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||
Display *display = data->videodata->display;
|
||||
|
||||
if (grabbed) {
|
||||
/* If the window is unmapped, XGrab calls return GrabNotViewable,
|
||||
so when we get a MapNotify later, we'll try to update the grab as
|
||||
appropriate. */
|
||||
if (window->flags & SDL_WINDOW_HIDDEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
X11_XGrabKeyboard(display, data->xwindow, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
} else {
|
||||
X11_XUngrabKeyboard(display, CurrentTime);
|
||||
}
|
||||
X11_XSync(display, False);
|
||||
|
||||
6
externals/SDL/src/video/x11/SDL_x11window.h
vendored
6
externals/SDL/src/video/x11/SDL_x11window.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -97,9 +97,11 @@ extern void X11_MinimizeWindow(_THIS, SDL_Window * window);
|
||||
extern void X11_RestoreWindow(_THIS, SDL_Window * window);
|
||||
extern void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
|
||||
extern void X11_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable);
|
||||
extern void X11_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_top);
|
||||
extern void X11_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
|
||||
extern int X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
|
||||
extern void X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
|
||||
extern void X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
|
||||
extern void X11_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
|
||||
extern void X11_DestroyWindow(_THIS, SDL_Window * window);
|
||||
extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||
struct SDL_SysWMinfo *info);
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11xinput2.c
vendored
2
externals/SDL/src/video/x11/SDL_x11xinput2.c
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
2
externals/SDL/src/video/x11/SDL_x11xinput2.h
vendored
2
externals/SDL/src/video/x11/SDL_x11xinput2.h
vendored
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
Reference in New Issue
Block a user