diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 09475d1adb1..6378c9c7650 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -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); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 233891f7b00..ce00e6c54dd 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -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;