From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 9 +++++- dlls/win32u/message.c | 18 +++++++++++ dlls/win32u/spy.c | 1 + dlls/winex11.drv/event.c | 68 ++++----------------------------------- dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/window.c | 9 +++++- dlls/winex11.drv/x11drv.h | 1 + include/ntuser.h | 1 + include/wine/gdi_driver.h | 1 + 9 files changed, 45 insertions(+), 64 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 92bad66fc2f..3ba5402b82e 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -876,7 +876,12 @@ static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, c return TRUE; }
-extern BOOL nulldrv_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ) +static BOOL nulldrv_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ) +{ + return FALSE; +} + +static BOOL nulldrv_GetWindowStateUpdates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, RECT *rect ) { return FALSE; } @@ -1279,6 +1284,7 @@ static const struct user_driver_funcs lazy_load_driver = nulldrv_WindowMessage, nulldrv_WindowPosChanging, nulldrv_GetWindowStyleMasks, + nulldrv_GetWindowStateUpdates, nulldrv_CreateWindowSurface, nulldrv_MoveWindowBits, nulldrv_WindowPosChanged, @@ -1367,6 +1373,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version SET_USER_FUNC(WindowMessage); SET_USER_FUNC(WindowPosChanging); SET_USER_FUNC(GetWindowStyleMasks); + SET_USER_FUNC(GetWindowStateUpdates); SET_USER_FUNC(CreateWindowSurface); SET_USER_FUNC(MoveWindowBits); SET_USER_FUNC(WindowPosChanged); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 044310a2f0e..4d5abfa4aab 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2127,6 +2127,24 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR if (!ime_hwnd || ime_hwnd == NtUserGetParent( hwnd )) return 0; return send_message( ime_hwnd, WM_IME_NOTIFY, wparam, lparam ); } + case WM_WINE_WINDOW_STATE_CHANGED: + { + UINT state_cmd, config_cmd; + RECT window_rect; + + if (!user_driver->pGetWindowStateUpdates( hwnd, &state_cmd, &config_cmd, &window_rect )) return 0; + if (state_cmd) + { + if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); + send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); + } + if (config_cmd) + { + if (LOWORD(config_cmd) == SC_MOVE) NtUserSetRawWindowPos( hwnd, window_rect, HIWORD(config_cmd), FALSE ); + else send_message( hwnd, WM_SYSCOMMAND, LOWORD(config_cmd), 0 ); + } + return 0; + } case WM_WINE_UPDATEWINDOWSTATE: update_window_state( hwnd ); return 0; diff --git a/dlls/win32u/spy.c b/dlls/win32u/spy.c index f44771fdb90..4afe4917e78 100644 --- a/dlls/win32u/spy.c +++ b/dlls/win32u/spy.c @@ -1140,6 +1140,7 @@ static const char * const WINEMessageTypeNames[SPY_MAX_WINEMSGNUM + 1] = "WM_WINE_KEYBOARD_LL_HOOK", "WM_WINE_MOUSE_LL_HOOK", "WM_WINE_IME_NOTIFY", + "WM_WINE_WINDOW_STATE_CHANGED", "WM_WINE_UPDATEWINDOWSTATE", };
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 9b9d626fc9a..aee4a827b52 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1088,7 +1088,6 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) struct x11drv_win_data *data; RECT rect; POINT pos = {event->x, event->y}; - UINT config_cmd, state_cmd;
if (!hwnd) return FALSE; if (!(data = get_win_data( hwnd ))) return FALSE; @@ -1110,21 +1109,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
release_win_data( data );
- if (!get_window_state_updates( hwnd, &state_cmd, &config_cmd, &rect )) return FALSE; - - if (state_cmd) - { - if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); - send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); - } - - if (config_cmd) - { - if (LOWORD(config_cmd) == SC_MOVE) NtUserSetRawWindowPos( hwnd, rect, HIWORD(config_cmd), FALSE ); - else send_message( hwnd, WM_SYSCOMMAND, LOWORD(config_cmd), 0 ); - } - - return TRUE; + return NtUserPostMessage( hwnd, WM_WINE_WINDOW_STATE_CHANGED, 0, 0 ); }
/*********************************************************************** @@ -1136,7 +1121,6 @@ static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *xev ) struct x11drv_win_data *data; RECT rect; POINT pos = {event->x, event->y}; - UINT config_cmd, state_cmd;
if (!hwnd) return FALSE; if (!(data = get_win_data( hwnd ))) return FALSE; @@ -1165,21 +1149,7 @@ static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
release_win_data( data );
- if (!get_window_state_updates( hwnd, &state_cmd, &config_cmd, &rect )) return FALSE; - - if (state_cmd) - { - if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); - send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); - } - - if (config_cmd) - { - if (LOWORD(config_cmd) == SC_MOVE) NtUserSetRawWindowPos( hwnd, rect, HIWORD(config_cmd), FALSE ); - else send_message( hwnd, WM_SYSCOMMAND, LOWORD(config_cmd), 0 ); - } - - return TRUE; + return NtUserPostMessage( hwnd, WM_WINE_WINDOW_STATE_CHANGED, 0, 0 ); }
/*********************************************************************** @@ -1241,27 +1211,14 @@ static int get_window_xembed_info( Display *display, Window window ) static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event ) { struct x11drv_win_data *data; - UINT value = 0, state_cmd = 0, config_cmd = 0; - RECT rect; + UINT value = 0;
if (!(data = get_win_data( hwnd ))) return; if (event->state == PropertyNewValue) value = get_window_wm_state( event->display, event->window ); window_wm_state_notify( data, event->serial, value ); release_win_data( data );
- if (!get_window_state_updates( hwnd, &state_cmd, &config_cmd, &rect )) return; - - if (state_cmd) - { - if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); - send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); - } - - if (config_cmd) - { - if (LOWORD(config_cmd) == SC_MOVE) NtUserSetRawWindowPos( hwnd, rect, HIWORD(config_cmd), FALSE ); - else send_message( hwnd, WM_SYSCOMMAND, LOWORD(config_cmd), 0 ); - } + NtUserPostMessage( hwnd, WM_WINE_WINDOW_STATE_CHANGED, 0, 0 ); }
static void handle_xembed_info_notify( HWND hwnd, XPropertyEvent *event ) @@ -1278,27 +1235,14 @@ static void handle_xembed_info_notify( HWND hwnd, XPropertyEvent *event ) static void handle_net_wm_state_notify( HWND hwnd, XPropertyEvent *event ) { struct x11drv_win_data *data; - UINT value = 0, state_cmd = 0, config_cmd = 0; - RECT rect; + UINT value = 0;
if (!(data = get_win_data( hwnd ))) return; if (event->state == PropertyNewValue) value = get_window_net_wm_state( event->display, event->window ); window_net_wm_state_notify( data, event->serial, value ); release_win_data( data );
- if (!get_window_state_updates( hwnd, &state_cmd, &config_cmd, &rect )) return; - - if (state_cmd) - { - if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); - send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); - } - - if (config_cmd) - { - if (LOWORD(config_cmd) == SC_MOVE) NtUserSetRawWindowPos( hwnd, rect, HIWORD(config_cmd), FALSE ); - else send_message( hwnd, WM_SYSCOMMAND, LOWORD(config_cmd), 0 ); - } + NtUserPostMessage( hwnd, WM_WINE_WINDOW_STATE_CHANGED, 0, 0 ); }
/*********************************************************************** diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index e0f465a2771..37971dc8236 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -447,6 +447,7 @@ static const struct user_driver_funcs x11drv_funcs = .pWindowMessage = X11DRV_WindowMessage, .pWindowPosChanging = X11DRV_WindowPosChanging, .pGetWindowStyleMasks = X11DRV_GetWindowStyleMasks, + .pGetWindowStateUpdates = X11DRV_GetWindowStateUpdates, .pCreateWindowSurface = X11DRV_CreateWindowSurface, .pMoveWindowBits = X11DRV_MoveWindowBits, .pWindowPosChanged = X11DRV_WindowPosChanged, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f5edfe4ed64..793f0417c91 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1602,10 +1602,15 @@ static UINT window_update_client_config( struct x11drv_win_data *data ) return MAKELONG(SC_MOVE, flags); }
-BOOL get_window_state_updates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, RECT *rect ) +/*********************************************************************** + * GetWindowStateUpdates (X11DRV.@) + */ +BOOL X11DRV_GetWindowStateUpdates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, RECT *rect ) { struct x11drv_win_data *data;
+ TRACE( "hwnd %p, state_cmd %p, config_cmd %p, rect %p\n", hwnd, state_cmd, config_cmd, rect ); + if (!(data = get_win_data( hwnd ))) return FALSE;
*state_cmd = window_update_client_state( data ); @@ -1613,6 +1618,8 @@ BOOL get_window_state_updates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, REC *rect = window_rect_from_visible( &data->rects, data->current_state.rect );
release_win_data( data ); + + TRACE( "returning state_cmd %#x, config_cmd %#x, rect %s\n", *state_cmd, *config_cmd, wine_dbgstr_rect(rect) ); return *state_cmd || *config_cmd; }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 5641ea407f8..4df9d6e937d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -243,6 +243,7 @@ extern void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ); extern BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ); +extern BOOL X11DRV_GetWindowStateUpdates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, RECT *rect ); extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ); extern void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *old_rects, const struct window_rects *new_rects, const RECT *valid_rects ); diff --git a/include/ntuser.h b/include/ntuser.h index 3d981927395..3db46268b10 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -605,6 +605,7 @@ enum wine_internal_message WM_WINE_KEYBOARD_LL_HOOK, WM_WINE_MOUSE_LL_HOOK, WM_WINE_IME_NOTIFY, + WM_WINE_WINDOW_STATE_CHANGED, WM_WINE_UPDATEWINDOWSTATE, WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */ WM_WINE_CLIPCURSOR = 0x80001ff0, /* internal driver notification messages */ diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 09b5dd1e73f..9c0e000d7a8 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -385,6 +385,7 @@ struct user_driver_funcs LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const struct window_rects *); BOOL (*pGetWindowStyleMasks)(HWND,UINT,UINT,UINT*,UINT*); + BOOL (*pGetWindowStateUpdates)(HWND,UINT*,UINT*,RECT*); BOOL (*pCreateWindowSurface)(HWND,BOOL,const RECT *,struct window_surface**); void (*pMoveWindowBits)(HWND,const struct window_rects *,const struct window_rects *,const RECT *); void (*pWindowPosChanged)(HWND,HWND,HWND,UINT,BOOL,const struct window_rects*,struct window_surface*);