Module: wine Branch: master Commit: 70c9239cb2eef696eea109f3f8e7a58f80cd3823 URL: https://gitlab.winehq.org/wine/wine/-/commit/70c9239cb2eef696eea109f3f8e7a58...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Mon Aug 14 17:17:05 2023 +0800
winex11.drv: Set _NET_WM_FULLSCREEN_MONITORS only when necessary.
If _NET_WM_FULLSCREEN_MONITORS is set then the property needs to be updated because it can't be deleted by sending a _NET_WM_FULLSCREEN_MONITORS client message to the root window according to the wm-spec version 1.5. Having the window spanning more than two monitors also needs the property set. In other cases, _NET_WM_FULLSCREEN_MONITORS doesn't need to be set. What's more, setting _NET_WM_FULLSCREEN_MONITORS adds a constraint on Mutter so that such a window can't be moved to another monitor by using the Shift+Super+Up/Down/Left/Right shortcut. So the property should be added only when necessary.
---
dlls/winex11.drv/window.c | 15 +++++++++++++++ dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 16 insertions(+)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index ed3728773af..53982bb8c3b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -993,6 +993,20 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) if (!xinerama_get_fullscreen_monitors( &data->whole_rect, monitors )) return;
+ /* If _NET_WM_FULLSCREEN_MONITORS is not set and the fullscreen monitors are spanning only one + * monitor then do not set _NET_WM_FULLSCREEN_MONITORS. + * + * If _NET_WM_FULLSCREEN_MONITORS is set then the property needs to be updated because it can't + * be deleted by sending a _NET_WM_FULLSCREEN_MONITORS client message to the root window + * according to the wm-spec version 1.5. Having the window spanning more than two monitors also + * needs the property set. In other cases, _NET_WM_FULLSCREEN_MONITORS doesn't need to be set. + * What's more, setting _NET_WM_FULLSCREEN_MONITORS adds a constraint on Mutter so that such a + * window can't be moved to another monitor by using the Shift+Super+Up/Down/Left/Right + * shortcut. So the property should be added only when necessary. */ + if (monitors[0] == monitors[1] && monitors[1] == monitors[2] && monitors[2] == monitors[3] + && !data->net_wm_fullscreen_monitors_set) + return; + if (!data->mapped) { XChangeProperty( data->display, data->whole_window, x11drv_atom(_NET_WM_FULLSCREEN_MONITORS), @@ -1012,6 +1026,7 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) XSendEvent( data->display, root_window, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev ); } + data->net_wm_fullscreen_monitors_set = TRUE; }
/*********************************************************************** diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8e233a051f4..e80cb6682bf 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -625,6 +625,7 @@ struct x11drv_win_data BOOL use_alpha : 1; /* does window use an alpha channel? */ BOOL skip_taskbar : 1; /* does window should be deleted from taskbar */ BOOL add_taskbar : 1; /* does window should be added to taskbar regardless of style */ + BOOL net_wm_fullscreen_monitors_set : 1; /* is _NET_WM_FULLSCREEN_MONITORS set */ int wm_state; /* current value of the WM_STATE property */ DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */