From: Rémi Bernon rbernon@codeweavers.com
After desktop is resized, instead of doing it only for the current process windows. --- dlls/winex11.drv/desktop.c | 22 +++++++++++++--------- dlls/winex11.drv/display.c | 34 ---------------------------------- dlls/winex11.drv/window.c | 23 +++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 1 + 4 files changed, 37 insertions(+), 43 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 3da8f92978d..f593ca32e50 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -456,6 +456,7 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height) */ void X11DRV_resize_desktop(void) { + static RECT old_virtual_rect; RECT primary_rect, virtual_rect; HWND hwnd = NtUserGetDesktopWindow(); INT width, height; @@ -468,14 +469,17 @@ void X11DRV_resize_desktop(void) if (NtUserGetWindowThread( hwnd, NULL ) != GetCurrentThreadId()) { send_message( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, 0 ); + return; } - else - { - TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height ); - update_desktop_fullscreen( 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 ); - ungrab_clipping_window(); - } + + TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height ); + update_desktop_fullscreen( 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 ); + ungrab_clipping_window(); + send_message_timeout( HWND_BROADCAST, WM_X11DRV_DESKTOP_RESIZED, old_virtual_rect.left, + old_virtual_rect.top, SMTO_ABORTIFHUNG, 2000, FALSE ); + + old_virtual_rect = virtual_rect; } diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 76defa7f0e8..b552c52cb56 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -560,47 +560,13 @@ void X11DRV_DisplayDevices_RegisterEventHandlers(void)
void X11DRV_DisplayDevices_Update(void) { - RECT old_virtual_rect, new_virtual_rect; DWORD tid, pid; HWND foreground; - UINT mask = 0, i; - HWND *list;
- old_virtual_rect = NtUserGetVirtualScreenRect(); X11DRV_DisplayDevices_Init(TRUE); - new_virtual_rect = NtUserGetVirtualScreenRect(); - - /* Calculate XReconfigureWMWindow() mask */ - if (old_virtual_rect.left != new_virtual_rect.left) - mask |= CWX; - if (old_virtual_rect.top != new_virtual_rect.top) - mask |= CWY;
X11DRV_resize_desktop();
- list = build_hwnd_list(); - for (i = 0; list && list[i] != HWND_BOTTOM; i++) - { - struct x11drv_win_data *data; - - if (!(data = get_win_data( list[i] ))) continue; - - /* update the full screen state */ - update_net_wm_states(data); - - if (mask && data->whole_window) - { - POINT pos = virtual_screen_to_root(data->whole_rect.left, data->whole_rect.top); - XWindowChanges changes; - changes.x = pos.x; - changes.y = pos.y; - XReconfigureWMWindow(data->display, data->whole_window, data->vis.screen, mask, &changes); - } - release_win_data(data); - } - - free( list ); - /* forward clip_fullscreen_window request to the foreground window */ if ((foreground = NtUserGetForegroundWindow()) && (tid = NtUserGetWindowThread( foreground, &pid )) && pid == GetCurrentProcessId()) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a7030f69759..6e2da167182 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2995,6 +2995,29 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) case WM_X11DRV_RESIZE_DESKTOP: X11DRV_resize_desktop(); return 0; + case WM_X11DRV_DESKTOP_RESIZED: + if ((data = get_win_data( hwnd ))) + { + /* update the full screen state */ + update_net_wm_states( data ); + + if (data->whole_window) + { + /* sync window position with the new virtual screen rect */ + POINT old_pos = {.x = data->whole_rect.left - wp, .y = data->whole_rect.top - lp}; + POINT pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top ); + XWindowChanges changes = {.x = pos.x, .y = pos.y}; + UINT mask = 0; + + if (old_pos.x != pos.x) mask |= CWX; + if (old_pos.y != pos.y) mask |= CWY; + + if (mask) XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes ); + } + + release_win_data( data ); + } + return 0; case WM_X11DRV_SET_CURSOR: { Window win = 0; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index d1a70da9998..fc646771acd 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -573,6 +573,7 @@ enum x11drv_window_messages WM_X11DRV_UPDATE_CLIPBOARD = 0x80001000, WM_X11DRV_SET_WIN_REGION, WM_X11DRV_RESIZE_DESKTOP, + WM_X11DRV_DESKTOP_RESIZED, WM_X11DRV_SET_CURSOR, WM_X11DRV_CLIP_CURSOR_NOTIFY, WM_X11DRV_CLIP_CURSOR_REQUEST,