From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 21 +++++++-------------- dlls/winex11.drv/window.c | 18 ++++++++++++++++-- dlls/winex11.drv/x11drv.h | 3 +-- 3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 0a91148acde..1008769f0b9 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1123,11 +1123,10 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) SetRect( &rect, pos.x, pos.y, pos.x + event->width, pos.y + event->height ); window_configure_notify( data, event->serial, &rect );
- state_cmd = window_update_client_state( data ); - config_cmd = window_update_client_config( data ); - rect = window_rect_from_visible( &data->rects, data->current_state.rect ); 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 ); @@ -1140,7 +1139,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) else send_message( hwnd, WM_SYSCOMMAND, LOWORD(config_cmd), 0 ); }
- return config_cmd || state_cmd; + return TRUE; }
@@ -1209,13 +1208,10 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event ) 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 ); - - state_cmd = window_update_client_state( data ); - config_cmd = window_update_client_config( data ); - rect = window_rect_from_visible( &data->rects, data->current_state.rect ); - 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 ); @@ -1249,13 +1245,10 @@ static void handle_net_wm_state_notify( HWND hwnd, XPropertyEvent *event ) 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 ); - - state_cmd = window_update_client_state( data ); - config_cmd = window_update_client_config( data ); - rect = window_rect_from_visible( &data->rects, data->current_state.rect ); - 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 ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 2beb0853c7d..370ef36ee23 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1502,7 +1502,7 @@ static void unmap_window( HWND hwnd ) release_win_data( data ); }
-UINT window_update_client_state( struct x11drv_win_data *data ) +static UINT window_update_client_state( struct x11drv_win_data *data ) { UINT old_style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE );
@@ -1544,7 +1544,7 @@ UINT window_update_client_state( struct x11drv_win_data *data ) return 0; }
-UINT window_update_client_config( struct x11drv_win_data *data ) +static UINT window_update_client_config( struct x11drv_win_data *data ) { UINT old_style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ), flags; RECT rect, old_rect = data->rects.window, new_rect; @@ -1585,6 +1585,20 @@ 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 ) +{ + struct x11drv_win_data *data; + + if (!(data = get_win_data( hwnd ))) return FALSE; + + *state_cmd = window_update_client_state( data ); + *config_cmd = window_update_client_config( data ); + *rect = window_rect_from_visible( &data->rects, data->current_state.rect ); + + release_win_data( data ); + return *state_cmd || *config_cmd; +} + void window_wm_state_notify( struct x11drv_win_data *data, unsigned long serial, UINT value ) { UINT *desired = &data->desired_state.wm_state, *pending = &data->pending_state.wm_state, *current = &data->current_state.wm_state; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 38503667f23..5641ea407f8 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -662,8 +662,7 @@ extern BOOL window_has_pending_wm_state( HWND hwnd, UINT state ); extern void window_wm_state_notify( struct x11drv_win_data *data, unsigned long serial, UINT value ); extern void window_net_wm_state_notify( struct x11drv_win_data *data, unsigned long serial, UINT value ); extern void window_configure_notify( struct x11drv_win_data *data, unsigned long serial, const RECT *rect ); -extern UINT window_update_client_state( struct x11drv_win_data *data ); -extern UINT window_update_client_config( struct x11drv_win_data *data ); +extern BOOL get_window_state_updates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, RECT *rect );
extern Window init_clip_window(void); extern void update_user_time( Time time );