Add fallback for such exotic window managers as "larswm" which don't support netwm.
It's because Cand complains :)
This commit is contained in:
parent
911faa0676
commit
da41a06ae4
@ -746,8 +746,21 @@ bool CIrrDeviceLinux::createWindow()
|
|||||||
|
|
||||||
if (!CreationParams.WindowId)
|
if (!CreationParams.WindowId)
|
||||||
{
|
{
|
||||||
|
Atom *list;
|
||||||
|
Atom type;
|
||||||
|
int form;
|
||||||
|
unsigned long remain, len;
|
||||||
|
|
||||||
|
Atom WMCheck = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", false);
|
||||||
|
Status s = XGetWindowProperty(display, DefaultRootWindow(display),
|
||||||
|
WMCheck, 0L, 1L, False, XA_WINDOW,
|
||||||
|
&type, &form, &len, &remain,
|
||||||
|
(unsigned char **)&list);
|
||||||
|
|
||||||
|
bool netWM = (s == Success) && len;
|
||||||
|
attributes.override_redirect = !netWM && CreationParams.Fullscreen;
|
||||||
|
|
||||||
// create new Window
|
// create new Window
|
||||||
attributes.override_redirect = false;
|
|
||||||
window = XCreateWindow(display,
|
window = XCreateWindow(display,
|
||||||
RootWindow(display, visual->screen),
|
RootWindow(display, visual->screen),
|
||||||
0, 0, Width, Height, 0, visual->depth,
|
0, 0, Width, Height, 0, visual->depth,
|
||||||
@ -761,6 +774,8 @@ bool CIrrDeviceLinux::createWindow()
|
|||||||
XSetWMProtocols(display, window, &wmDelete, 1);
|
XSetWMProtocols(display, window, &wmDelete, 1);
|
||||||
|
|
||||||
if (CreationParams.Fullscreen)
|
if (CreationParams.Fullscreen)
|
||||||
|
{
|
||||||
|
if (netWM)
|
||||||
{
|
{
|
||||||
// Workaround for Gnome which sometimes creates window smaller than display
|
// Workaround for Gnome which sometimes creates window smaller than display
|
||||||
XSizeHints *hints = XAllocSizeHints();
|
XSizeHints *hints = XAllocSizeHints();
|
||||||
@ -788,6 +803,18 @@ bool CIrrDeviceLinux::createWindow()
|
|||||||
xev.xclient.data.l[1] = WMFullscreenAtom;
|
xev.xclient.data.l[1] = WMFullscreenAtom;
|
||||||
XSendEvent(display, DefaultRootWindow(display), false, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
XSendEvent(display, DefaultRootWindow(display), false, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XSetInputFocus(display, window, RevertToParent, CurrentTime);
|
||||||
|
int grabKb = XGrabKeyboard(display, window, True, GrabModeAsync,
|
||||||
|
GrabModeAsync, CurrentTime);
|
||||||
|
IrrPrintXGrabError(grabKb, "XGrabKeyboard");
|
||||||
|
int grabPointer = XGrabPointer(display, window, True, ButtonPressMask,
|
||||||
|
GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
|
||||||
|
IrrPrintXGrabError(grabPointer, "XGrabPointer");
|
||||||
|
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user