Alexandre Julliard : server: Update child window positions when resizing a mirrored parent.
Alexandre Julliard
julliard at winehq.org
Tue Oct 5 12:03:05 CDT 2010
Module: wine
Branch: master
Commit: d076dfa8e817688641184e91b6ceedc72a13a296
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d076dfa8e817688641184e91b6ceedc72a13a296
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Oct 4 20:12:44 2010 +0200
server: Update child window positions when resizing a mirrored parent.
---
dlls/user32/tests/win.c | 20 ++++++++++++++++++++
server/window.c | 19 +++++++++++++++++--
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index f1f590c..50c5be5 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -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 );
}
diff --git a/server/window.c b/server/window.c
index 8900751..c8c075f 100644
--- a/server/window.c
+++ b/server/window.c
@@ -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))
{
More information about the wine-cvs
mailing list