Alexandre Julliard : server: Moving a window should only expose the immediate parent.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 27 13:57:12 CDT 2007


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 27 15:21:19 2007 +0200

server: Moving a window should only expose the immediate parent.

---

 dlls/user32/tests/win.c |   18 ++++++------------
 server/window.c         |   31 +++++++++++--------------------
 2 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 34aadb1..f3a2ac3 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4231,12 +4231,9 @@ static void test_GetUpdateRect(void)
     ShowWindow(hchild, SW_HIDE);
     SetRect(&rc2, 0, 0, 0, 0);
     GetUpdateRect(hgrandparent, &rc1, FALSE);
-    todo_wine
-    {
-        ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n",
-                rc1.left, rc1.top, rc1.right, rc1.bottom,
-                rc2.left, rc2.top, rc2.right, rc2.bottom);
-    }
+    ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n",
+       rc1.left, rc1.top, rc1.right, rc1.bottom,
+       rc2.left, rc2.top, rc2.right, rc2.bottom);
 
     SetRect(&rc2, 10, 10, 40, 40);
     GetUpdateRect(hparent, &rc1, FALSE);
@@ -4277,12 +4274,9 @@ static void test_GetUpdateRect(void)
     ShowWindow(hchild, SW_HIDE);
     SetRect(&rc2, 0, 0, 0, 0);
     GetUpdateRect(hgrandparent, &rc1, FALSE);
-    todo_wine
-    {
-        ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n",
-                rc1.left, rc1.top, rc1.right, rc1.bottom,
-                rc2.left, rc2.top, rc2.right, rc2.bottom);
-    }
+    ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n",
+       rc1.left, rc1.top, rc1.right, rc1.bottom,
+       rc2.left, rc2.top, rc2.right, rc2.bottom);
 
     SetRect(&rc2, 10, 10, 40, 40);
     GetUpdateRect(hparent, &rc1, FALSE);
diff --git a/server/window.c b/server/window.c
index c930992..8971dc6 100644
--- a/server/window.c
+++ b/server/window.c
@@ -1293,28 +1293,19 @@ static unsigned int get_window_update_flags( struct window *win, struct window *
 }
 
 
-/* expose a region of a window, looking for the top most parent that needs to be exposed */
+/* expose a region of a window on its parent */
 /* the region is in window coordinates */
-static void expose_window( struct window *win, struct window *top, struct region *region )
+static void expose_window( struct window *win, struct region *region )
 {
-    struct window *parent, *ptr;
-    int offset_x, offset_y;
-
-    /* find the top most parent that doesn't clip either siblings or children */
-    for (parent = ptr = win; ptr != top; ptr = ptr->parent)
-    {
-        if (!(ptr->style & WS_CLIPCHILDREN)) parent = ptr;
-        if (!(ptr->style & WS_CLIPSIBLINGS)) parent = ptr->parent;
-    }
-    if (parent == win && parent != top && win->parent)
-        parent = win->parent;  /* always go up at least one level if possible */
+    struct window *parent = win;
+    int offset_x = win->window_rect.left - win->client_rect.left;
+    int offset_y = win->window_rect.top - win->client_rect.top;
 
-    offset_x = win->window_rect.left - win->client_rect.left;
-    offset_y = win->window_rect.top - win->client_rect.top;
-    for (ptr = win; ptr != parent && !is_desktop_window(ptr); ptr = ptr->parent)
+    if (win->parent && !is_desktop_window(win->parent))
     {
-        offset_x += ptr->client_rect.left;
-        offset_y += ptr->client_rect.top;
+        offset_x += win->client_rect.left;
+        offset_y += win->client_rect.top;
+        parent = win->parent;
     }
     offset_region( region, offset_x, offset_y );
     redraw_window( parent, region, 0, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN );
@@ -1370,7 +1361,7 @@ static void set_window_pos( struct window *win, struct window *previous,
         offset_region( old_vis_rgn, old_window_rect.left - window_rect->left,
                        old_window_rect.top - window_rect->top );
         if (xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ))
-            expose_window( win, top, new_vis_rgn );
+            expose_window( win, new_vis_rgn );
     }
     free_region( old_vis_rgn );
 
@@ -1455,7 +1446,7 @@ static void set_window_region( struct window *win, struct region *region, int re
     {
         /* expose anything revealed by the change */
         if (xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ))
-            expose_window( win, top, new_vis_rgn );
+            expose_window( win, new_vis_rgn );
         free_region( new_vis_rgn );
     }
 




More information about the wine-cvs mailing list