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

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:21:03 +08:00 committed by Alexandre Julliard
parent 715a04daab
commit d9625e5a01
3 changed files with 11 additions and 13 deletions

View File

@ -548,7 +548,8 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
{
struct x11drv_win_data *data;
struct x11drv_thread_data *thread_data;
RECT rect;
MONITORINFO monitor_info;
HMONITOR monitor;
DWORD style;
BOOL fullscreen;
@ -559,21 +560,25 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
/* maximized windows don't count as full screen */
if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) return FALSE;
if (!(data = get_win_data( hwnd ))) return FALSE;
fullscreen = is_window_rect_fullscreen( &data->whole_rect );
fullscreen = is_window_rect_full_screen( &data->whole_rect );
release_win_data( data );
if (!fullscreen) return FALSE;
if (!(thread_data = x11drv_thread_data())) return FALSE;
if (GetTickCount() - thread_data->clip_reset < 1000) return FALSE;
if (!reset && clipping_cursor && thread_data->clip_hwnd) return FALSE; /* already clipping */
rect = get_primary_monitor_rect();
monitor = MonitorFromWindow( hwnd, MONITOR_DEFAULTTONEAREST );
if (!monitor) return FALSE;
monitor_info.cbSize = sizeof(monitor_info);
if (!GetMonitorInfoW( monitor, &monitor_info )) return FALSE;
if (!grab_fullscreen)
{
RECT virtual_rect = get_virtual_screen_rect();
if (!EqualRect( &rect, &virtual_rect )) return FALSE;
if (!EqualRect( &monitor_info.rcMonitor, &virtual_rect )) return FALSE;
if (is_virtual_desktop()) return FALSE;
}
TRACE( "win %p clipping fullscreen\n", hwnd );
return grab_clipping_window( &rect );
return grab_clipping_window( &monitor_info.rcMonitor );
}

View File

@ -2460,7 +2460,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
{
release_win_data( data );
unmap_window( hwnd );
if (is_window_rect_fullscreen( &old_window_rect )) reset_clipping_window();
if (is_window_rect_full_screen( &old_window_rect )) reset_clipping_window();
if (!(data = get_win_data( hwnd ))) return;
}
}

View File

@ -822,11 +822,4 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
max( rect->bottom, rect->top + 1 ) > virtual_rect.top);
}
static inline BOOL is_window_rect_fullscreen( const RECT *rect )
{
RECT primary_rect = get_primary_monitor_rect();
return (rect->left <= primary_rect.left && rect->right >= primary_rect.right &&
rect->top <= primary_rect.top && rect->bottom >= primary_rect.bottom);
}
#endif /* __WINE_X11DRV_H */