From: Rémi Bernon rbernon@codeweavers.com
Use the window state to keep track of the monitors, although we don't record the X current state for now. There's no reason for it to change behind the scenes, but we can always later add a full tracker for the property if necessary. --- dlls/winex11.drv/window.c | 9 ++++++++- dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a5925fec96c..caf557f8a79 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1149,7 +1149,7 @@ void window_set_user_time( struct x11drv_win_data *data, Time time, BOOL init ) * windows spanning multiple monitors */ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) { - long monitors[4]; + long *old_monitors = data->pending_state.monitors, monitors[4]; XEvent xev;
if (!(data->pending_state.net_wm_state & (1 << NET_WM_STATE_FULLSCREEN)) || is_virtual_desktop() @@ -1163,9 +1163,12 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) return;
xinerama_get_fullscreen_monitors( &data->rects.visible, monitors ); + memcpy( data->desired_state.monitors, monitors, sizeof(monitors) ); + if (!memcmp( old_monitors, monitors, sizeof(monitors) )) return; /* states are the same, nothing to update */
if (data->pending_state.wm_state == WithdrawnState) { + memcpy( data->pending_state.monitors, monitors, sizeof(monitors) ); TRACE( "window %p/%lx, requesting _NET_WM_FULLSCREEN_MONITORS %ld,%ld,%ld,%ld serial %lu\n", data->hwnd, data->whole_window, monitors[0], monitors[1], monitors[2], monitors[3], NextRequest( data->display ) ); if (monitors[0] == -1) XDeleteProperty( data->display, data->whole_window, x11drv_atom(_NET_WM_FULLSCREEN_MONITORS) ); @@ -1184,11 +1187,15 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) xev.xclient.data.l[4] = 1; memcpy( xev.xclient.data.l, monitors, sizeof(monitors) );
+ memcpy( data->pending_state.monitors, monitors, sizeof(monitors) ); TRACE( "window %p/%lx, requesting _NET_WM_FULLSCREEN_MONITORS %ld,%ld,%ld,%ld serial %lu\n", data->hwnd, data->whole_window, monitors[0], monitors[1], monitors[2], monitors[3], NextRequest( data->display ) ); XSendEvent( data->display, DefaultRootWindow( data->display ), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev ); } + + /* assume it changes immediately, we don't track the property for now */ + memcpy( data->current_state.monitors, monitors, sizeof(monitors) ); }
static void window_set_net_wm_state( struct x11drv_win_data *data, UINT new_state ) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 61567c7319e..1c7282d443d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -625,6 +625,7 @@ struct window_state BOOL activate; UINT net_wm_state; MwmHints mwm_hints; + long monitors[4]; RECT rect; };