mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
winex11: Simplify the control flow in ConfigureNotify handlers.
This commit is contained in:
parent
968ab4e79a
commit
e3258e7620
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
1 changed files with 18 additions and 21 deletions
|
@ -1073,9 +1073,8 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
|
|||
struct x11drv_win_data *data;
|
||||
RECT rect;
|
||||
POINT pos = {event->x, event->y};
|
||||
UINT flags;
|
||||
UINT style, flags = 0, config_cmd = 0;
|
||||
int cx, cy, x, y;
|
||||
DWORD style;
|
||||
|
||||
if (!hwnd) return FALSE;
|
||||
if (!(data = get_win_data( hwnd ))) return FALSE;
|
||||
|
@ -1139,35 +1138,33 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
|
|||
if ((style & WS_CAPTION) == WS_CAPTION || !data->is_fullscreen)
|
||||
{
|
||||
data->net_wm_state = get_window_net_wm_state( event->display, data->whole_window );
|
||||
if ((data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)))
|
||||
if ((data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) && !(style & WS_MAXIMIZE))
|
||||
{
|
||||
if (!(style & WS_MAXIMIZE))
|
||||
{
|
||||
TRACE( "win %p/%lx is maximized\n", data->hwnd, data->whole_window );
|
||||
release_win_data( data );
|
||||
send_message( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
TRACE( "window %p/%lx is maximized\n", data->hwnd, data->whole_window );
|
||||
config_cmd = SC_MAXIMIZE;
|
||||
}
|
||||
else if (style & WS_MAXIMIZE)
|
||||
else if (!(data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) && (style & WS_MAXIMIZE))
|
||||
{
|
||||
TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window );
|
||||
release_win_data( data );
|
||||
send_message( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
|
||||
return TRUE;
|
||||
config_cmd = SC_RESTORE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE))
|
||||
if (!config_cmd && (flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE))
|
||||
{
|
||||
release_win_data( data );
|
||||
NtUserSetRawWindowPos( hwnd, rect, flags, FALSE );
|
||||
return TRUE;
|
||||
TRACE( "window %p/%lx config changed %s -> %s, flags %#x\n", data->hwnd, data->whole_window,
|
||||
wine_dbgstr_rect(&data->rects.window), wine_dbgstr_rect(&rect), flags );
|
||||
config_cmd = MAKELONG(SC_MOVE, flags);
|
||||
}
|
||||
|
||||
done:
|
||||
release_win_data( data );
|
||||
return FALSE;
|
||||
|
||||
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 !!config_cmd;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue