Fix window resizing, and add a harmless workaround for my obscure WM. Recreating the window (when the depth changes) now works too.
This commit is contained in:
@@ -50,14 +50,14 @@ CString LowLevelWindow_X11::TryVideoMode(RageDisplay::VideoModeParams p, bool &b
|
|||||||
hints.min_width = hints.max_width = hints.base_width = p.width;
|
hints.min_width = hints.max_width = hints.base_width = p.width;
|
||||||
hints.min_height = hints.max_height = hints.base_height = p.height;
|
hints.min_height = hints.max_height = hints.base_height = p.height;
|
||||||
|
|
||||||
X11Helper::OpenMask(StructureNotifyMask);
|
|
||||||
|
|
||||||
if(!windowIsOpen || p.bpp != CurrentParams.bpp)
|
if(!windowIsOpen || p.bpp != CurrentParams.bpp)
|
||||||
{
|
{
|
||||||
int visAttribs[32];
|
int visAttribs[32];
|
||||||
XVisualInfo *xvi;
|
XVisualInfo *xvi;
|
||||||
GLXContext ctxt;
|
GLXContext ctxt;
|
||||||
|
|
||||||
|
X11Helper::OpenMask(StructureNotifyMask);
|
||||||
|
|
||||||
// Different depth, or we didn't make a window before. New context.
|
// Different depth, or we didn't make a window before. New context.
|
||||||
bNewDeviceOut = true;
|
bNewDeviceOut = true;
|
||||||
|
|
||||||
@@ -90,9 +90,7 @@ CString LowLevelWindow_X11::TryVideoMode(RageDisplay::VideoModeParams p, bool &b
|
|||||||
return "No visual available for that depth.";
|
return "No visual available for that depth.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taking a hint from SDL.
|
if(!X11Helper::MakeWindow(xvi->screen, xvi->depth, xvi->visual, p.width, p.height) )
|
||||||
|
|
||||||
if(!X11Helper::MakeWindow(xvi->screen, xvi->depth, xvi->visual) )
|
|
||||||
{
|
{
|
||||||
return "Failed to create the window.";
|
return "Failed to create the window.";
|
||||||
}
|
}
|
||||||
@@ -102,19 +100,6 @@ CString LowLevelWindow_X11::TryVideoMode(RageDisplay::VideoModeParams p, bool &b
|
|||||||
|
|
||||||
glXMakeCurrent(X11Helper::Dpy, X11Helper::Win, ctxt);
|
glXMakeCurrent(X11Helper::Dpy, X11Helper::Win, ctxt);
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// We're remodeling the existing window, and not touching the
|
|
||||||
// context.
|
|
||||||
bNewDeviceOut = false;
|
|
||||||
// Remap the window to work around possible buggy WMs and/or
|
|
||||||
// X servers
|
|
||||||
XUnmapWindow(X11Helper::Dpy, X11Helper::Win);
|
|
||||||
}
|
|
||||||
|
|
||||||
XSetWMNormalHints(X11Helper::Dpy, X11Helper::Win, &hints);
|
|
||||||
|
|
||||||
XMapWindow(X11Helper::Dpy, X11Helper::Win);
|
XMapWindow(X11Helper::Dpy, X11Helper::Win);
|
||||||
|
|
||||||
// HACK: Wait for the MapNotify event, without spinning and
|
// HACK: Wait for the MapNotify event, without spinning and
|
||||||
@@ -140,10 +125,27 @@ CString LowLevelWindow_X11::TryVideoMode(RageDisplay::VideoModeParams p, bool &b
|
|||||||
otherEvs.pop();
|
otherEvs.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentParams = p;
|
|
||||||
|
|
||||||
X11Helper::CloseMask(StructureNotifyMask);
|
X11Helper::CloseMask(StructureNotifyMask);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We're remodeling the existing window, and not touching the
|
||||||
|
// context.
|
||||||
|
bNewDeviceOut = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do this before resizing the window so that pane-style WMs (Ion,
|
||||||
|
// ratpoison) don't resize us back inappropriately.
|
||||||
|
XSetWMNormalHints(X11Helper::Dpy, X11Helper::Win, &hints);
|
||||||
|
|
||||||
|
// Do this even if we just created the window -- works around Ion2 not
|
||||||
|
// catching WM normal hints changes in mapped windows.
|
||||||
|
XResizeWindow(X11Helper::Dpy, X11Helper::Win, p.width, p.height);
|
||||||
|
|
||||||
|
CurrentParams = p;
|
||||||
|
|
||||||
return ""; // Success
|
return ""; // Success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user