user32: Make sure update_window_state() is always executed on the owner thread.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Matteo Bruni 2020-06-05 11:47:30 +02:00 committed by Alexandre Julliard
parent 61ff6c306d
commit f0e9cf1145
4 changed files with 14 additions and 2 deletions

View File

@ -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 );

View File

@ -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 */

View File

@ -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;

View File

@ -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;