howl's patch for fixing LowLevelWindow (stepmania4-fullscreen-focus-lost-and-restore-resolution2.patch)

http://www.stepmania.com/forums/showthread.php?t=23693

here's hoping i don't have to kick myself off the project
This commit is contained in:
AJ Kelly
2010-06-10 17:05:54 -05:00
parent 70c14a714a
commit 61609f2605
2 changed files with 571 additions and 541 deletions
+3
View File
@@ -16,6 +16,9 @@ _____________________________________________________________________________
* [Actor] add basezoom, basezoomz, GetBaseZoomY(), GetBaseZoomZ(), and
GetGlow() Lua bindings
* [Screen] add GetScreenType() Lua binding.
* howl's patch for fixing LowLevelWindow
(stepmania4-fullscreen-focus-lost-and-restore-resolution2.patch)
http://www.stepmania.com/forums/showthread.php?t=23693
20100608
--------
+32 -5
View File
@@ -232,20 +232,47 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
}
int rate = XRRConfigCurrentRate( g_pScreenConfig );
// Make a window fixed size, don't let resize it or maximize it.
// Do this before resizing the window so that pane-style WMs (Ion,
// ratpoison) don't resize us back inappropriately.
{
XSizeHints hints;
hints.flags = PBaseSize;
hints.base_width = p.width;
hints.base_height = p.height;
hints.flags = PMinSize|PMaxSize|PWinGravity;
hints.min_width = hints.max_width = p.width;
hints.min_height = hints.max_height = p.height;
hints.win_gravity = CenterGravity;
XSetWMNormalHints( Dpy, Win, &hints );
}
// Do this even if we just created the window -- works around Ion2 not
// catching WM normal hints changes in mapped windows.
// Workaround for metacity and compiz, if the window have the same resolution or higher than the screen
// it gets automaximized even when the window is set to don't let do it.
// This happens changing from fullscreen to window mode and our screen resolution is bigger.
{
XEvent xev;
Atom wm_state = XInternAtom(Dpy, "_NET_WM_STATE", False);
Atom maximized_vert = XInternAtom(Dpy, "_NET_WM_STATE_MAXIMIZED_VERT", False);
Atom maximized_horz = XInternAtom(Dpy, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
memset(&xev, 0, sizeof(xev));
xev.type = ClientMessage;
xev.xclient.window = Win;
xev.xclient.message_type = wm_state;
xev.xclient.format = 32;
xev.xclient.data.l[0] = 1;
xev.xclient.data.l[1] = maximized_vert;
xev.xclient.data.l[2] = 0;
XSendEvent(Dpy, DefaultRootWindow(Dpy), False, SubstructureNotifyMask, &xev);
xev.xclient.data.l[1] = maximized_horz;
XSendEvent(Dpy, DefaultRootWindow(Dpy), False, SubstructureNotifyMask, &xev);
// This one is needed for compiz, if the window reaches out of bounds of the screen it becames destroyed, only the window, the program is left running.
XMoveWindow( Dpy, Win, 0, 0 );
}
// Resize the window.
XResizeWindow( Dpy, Win, p.width, p.height );
CurrentParams = p;