Apparently, this wasn't enough to fix it in all WMs. It's simpler to just use the same sequence as normal fullscreen windows and avoid headaches with virtual desktops, and Béla reported it working as well (I couldn't reproduce it, but nothing broke for me, at least).
I know the whole NtUserGetPrimaryMonitorRect thing is wrong and only works for one monitor, but that was already the case before, so I kept it the same since it won't fix a regression and we're in code freeze.
From: Gabriel Ivăncescu gabrielopcode@gmail.com
It's simpler to just use the same sequence as normal fullscreen windows and avoid headaches with virtual desktops.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56149 Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/winex11.drv/desktop.c | 24 ++++++++++++------------ dlls/winex11.drv/window.c | 6 +++++- dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 5867f9d16a4..1d888b7ed0b 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -99,12 +99,20 @@ BOOL is_desktop_fullscreen(void) primary_rect.bottom - primary_rect.top == host_primary_rect.bottom - host_primary_rect.top); }
-static void update_desktop_fullscreen( unsigned int width, unsigned int height) +void update_desktop_fullscreen( struct x11drv_win_data *data ) { - Display *display = thread_display(); + Display *display = data->display; + RECT primary_rect; + INT width, height; XEvent xev;
- if (!display || !is_virtual_desktop()) return; + if (!is_virtual_desktop()) return; + + primary_rect = NtUserGetPrimaryMonitorRect(); + width = primary_rect.right; + height = primary_rect.bottom; + + TRACE( "desktop %p change to (%dx%d)\n", data->hwnd, width, height );
xev.xclient.type = ClientMessage; xev.xclient.window = root_window; @@ -139,20 +147,12 @@ void X11DRV_resize_desktop(void) { static RECT old_virtual_rect;
- RECT primary_rect, virtual_rect; + RECT virtual_rect = NtUserGetVirtualScreenRect(); HWND hwnd = NtUserGetDesktopWindow(); - INT width, height; - - virtual_rect = NtUserGetVirtualScreenRect(); - primary_rect = NtUserGetPrimaryMonitorRect(); - width = primary_rect.right; - height = primary_rect.bottom;
- TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height ); NtUserSetWindowPos( hwnd, 0, virtual_rect.left, virtual_rect.top, virtual_rect.right - virtual_rect.left, virtual_rect.bottom - virtual_rect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); - update_desktop_fullscreen( width, height );
if (old_virtual_rect.left != virtual_rect.left || old_virtual_rect.top != virtual_rect.top) send_message_timeout( HWND_BROADCAST, WM_X11DRV_DESKTOP_RESIZED, old_virtual_rect.left, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f5f2dd03662..dba5be4c459 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1041,7 +1041,11 @@ void update_net_wm_states( struct x11drv_win_data *data ) UINT i, style, ex_style, new_state = 0;
if (!data->managed) return; - if (data->whole_window == root_window) return; + if (data->whole_window == root_window) + { + update_desktop_fullscreen(data); + return; + }
style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); if (style & WS_MINIMIZE) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index c80e4b3d3c9..08ede6682a4 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -763,6 +763,7 @@ extern void X11DRV_resize_desktop(void); extern BOOL is_virtual_desktop(void); extern BOOL is_desktop_fullscreen(void); extern BOOL is_detached_mode(const DEVMODEW *); +void update_desktop_fullscreen(struct x11drv_win_data*); void X11DRV_Settings_Init(void);
void X11DRV_XF86VM_Init(void);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=141715
Your paranoid android.
=== debian11b (64 bit WoW report) ===
wininet: http.c:6820: Test failed: lpszSubjectInfo = winehq.org http.c:6821: Test failed: lpszIssuerInfo = US
Rémi Bernon (@rbernon) commented about dlls/winex11.drv/desktop.c:
{ static RECT old_virtual_rect;
- RECT primary_rect, virtual_rect;
- RECT virtual_rect = NtUserGetVirtualScreenRect(); HWND hwnd = NtUserGetDesktopWindow();
INT width, height;
virtual_rect = NtUserGetVirtualScreenRect();
primary_rect = NtUserGetPrimaryMonitorRect();
width = primary_rect.right;
height = primary_rect.bottom;
TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
I would keep this trace, and maybe add another indicating the desktop is being made / unmade fullscreen.
Rémi Bernon (@rbernon) commented about dlls/winex11.drv/desktop.c:
xev.xclient.display = display; xev.xclient.send_event = True; xev.xclient.format = 32; if (width == host_primary_rect.right - host_primary_rect.left && height == host_primary_rect.bottom - host_primary_rect.top)
This could probably use `is_desktop_fullscreen` instead.
On Thu Jan 11 10:17:29 2024 +0000, Rémi Bernon wrote:
I would keep this trace, and maybe add another indicating the desktop is being made / unmade fullscreen.
Ah yeah, we already have the other trace in there with (action=%ld) so I'll just let that one be it and move this one.
Also as a sidenote, although it didn't change anything, nevermind my comment in the MR message, `NtUserGetPrimaryMonitorRect` seems to be correct since it returns the "virtual" monitor from the virtual desktop, which makes sense.
On Thu Jan 11 15:47:47 2024 +0000, Gabriel Ivăncescu wrote:
Ah yeah, we already have the other trace in there with (action=%ld) so I'll just let that one be it and move this one. Also as a sidenote, although it didn't change anything, nevermind my comment in the MR message, `NtUserGetPrimaryMonitorRect` seems to be correct since it returns the "virtual" monitor from the virtual desktop, which makes sense.
Well it probably isn't right when there's more than one monitor but we don't support that case with the virtual desktop I think.