winex11: Only clip huge surfaces to the virtual screen rect.

This commit is contained in:
Rémi Bernon 2024-06-19 21:34:24 +02:00 committed by Alexandre Julliard
parent 1efd486f64
commit ba9e0b5522

View file

@ -2186,10 +2186,18 @@ HRGN expose_surface( struct window_surface *window_surface, const RECT *rect )
BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect )
{
*surface_rect = NtUserGetVirtualScreenRect();
RECT virtual_rect = NtUserGetVirtualScreenRect();
if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE;
*surface_rect = *visible_rect;
/* crop surfaces which are larger than the virtual screen rect, some applications create huge windows */
if ((surface_rect->right - surface_rect->left > virtual_rect.right - virtual_rect.left ||
surface_rect->bottom - surface_rect->top > virtual_rect.bottom - virtual_rect.top) &&
!intersect_rect( surface_rect, surface_rect, &virtual_rect ))
return FALSE;
OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top );
/* round the surface coordinates to avoid re-creating them too often on resize */
surface_rect->left &= ~31;
surface_rect->top &= ~31;
surface_rect->right = max( surface_rect->left + 32, (surface_rect->right + 31) & ~31 );