Alexandre Julliard : user32: Don' t rely on the cached position for windows that have a mirrored parent.
Alexandre Julliard
julliard at winehq.org
Tue Oct 5 12:03:05 CDT 2010
Module: wine
Branch: master
Commit: 377820e313e72d064df3304af3032acf24a4e755
URL: http://source.winehq.org/git/wine.git/?a=commit;h=377820e313e72d064df3304af3032acf24a4e755
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Oct 4 20:12:36 2010 +0200
user32: Don't rely on the cached position for windows that have a mirrored parent.
---
dlls/user32/win.c | 11 +++++++++++
dlls/user32/win.h | 1 +
dlls/user32/winpos.c | 21 +++++++++++++++++++--
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index ee44278..1b67329 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -709,6 +709,12 @@ BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWind
WIN_ReleasePtr( win );
goto other_process;
}
+ if (parent->flags & WIN_CHILDREN_MOVED)
+ {
+ WIN_ReleasePtr( parent );
+ WIN_ReleasePtr( win );
+ goto other_process;
+ }
if (parent->dwExStyle & WS_EX_LAYOUTRTL)
{
mirror_rect( &parent->rectClient, &window_rect );
@@ -728,6 +734,11 @@ BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWind
goto other_process;
}
WIN_ReleasePtr( win );
+ if (parent->flags & WIN_CHILDREN_MOVED)
+ {
+ WIN_ReleasePtr( parent );
+ goto other_process;
+ }
win = parent;
OffsetRect( &window_rect, win->rectClient.left, win->rectClient.top );
OffsetRect( &client_rect, win->rectClient.left, win->rectClient.top );
diff --git a/dlls/user32/win.h b/dlls/user32/win.h
index 6907889..13ee58e 100644
--- a/dlls/user32/win.h
+++ b/dlls/user32/win.h
@@ -72,6 +72,7 @@ typedef struct tagWND
#define WIN_ISMDICLIENT 0x0008 /* Window is an MDIClient */
#define WIN_ISUNICODE 0x0010 /* Window is Unicode */
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
+#define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */
/* Window functions */
extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN;
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index ca3b8e0..716616f 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -445,7 +445,7 @@ static POINT WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, BOOL *mirrored )
mirror_from = TRUE;
offset.x += wndPtr->rectClient.right - wndPtr->rectClient.left;
}
- while (wndPtr != WND_DESKTOP)
+ for (;;)
{
offset.x += wndPtr->rectClient.left;
offset.y += wndPtr->rectClient.top;
@@ -453,6 +453,12 @@ static POINT WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, BOOL *mirrored )
WIN_ReleasePtr( wndPtr );
if (!(wndPtr = WIN_GetPtr( hwnd ))) break;
if (wndPtr == WND_OTHER_PROCESS) goto other_process;
+ if (wndPtr == WND_DESKTOP) break;
+ if (wndPtr->flags & WIN_CHILDREN_MOVED)
+ {
+ WIN_ReleasePtr( wndPtr );
+ goto other_process;
+ }
}
}
}
@@ -469,7 +475,7 @@ static POINT WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, BOOL *mirrored )
mirror_to = TRUE;
offset.x -= wndPtr->rectClient.right - wndPtr->rectClient.left;
}
- while (wndPtr != WND_DESKTOP)
+ for (;;)
{
offset.x -= wndPtr->rectClient.left;
offset.y -= wndPtr->rectClient.top;
@@ -477,6 +483,12 @@ static POINT WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, BOOL *mirrored )
WIN_ReleasePtr( wndPtr );
if (!(wndPtr = WIN_GetPtr( hwnd ))) break;
if (wndPtr == WND_OTHER_PROCESS) goto other_process;
+ if (wndPtr == WND_DESKTOP) break;
+ if (wndPtr->flags & WIN_CHILDREN_MOVED)
+ {
+ WIN_ReleasePtr( wndPtr );
+ goto other_process;
+ }
}
}
}
@@ -1932,6 +1944,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
WND *win;
BOOL ret;
RECT visible_rect, old_window_rect;
+ int old_width;
visible_rect = *window_rect;
USER_Driver->pWindowPosChanging( hwnd, insert_after, swp_flags,
@@ -1941,6 +1954,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
if (win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE;
+ old_width = win->rectClient.right - win->rectClient.left;
SERVER_START_REQ( set_window_pos )
{
@@ -1974,6 +1988,9 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
mirror_rect( &client, &win->rectWindow );
mirror_rect( &client, &win->rectClient );
}
+ /* if an RTL window is resized the children have moved */
+ if (win->dwExStyle & WS_EX_LAYOUTRTL && client_rect->right - client_rect->left != old_width)
+ win->flags |= WIN_CHILDREN_MOVED;
}
}
SERVER_END_REQ;
More information about the wine-cvs
mailing list