Alexandre Julliard : user32: Use WIN_GetRectangles where possible instead of mapping coordinates explicitly .

Alexandre Julliard julliard at winehq.org
Tue Sep 7 11:22:56 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep  7 15:11:24 2010 +0200

user32: Use WIN_GetRectangles where possible instead of mapping coordinates explicitly.

---

 dlls/user32/edit.c     |    3 +--
 dlls/user32/mdi.c      |    3 +--
 dlls/user32/menu.c     |    3 +--
 dlls/user32/painting.c |    6 ++----
 dlls/user32/win.c      |    7 +------
 dlls/user32/winpos.c   |    4 +---
 6 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 05a68ea..8f59d95 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -3109,8 +3109,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
         {
             RECT rc;
             /* Windows places the menu at the edit's center in this case */
-            GetClientRect(es->hwndSelf, &rc);
-            MapWindowPoints(es->hwndSelf, 0, (POINT *)&rc, 2);
+            WIN_GetRectangles( es->hwndSelf, COORDS_SCREEN, NULL, &rc );
             x = rc.left + (rc.right - rc.left) / 2;
             y = rc.top + (rc.bottom - rc.top) / 2;
         }
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index d382eb7..bcaef76 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -1720,13 +1720,12 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
             if (style & WS_VISIBLE)
             {
                 RECT rect;
-                GetWindowRect( list[i], &rect );
+                WIN_GetRectangles( list[i], COORDS_PARENT, &rect, NULL );
                 UnionRect( &childRect, &rect, &childRect );
             }
         }
         HeapFree( GetProcessHeap(), 0, list );
     }
-    MapWindowPoints( 0, hwnd, (POINT *)&childRect, 2 );
     UnionRect( &childRect, &clientRect, &childRect );
 
     /* set common info values */
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 764b7ea..e4dc607 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3632,8 +3632,7 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
 		return (UINT)-1;
 
             /* Refresh the frame to reflect the change */
-            GetWindowRect(parentMenu->hWnd, &rc);
-            MapWindowPoints(0, parentMenu->hWnd, (POINT *)&rc, 2);
+            WIN_GetRectangles( parentMenu->hWnd, COORDS_CLIENT, &rc, NULL );
             rc.bottom = 0;
             RedrawWindow(parentMenu->hWnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
 	}
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 2a29db5..94bb630 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -637,8 +637,7 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags )
 
         /* check if update rgn overlaps with nonclient area */
         type = GetRgnBox( whole_rgn, &update );
-        GetClientRect( hwnd, &client );
-        MapWindowPoints( hwnd, 0, (POINT *)&client, 2 );
+        WIN_GetRectangles( hwnd, COORDS_SCREEN, 0, &client );
 
         if ((*flags & UPDATE_NONCLIENT) ||
             update.left < client.left || update.top < client.top ||
@@ -1486,8 +1485,7 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
             RECT r, dummy;
             for (i = 0; list[i]; i++)
             {
-                GetWindowRect( list[i], &r );
-                MapWindowPoints( 0, hwnd, (POINT *)&r, 2 );
+                WIN_GetRectangles( list[i], COORDS_PARENT, &r, NULL );
                 if (!rect || IntersectRect(&dummy, &r, rect))
                     SetWindowPos( list[i], 0, r.left + dx, r.top  + dy, 0, 0,
                                   SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 8de2843..4f85547 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3350,12 +3350,7 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size )
 BOOL WINAPI GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
 {
     if (!pwi) return FALSE;
-    if (!IsWindow(hwnd)) return FALSE;
-
-    GetWindowRect(hwnd, &pwi->rcWindow);
-    GetClientRect(hwnd, &pwi->rcClient);
-    /* translate to screen coordinates */
-    MapWindowPoints(hwnd, 0, (LPPOINT)&pwi->rcClient, 2);
+    if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &pwi->rcWindow, &pwi->rcClient )) return FALSE;
 
     pwi->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
     pwi->dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 2fb0138..485f32d 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2428,12 +2428,10 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
       /* Get min/max info */
 
     WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
-    GetWindowRect( hwnd, &sizingRect );
+    WIN_GetRectangles( hwnd, COORDS_PARENT, &sizingRect, NULL );
     if (style & WS_CHILD)
     {
         parent = GetParent(hwnd);
-        /* make sizing rect relative to parent */
-        MapWindowPoints( 0, parent, (POINT*)&sizingRect, 2 );
         GetClientRect( parent, &mouseRect );
     }
     else




More information about the wine-cvs mailing list