[2/2] server: Make sure that region and rectangle have the same origin before calling rect_in_region().

Dmitry Timoshkov dmitry at baikal.ru
Wed May 30 01:51:00 CDT 2012


win_region is stored relative to window rectangle while rect is in client
coordinates which are relative to parent client area.
---
 dlls/user32/tests/win.c |    2 --
 server/window.c         |    4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 23337ca..2835672 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7107,10 +7107,8 @@ static void test_toplevel_zorder(void)
     ok(!ret, "update rect of hwnd_2 is not empty\n");
 
     hwnd = GetWindow(hwnd_2, GW_HWNDNEXT);
-todo_wine
     ok(hwnd == hwnd_1, "expected next window %p, got %p\n", hwnd_1, hwnd);
     hwnd = GetWindow(hwnd_1, GW_HWNDPREV);
-todo_wine
     ok(hwnd == hwnd_2, "expected previous window %p, got %p\n", hwnd_2, hwnd);
 
     DestroyWindow(hwnd_1);
diff --git a/server/window.c b/server/window.c
index 329fdb6..bd15759 100644
--- a/server/window.c
+++ b/server/window.c
@@ -2457,7 +2457,9 @@ DECL_HANDLER(update_window_zorder)
         if (!(ptr->style & WS_VISIBLE)) continue;
         if (ptr->ex_style & WS_EX_TRANSPARENT) continue;
         if (!intersect_rect( &tmp, &ptr->visible_rect, &rect )) continue;
-        if (ptr->win_region && !rect_in_region( ptr->win_region, &rect )) continue;
+        tmp = rect;
+        offset_rect( &tmp, -ptr->client_rect.left, -ptr->client_rect.top );
+        if (ptr->win_region && !rect_in_region( ptr->win_region, &tmp )) continue;
         /* found a window obscuring the rectangle, now move win above this one */
         /* making sure to not violate the topmost rule */
         if (!(ptr->ex_style & WS_EX_TOPMOST) || (win->ex_style & WS_EX_TOPMOST))
-- 
1.7.10.1




More information about the wine-patches mailing list