winecfg: Center main window on the screen.

Dmitry Timoshkov dmitry at baikal.ru
Wed Feb 8 02:17:15 CST 2012


For bug 21645.
---
 programs/winecfg/main.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
index 7376309..d196143 100644
--- a/programs/winecfg/main.c
+++ b/programs/winecfg/main.c
@@ -48,12 +48,26 @@ PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
 	break;
 
     case PSCB_INITIALIZED:
+    {
+        RECT rc;
+        HMONITOR hmon;
+        MONITORINFO info;
+        int x, y;
+
+        GetWindowRect( hWnd, &rc );
+        hmon = MonitorFromRect( &rc, MONITOR_DEFAULTTOPRIMARY );
+        info.cbSize = sizeof( info );
+        GetMonitorInfoW( hmon, &info );
+        x = (info.rcWork.left + info.rcWork.right - (rc.right - rc.left)) / 2;
+        y = (info.rcWork.top + info.rcWork.bottom - (rc.bottom - rc.top)) / 2;
+        SetWindowPos( hWnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
+
         /* Set the window icon */
         SendMessageW( hWnd, WM_SETICON, ICON_BIG,
                       (LPARAM)LoadIconW( (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE),
                                          MAKEINTRESOURCEW(IDI_WINECFG) ));
 	break;
-
+    }
     default:
 	break;
     }
-- 
1.7.8.4




More information about the wine-patches mailing list