winex11.drv: Support full screen windows on non-primary monitors.

A window can be maximized or full screen on non-primary monitors. In this
case we need to add _NET_WM_STATE_MAXIMIZED or _NET_WM_STATE_FULLSCREEN
hint to the window so that they can be handled correctly by window managers.
For example, a full screen window on the secondary monitor needs
_NET_WM_STATE_FULLSCREEN so that window managers prevent panels from obscuring it.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-08-25 15:20:48 +08:00 committed by Alexandre Julliard
parent c5ec1585f6
commit 715a04daab
2 changed files with 30 additions and 2 deletions

View File

@ -272,9 +272,36 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl
{
if (style & WS_THICKFRAME) return TRUE;
/* Metacity needs the window to be resizable to make it fullscreen */
return is_window_rect_fullscreen( &data->whole_rect );
return is_window_rect_full_screen( &data->whole_rect );
}
struct monitor_info
{
const RECT *rect;
BOOL full_screen;
};
static BOOL CALLBACK enum_monitor_proc( HMONITOR monitor, HDC hdc, RECT *monitor_rect, LPARAM lparam )
{
struct monitor_info *info = (struct monitor_info *)lparam;
if (info->rect->left <= monitor_rect->left && info->rect->right >= monitor_rect->right &&
info->rect->top <= monitor_rect->top && info->rect->bottom >= monitor_rect->bottom)
{
info->full_screen = TRUE;
return FALSE;
}
return TRUE;
}
BOOL is_window_rect_full_screen( const RECT *rect )
{
struct monitor_info info = {rect, FALSE};
EnumDisplayMonitors( NULL, NULL, enum_monitor_proc, (LPARAM)&info );
return info.full_screen;
}
/***********************************************************************
* get_mwm_decorations
@ -945,7 +972,7 @@ void update_net_wm_states( struct x11drv_win_data *data )
style = GetWindowLongW( data->hwnd, GWL_STYLE );
if (style & WS_MINIMIZE)
new_state |= data->net_wm_state & ((1 << NET_WM_STATE_FULLSCREEN)|(1 << NET_WM_STATE_MAXIMIZED));
if (is_window_rect_fullscreen( &data->whole_rect ))
if (is_window_rect_full_screen( &data->whole_rect ))
{
if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION)
new_state |= (1 << NET_WM_STATE_MAXIMIZED);

View File

@ -641,6 +641,7 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ) DECLSPEC_HIDDEN;
extern int X11DRV_check_error(void) DECLSPEC_HIDDEN;
extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect, int x, int y, int cx, int cy ) DECLSPEC_HIDDEN;
extern BOOL is_window_rect_full_screen( const RECT *rect ) DECLSPEC_HIDDEN;
extern POINT virtual_screen_to_root( INT x, INT y ) DECLSPEC_HIDDEN;
extern POINT root_to_virtual_screen( INT x, INT y ) DECLSPEC_HIDDEN;
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;