From: Gabriel Ivăncescu gabrielopcode@gmail.com
Since 895ca2eda64f506b936999cdd8f14e224eef6a7f, we're not telling Win32 side of the fact the window moved offscreen. This means any SetWindowPos sent afterwards has potential to resync the Window and "put it on screen again", even if such operation has SWP_NOMOVE or SWP_NOSIZE. This causes some fullscreen apps to follow the workspace/desktop instead of remaining offscreen.
Fixes a regression introduced by 895ca2eda64f506b936999cdd8f14e224eef6a7f.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/winex11.drv/window.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1d43c4edbdb..d1518875c23 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1777,7 +1777,9 @@ static void sync_window_position( struct x11drv_win_data *data, UINT swp_flags ) { DWORD style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); DWORD ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); + LONG new_width, new_height; BOOL above = FALSE; + RECT new_rect;
if (data->managed && data->desired_state.wm_state == IconicState) return;
@@ -1795,7 +1797,26 @@ static void sync_window_position( struct x11drv_win_data *data, UINT swp_flags ) set_size_hints( data, style ); set_mwm_hints( data, style, ex_style ); update_net_wm_states( data ); - window_set_config( data, &data->rects.visible, above ); + + new_rect = data->rects.visible; + if (swp_flags & SWP_NOSIZE) + { + new_width = data->pending_state.rect.right - data->pending_state.rect.left; + new_height = data->pending_state.rect.bottom - data->pending_state.rect.top; + } + else + { + new_width = new_rect.right - new_rect.left; + new_height = new_rect.bottom - new_rect.top; + } + if (swp_flags & SWP_NOMOVE) + { + new_rect.left = data->pending_state.rect.left; + new_rect.top = data->pending_state.rect.top; + } + new_rect.right = new_rect.left + new_width; + new_rect.bottom = new_rect.top + new_height; + window_set_config( data, &new_rect, above ); }
Rémi Bernon (@rbernon) commented about dlls/winex11.drv/window.c:
- {
new_width = data->pending_state.rect.right - data->pending_state.rect.left;
new_height = data->pending_state.rect.bottom - data->pending_state.rect.top;
- }
- else
- {
new_width = new_rect.right - new_rect.left;
new_height = new_rect.bottom - new_rect.top;
- }
- if (swp_flags & SWP_NOMOVE)
- {
new_rect.left = data->pending_state.rect.left;
new_rect.top = data->pending_state.rect.top;
- }
- new_rect.right = new_rect.left + new_width;
- new_rect.bottom = new_rect.top + new_height;
What about shortening it like this? Also using `desired_state` is probably better here, in case window config request is being delayed.
```suggestion:-17+0 new_rect = data->rects.visible; if (swp_flags & SWP_NOSIZE) { new_rect.right = new_rect.left + data->desired_state.rect.right - data->desired_state.rect.left; new_rect.bottom = new_rect.top + data->desired_state.rect.bottom - data->desired_state.rect.top; } if (swp_flags & SWP_NOMOVE) { OffsetRect( &new_rect, data->desired_state.rect.left - new_rect.left, data->desired_state.rect.top - new_rect.top ); } ```
Merge request https://gitlab.winehq.org/wine/wine/-/merge_requests/7116 was reviewed by Rémi Bernon
--
Rémi Bernon started a new discussion on dlls/winex11.drv/window.c: https://gitlab.winehq.org/wine/wine/-/merge_requests/7116#note_91691
- }
- new_rect.right = new_rect.left + new_width;
- new_rect.bottom = new_rect.top + new_height;
What about shortening it like this? Also using `desired_state` is probably better here, in case window config request is being delayed.
new_rect = data->rects.visible; if (swp_flags & SWP_NOSIZE) { new_rect.right = new_rect.left + data->desired_state.rect.right - data->desired_state.rect.left; new_rect.bottom = new_rect.top + data->desired_state.rect.bottom - data->desired_state.rect.top; } if (swp_flags & SWP_NOMOVE) { OffsetRect( &new_rect, data->desired_state.rect.left - new_rect.left, data->desired_state.rect.top - new_rect.top ); }
Sure. For `desired_state`, I'm a bit confused of how it all works, I just took it from `window_set_config` old_rect. But yes that works too.