From 265d9d56dfd2812c65811caf35db786c73f1b6c4 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 3 Jun 2005 18:28:20 +0000 Subject: [PATCH] Center the window in the display --- stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index d3a8bf8854..bc6ced53b1 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -155,6 +155,13 @@ CString LowLevelWindow_X11::TryVideoMode( RageDisplay::VideoModeParams p, bool & // catching WM normal hints changes in mapped windows. XResizeWindow( X11Helper::Dpy, X11Helper::Win, p.width, p.height ); + // Center the window in the display. + int w = DisplayWidth( X11Helper::Dpy, DefaultScreen(X11Helper::Dpy) ); + int h = DisplayHeight( X11Helper::Dpy, DefaultScreen(X11Helper::Dpy) ); + int x = (w - p.width)/2; + int y = (h - p.height)/2; + XMoveWindow( X11Helper::Dpy, X11Helper::Win, x, y ); + CurrentParams = p; return ""; // Success