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; }