[PATCH 0/2] MR9741: winex11: Avoid mapping points with exclusive fullscreen windows.
Some games like Fallout 3 have moved and resized their window to some invalid rect, mapping the window points here will return an empty rect or badly positioned rect as well. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58443 This fixes ae3cd29bd513f7c1cffca95e9c0c8c8304eeb12c from !9721 which I probably broke when rebasing it over !9584. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9741
From: Rémi Bernon <rbernon@codeweavers.com> The client surface should be sized in window DPI, as rendering should happen at the window scale. When on-screen, the client surface should also be positioned in window DPI. Upscaling to monitor resolution high DPI, or display mode emulation happen through the offscreen mechanism and client_surface_present callback instead. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58443 --- dlls/winex11.drv/init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 00454832ca3..5c346d3457b 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -314,15 +314,17 @@ static void x11drv_client_surface_detach( struct client_surface *client ) static void client_surface_update_geometry( HWND hwnd, struct x11drv_client_surface *surface ) { + UINT dpi = NtUserGetDpiForWindow( hwnd ); /* use window DPI here, DPI scaling is handled through offscreen presentation */ HWND origin = hwnd, toplevel = NtUserGetAncestor( hwnd, GA_ROOT ); XWindowChanges changes = surface->changes; struct x11drv_win_data *data; int mask = 0; RECT rect; - if (NtUserGetPresentRect( toplevel, &rect, -1 /* raw dpi */ )) origin = hwnd; - else if (!NtUserGetClientRect( hwnd, &rect, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) )) return; - NtUserMapWindowPoints( origin, toplevel, (POINT *)&rect, 2, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); + if (NtUserGetPresentRect( toplevel, &rect, dpi )) origin = hwnd; + else if (!NtUserGetClientRect( hwnd, &rect, dpi )) return; + NtUserMapWindowPoints( origin, toplevel, (POINT *)&rect, 2, dpi ); + if ((data = get_win_data( toplevel ))) { OffsetRect( &rect, data->rects.client.left - data->rects.visible.left, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9741
From: Rémi Bernon <rbernon@codeweavers.com> Some games like Fallout 3 have moved and resized their window to some invalid rect, mapping the window points here will return an empty rect or badly positioned rect as well. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58443 --- dlls/winex11.drv/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 5c346d3457b..09ef2bf8664 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -321,9 +321,9 @@ static void client_surface_update_geometry( HWND hwnd, struct x11drv_client_surf int mask = 0; RECT rect; - if (NtUserGetPresentRect( toplevel, &rect, dpi )) origin = hwnd; + if (NtUserGetPresentRect( hwnd, &rect, dpi )) OffsetRect( &rect, -rect.left, -rect.top ); else if (!NtUserGetClientRect( hwnd, &rect, dpi )) return; - NtUserMapWindowPoints( origin, toplevel, (POINT *)&rect, 2, dpi ); + else NtUserMapWindowPoints( origin, toplevel, (POINT *)&rect, 2, dpi ); if ((data = get_win_data( toplevel ))) { @@ -436,7 +436,7 @@ static void X11DRV_client_surface_present( struct client_surface *client, HDC hd { region = 0; /* window is exclusive fullscreen, ignore everything else */ if (toplevel != hwnd) return; /* toplevel is exclusive fullscreen, don't present */ - NtUserMapWindowPoints( 0, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); + OffsetRect( &rect_dst, -rect_dst.left, -rect_dst.top ); } else { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9741
participants (2)
-
Rémi Bernon -
Rémi Bernon (@rbernon)