winex11: Simplify the control flow in WM_STATE handlers.

This commit is contained in:
Rémi Bernon 2024-11-13 11:42:54 +01:00 committed by Alexandre Julliard
parent b1dd7da806
commit 968ab4e79a
Notes: Alexandre Julliard 2024-11-13 22:30:56 +01:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6809

View file

@ -1230,7 +1230,7 @@ static int get_window_xembed_info( Display *display, Window window )
static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL update_window )
{
struct x11drv_win_data *data;
UINT style, value = 0;
UINT style, value = 0, state_cmd = 0;
if (!(data = get_win_data( hwnd ))) return;
if (event->state == PropertyNewValue) value = get_window_wm_state( event->display, event->window );
@ -1272,24 +1272,17 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
if ((style & WS_MAXIMIZEBOX) && !(style & WS_DISABLED))
{
TRACE( "restoring to max %p/%lx\n", data->hwnd, data->whole_window );
release_win_data( data );
send_message( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
return;
state_cmd = SC_MAXIMIZE;
}
TRACE( "not restoring to max win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
}
else
{
if (style & (WS_MINIMIZE | WS_MAXIMIZE))
{
BOOL activate = (style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE);
TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window );
release_win_data( data );
if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
NtUserSetActiveWindow( hwnd );
send_message( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
return;
state_cmd = MAKELONG(SC_RESTORE, activate);
}
TRACE( "not restoring win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
}
}
else if (!data->iconic && data->wm_state == IconicState)
@ -1298,14 +1291,17 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
if ((style & WS_MINIMIZEBOX) && !(style & WS_DISABLED))
{
TRACE( "minimizing win %p/%lx\n", data->hwnd, data->whole_window );
release_win_data( data );
send_message( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
return;
state_cmd = SC_MINIMIZE;
}
TRACE( "not minimizing win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
}
done:
release_win_data( data );
if (state_cmd)
{
if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd );
send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 );
}
}
static void handle_xembed_info_notify( HWND hwnd, XPropertyEvent *event )