Alexandre Julliard : user32: Add a helper function to retrieve the virtual screen rectangle.

Alexandre Julliard julliard at winehq.org
Wed Sep 5 15:36:45 CDT 2012


Module: wine
Branch: master
Commit: 75b641fc75727138cab2230453ea0b859bf5437c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=75b641fc75727138cab2230453ea0b859bf5437c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep  5 19:28:50 2012 +0200

user32: Add a helper function to retrieve the virtual screen rectangle.

---

 dlls/user32/sysparams.c    |   26 ++++++++++++++------------
 dlls/user32/user_private.h |    1 +
 dlls/user32/winpos.c       |    6 +-----
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 4603cf4..b27b506 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -523,6 +523,12 @@ static void get_monitors_info( struct monitor_info *info )
     EnumDisplayMonitors( 0, NULL, monitor_info_proc, (LPARAM)info );
 }
 
+RECT get_virtual_screen_rect(void)
+{
+    struct monitor_info info;
+    get_monitors_info( &info );
+    return info.virtual_rect;
+}
 
 /* get text metrics and/or "average" char width of the specified logfont 
  * for the specified dc */
@@ -2856,27 +2862,23 @@ INT WINAPI GetSystemMetrics( INT index )
         return 1;
     case SM_XVIRTUALSCREEN:
     {
-        struct monitor_info info;
-        get_monitors_info( &info );
-        return info.virtual_rect.left;
+        RECT rect = get_virtual_screen_rect();
+        return rect.left;
     }
     case SM_YVIRTUALSCREEN:
     {
-        struct monitor_info info;
-        get_monitors_info( &info );
-        return info.virtual_rect.top;
+        RECT rect = get_virtual_screen_rect();
+        return rect.top;
     }
     case SM_CXVIRTUALSCREEN:
     {
-        struct monitor_info info;
-        get_monitors_info( &info );
-        return info.virtual_rect.right - info.virtual_rect.left;
+        RECT rect = get_virtual_screen_rect();
+        return rect.right - rect.left;
     }
     case SM_CYVIRTUALSCREEN:
     {
-        struct monitor_info info;
-        get_monitors_info( &info );
-        return info.virtual_rect.bottom - info.virtual_rect.top;
+        RECT rect = get_virtual_screen_rect();
+        return rect.bottom - rect.top;
     }
     case SM_CMONITORS:
     {
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 2bd8ad8..a57751f 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -214,6 +214,7 @@ extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
 extern void invalidate_dce( struct tagWND *win, const RECT *rect ) DECLSPEC_HIDDEN;
 extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
 extern void *get_hook_proc( void *proc, const WCHAR *module ) DECLSPEC_HIDDEN;
+extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
 extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
 extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
 extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags ) DECLSPEC_HIDDEN;
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 507a5ce..27489fe 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2544,11 +2544,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
     else
     {
         parent = 0;
-        GetClientRect( GetDesktopWindow(), &mouseRect );
-        mouseRect.left = GetSystemMetrics( SM_XVIRTUALSCREEN );
-        mouseRect.top = GetSystemMetrics( SM_YVIRTUALSCREEN );
-        mouseRect.right = mouseRect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN );
-        mouseRect.bottom = mouseRect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN );
+        mouseRect = get_virtual_screen_rect();
     }
 
     if (ON_LEFT_BORDER(hittest))




More information about the wine-cvs mailing list