Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57503
-- v2: winex11: Skip offscreening if the children don't require clipping. winex11: Always check if the GL drawable offscreen state needs to be changed.
From: Rémi Bernon rbernon@codeweavers.com
It might change when the window region has changed and requires child window clipping or doesn't anymore.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57503 --- dlls/winex11.drv/window.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 9c3b0b8602d..131473f9d45 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2941,10 +2941,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN XFlush( gdi_display ); /* make sure painting is done before we move the window */
sync_client_position( data, &old_rects ); - - if (data->rects.client.right - data->rects.client.left != old_rects.client.right - old_rects.client.left || - data->rects.client.bottom - data->rects.client.top != old_rects.client.bottom - old_rects.client.top) - sync_gl_drawable( hwnd, FALSE ); + sync_gl_drawable( hwnd, FALSE );
if (!data->whole_window) {
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57503 --- dlls/winex11.drv/init.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 37971dc8236..ddb8101a2f7 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -194,11 +194,37 @@ static HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) return dev->funcs->pSelectFont( dev, hfont, aa_flags ); }
+static BOOL needs_client_window_clipping( HWND hwnd ) +{ + struct x11drv_win_data *data; + RECT rect, client; + UINT ret = 0; + HRGN region; + HDC hdc; + + if (!(data = get_win_data( hwnd ))) return TRUE; + client = data->rects.client; + release_win_data( data ); + OffsetRect( &client, -client.left, -client.top ); + + if (!(hdc = NtUserGetDCEx( hwnd, 0, DCX_CACHE | DCX_CLIPCHILDREN ))) return FALSE; + if ((region = NtGdiCreateRectRgn( 0, 0, 0, 0 ))) + { + ret = NtGdiGetRandomRgn( hdc, region, SYSRGN | NTGDI_RGN_MONITOR_DPI ); + if (ret > 0 && (ret = NtGdiGetRgnBox( region, &rect )) <= NULLREGION) ret = 0; + if (ret == SIMPLEREGION && EqualRect( &rect, &client )) ret = 0; + NtGdiDeleteObjectApp( region ); + } + NtGdiDeleteObjectApp( hdc ); + + return ret > 0; +} + BOOL needs_offscreen_rendering( HWND hwnd, BOOL known_child ) { if (NtUserGetDpiForWindow( hwnd ) != NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI )) return TRUE; /* needs DPI scaling */ if (NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow()) return TRUE; /* child window, needs compositing */ - if (NtUserGetWindowRelative( hwnd, GW_CHILD )) return TRUE; /* window has children, needs compositing */ + if (NtUserGetWindowRelative( hwnd, GW_CHILD )) return needs_client_window_clipping( hwnd ); /* window has children, needs compositing */ if (known_child) return TRUE; /* window is/have children, needs compositing */ return FALSE; }