Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- It should fix an occasional hang in Word 2016 when opening / closing the ribbon with Ctrl-F1.
dlls/user32/message.c | 3 +++ dlls/user32/spy.c | 3 ++- dlls/user32/user_private.h | 2 ++ dlls/user32/win.c | 8 +++++++- 4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 2717d91dbb5..45fc07bbff3 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -1890,6 +1890,9 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR return USER_Driver->pClipCursor( &rect ); } return USER_Driver->pClipCursor( NULL ); + case WM_WINE_UPDATEWINDOWSTATE: + update_window_state( hwnd ); + return 0; default: if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG) return USER_Driver->pWindowMessage( hwnd, msg, wparam, lparam ); diff --git a/dlls/user32/spy.c b/dlls/user32/spy.c index 8a2fa430b5d..dea97547b38 100644 --- a/dlls/user32/spy.c +++ b/dlls/user32/spy.c @@ -1150,7 +1150,7 @@ static const char * const CCMMessageTypeNames[SPY_MAX_CCMMSGNUM + 1] = "CCM_SETNOTIFYWINDOW" };
-#define SPY_MAX_WINEMSGNUM (WM_WINE_CLIPCURSOR - WM_WINE_DESTROYWINDOW) +#define SPY_MAX_WINEMSGNUM (WM_WINE_UPDATEWINDOWSTATE - WM_WINE_DESTROYWINDOW) static const char * const WINEMessageTypeNames[SPY_MAX_WINEMSGNUM + 1] = { "WM_WINE_DESTROYWINDOW", @@ -1163,6 +1163,7 @@ static const char * const WINEMessageTypeNames[SPY_MAX_WINEMSGNUM + 1] = "WM_WINE_KEYBOARD_LL_HOOK", "WM_WINE_MOUSE_LL_HOOK", "WM_WINE_CLIPCURSOR", + "WM_WINE_UPDATEWINDOWSTATE", };
/* Virtual key names */ diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 7e294558ef1..0230dd45001 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -56,6 +56,7 @@ enum wine_internal_message WM_WINE_KEYBOARD_LL_HOOK, WM_WINE_MOUSE_LL_HOOK, WM_WINE_CLIPCURSOR, + WM_WINE_UPDATEWINDOWSTATE, WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */ WM_WINE_LAST_DRIVER_MSG = 0x80001fff }; @@ -243,6 +244,7 @@ extern void move_window_bits( HWND hwnd, struct window_surface *old_surface, const RECT *window_rect, const RECT *valid_rects ) DECLSPEC_HIDDEN; extern void move_window_bits_parent( HWND hwnd, HWND parent, const RECT *window_rect, const RECT *valid_rects ) DECLSPEC_HIDDEN; +extern void update_window_state( HWND hwnd ) DECLSPEC_HIDDEN; extern void *get_hook_proc( void *proc, const WCHAR *module, HMODULE *free_module ) DECLSPEC_HIDDEN; extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN; extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN; diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 3323ed3e41b..49cebe99790 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -445,11 +445,17 @@ static void send_parent_notify( HWND hwnd, UINT msg ) * * Trigger an update of the window's driver state and surface. */ -static void update_window_state( HWND hwnd ) +void update_window_state( HWND hwnd ) { DPI_AWARENESS_CONTEXT context; RECT window_rect, client_rect, valid_rects[2];
+ if (!WIN_IsCurrentThread( hwnd )) + { + PostMessageW( hwnd, WM_WINE_UPDATEWINDOWSTATE, 0, 0 ); + return; + } + context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd )); WIN_GetRectangles( hwnd, COORDS_PARENT, &window_rect, &client_rect ); valid_rects[0] = valid_rects[1] = client_rect;