server: Update child window positions when resizing a mirrored parent.

This commit is contained in:
Alexandre Julliard 2010-10-04 20:12:44 +02:00
parent 377820e313
commit d076dfa8e8
2 changed files with 37 additions and 2 deletions

View file

@ -6213,6 +6213,26 @@ static void test_rtl_layout(void)
pt.x = pt.y = 12;
MapWindowPoints( child, parent, &pt, 1 );
ok( pt.x == 22 && pt.y == 22, "wrong point %d,%d\n", pt.x, pt.y );
SetWindowPos( parent, 0, 0, 0, 250, 250, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
GetWindowRect( parent, &r );
ok( r.left == 100 && r.right == 350, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
GetWindowRect( child, &r );
ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
SetWindowLongW( parent, GWL_EXSTYLE, 0 );
GetWindowRect( child, &r );
ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 220 && r.right == 240, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
SetWindowLongW( parent, GWL_EXSTYLE, WS_EX_LAYOUTRTL );
GetWindowRect( child, &r );
ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
SetWindowPos( child, 0, 0, 0, 30, 30, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
GetWindowRect( child, &r );
ok( r.left == 310 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 10 && r.right == 40, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
DestroyWindow( child );
DestroyWindow( parent );
}

View file

@ -1536,6 +1536,21 @@ static void set_window_pos( struct window *win, struct window *previous,
if (swp_flags & SWP_SHOWWINDOW) win->style |= WS_VISIBLE;
else if (swp_flags & SWP_HIDEWINDOW) win->style &= ~WS_VISIBLE;
/* keep children at the same position relative to top right corner when the parent is mirrored */
if (win->ex_style & WS_EX_LAYOUTRTL)
{
struct window *child;
int old_size = old_client_rect.right - old_client_rect.left;
int new_size = win->client_rect.right - win->client_rect.left;
if (old_size != new_size) LIST_FOR_EACH_ENTRY( child, &win->children, struct window, entry )
{
offset_rect( &child->window_rect, new_size - old_size, 0 );
offset_rect( &child->visible_rect, new_size - old_size, 0 );
offset_rect( &child->client_rect, new_size - old_size, 0 );
}
}
/* if the window is not visible, everything is easy */
if (!visible) return;
@ -2237,7 +2252,7 @@ DECL_HANDLER(get_windows_offset)
if (win->ex_style & WS_EX_LAYOUTRTL)
{
mirror_from = 1;
reply->x += win->client_rect.right - win->client_rect.left - 1;
reply->x += win->client_rect.right - win->client_rect.left;
}
while (win && !is_desktop_window(win))
{
@ -2252,7 +2267,7 @@ DECL_HANDLER(get_windows_offset)
if (win->ex_style & WS_EX_LAYOUTRTL)
{
mirror_to = 1;
reply->x -= win->client_rect.right - win->client_rect.left - 1;
reply->x -= win->client_rect.right - win->client_rect.left;
}
while (win && !is_desktop_window(win))
{