Module: wine Branch: master Commit: 44aa651dc540f2b2c6ef8b8c9966889c4438f3a7 URL: https://gitlab.winehq.org/wine/wine/-/commit/44aa651dc540f2b2c6ef8b8c9966889...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Thu Jan 11 19:43:06 2024 +0200
winex11: Move the update_desktop_fullscreen callsite to update_net_wm_states.
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 | 46 +++------------------------------------------- dlls/winex11.drv/window.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 5867f9d16a4..d6fa078e8a9 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -99,39 +99,6 @@ 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) -{ - Display *display = thread_display(); - XEvent xev; - - if (!display || !is_virtual_desktop()) return; - - xev.xclient.type = ClientMessage; - xev.xclient.window = root_window; - xev.xclient.message_type = x11drv_atom(_NET_WM_STATE); - xev.xclient.serial = 0; - 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) - xev.xclient.data.l[0] = _NET_WM_STATE_ADD; - else - xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE; - xev.xclient.data.l[1] = x11drv_atom(_NET_WM_STATE_FULLSCREEN); - xev.xclient.data.l[2] = 0; - xev.xclient.data.l[3] = 1; - - TRACE("action=%li\n", xev.xclient.data.l[0]); - - XSendEvent( display, DefaultRootWindow(display), False, - SubstructureRedirectMask | SubstructureNotifyMask, &xev ); - - xev.xclient.data.l[1] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_VERT); - xev.xclient.data.l[2] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ); - XSendEvent( display, DefaultRootWindow(display), False, - SubstructureRedirectMask | SubstructureNotifyMask, &xev ); -} - /*********************************************************************** * X11DRV_resize_desktop */ @@ -139,20 +106,13 @@ 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; + INT width = virtual_rect.right - virtual_rect.left, height = virtual_rect.bottom - virtual_rect.top;
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, + NtUserSetWindowPos( hwnd, 0, virtual_rect.left, virtual_rect.top, width, height, 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..a9d6dbf1121 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -978,6 +978,35 @@ void update_user_time( Time time ) XUnlockDisplay( gdi_display ); }
+static void update_desktop_fullscreen( Display *display ) +{ + XEvent xev; + + if (!is_virtual_desktop()) return; + + xev.xclient.type = ClientMessage; + xev.xclient.window = root_window; + xev.xclient.message_type = x11drv_atom(_NET_WM_STATE); + xev.xclient.serial = 0; + xev.xclient.display = display; + xev.xclient.send_event = True; + xev.xclient.format = 32; + xev.xclient.data.l[0] = is_desktop_fullscreen() ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; + xev.xclient.data.l[1] = x11drv_atom(_NET_WM_STATE_FULLSCREEN); + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 1; + + TRACE("action=%li\n", xev.xclient.data.l[0]); + + XSendEvent( display, DefaultRootWindow(display), False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev ); + + xev.xclient.data.l[1] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_VERT); + xev.xclient.data.l[2] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ); + XSendEvent( display, DefaultRootWindow(display), False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev ); +} + /* Update _NET_WM_FULLSCREEN_MONITORS when _NET_WM_STATE_FULLSCREEN is set to support fullscreen * windows spanning multiple monitors */ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) @@ -1041,7 +1070,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->display); + return; + }
style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); if (style & WS_MINIMIZE)