From 5bd497f3caa9c681b6d50c48f4a84b0b9d7eecb2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 27 Aug 2007 15:21:19 +0200 Subject: [PATCH] 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 34aadb1c962..f3a2ac35631 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 c9309926f0b..8971dc6c978 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; + 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; - /* find the top most parent that doesn't clip either siblings or children */ - for (parent = ptr = win; ptr != top; ptr = ptr->parent) + if (win->parent && !is_desktop_window(win->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 */ - - 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) - { - 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 ); }