From 26b26a2e0efcb776e7b0115f15580d2507b10400 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 11 May 2020 16:55:38 +0800 Subject: [PATCH] winex11.drv: Move update_windows_on_desktop_resize(). Move update_windows_on_desktop_resize() to be in X11DRV_DisplayDevices_Update() and rename it to update_windows_on_display_change(), which is a more appropriate name because the desktop is unnecessarily resized when display devices change. Signed-off-by: Zhiyi Zhang Signed-off-by: Alexandre Julliard --- dlls/winex11.drv/desktop.c | 29 ++--------------------------- dlls/winex11.drv/display.c | 28 +++++++++++++++++++++++++++- dlls/winex11.drv/window.c | 2 +- dlls/winex11.drv/x11drv.h | 2 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 9011f50c20c..5a9e0f59ae8 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -324,29 +324,6 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) return TRUE; } -static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam ) -{ - struct x11drv_win_data *data; - UINT mask = (UINT)lparam; - - if (!(data = get_win_data( hwnd ))) return TRUE; - - /* 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 ); - if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, TRUE ); - return TRUE; -} - BOOL is_desktop_fullscreen(void) { RECT primary_rect = get_primary_monitor_rect(); @@ -390,7 +367,7 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height) /*********************************************************************** * X11DRV_resize_desktop */ -void X11DRV_resize_desktop( UINT mask, BOOL send_display_change ) +void X11DRV_resize_desktop( BOOL send_display_change ) { RECT primary_rect, virtual_rect; HWND hwnd = GetDesktopWindow(); @@ -403,7 +380,7 @@ void X11DRV_resize_desktop( UINT mask, BOOL send_display_change ) if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) { - SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, (WPARAM)mask, (LPARAM)send_display_change ); + SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, (LPARAM)send_display_change ); } else { @@ -420,6 +397,4 @@ void X11DRV_resize_desktop( UINT mask, BOOL send_display_change ) SMTO_ABORTIFHUNG, 2000, NULL ); } } - - EnumWindows( update_windows_on_desktop_resize, (LPARAM)mask ); } diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 503f8c96877..daea434dabf 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -273,6 +273,31 @@ void X11DRV_DisplayDevices_RegisterEventHandlers(void) handler->register_event_handlers(); } +static BOOL CALLBACK update_windows_on_display_change(HWND hwnd, LPARAM lparam) +{ + struct x11drv_win_data *data; + UINT mask = (UINT)lparam; + + if (!(data = get_win_data(hwnd))) + return TRUE; + + /* 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); + if (hwnd == GetForegroundWindow()) + clip_fullscreen_window(hwnd, TRUE); + return TRUE; +} + void X11DRV_DisplayDevices_Update(BOOL send_display_change) { RECT old_virtual_rect, new_virtual_rect; @@ -288,7 +313,8 @@ void X11DRV_DisplayDevices_Update(BOOL send_display_change) if (old_virtual_rect.top != new_virtual_rect.top) mask |= CWY; - X11DRV_resize_desktop(mask, send_display_change); + X11DRV_resize_desktop(send_display_change); + EnumWindows(update_windows_on_display_change, (LPARAM)mask); } /* Initialize a GPU instance and return its GUID string in guid_string and driver value in driver parameter */ diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index ca40005d729..d6873ce4290 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2729,7 +2729,7 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) } return 0; case WM_X11DRV_RESIZE_DESKTOP: - X11DRV_resize_desktop( (UINT)wp, (BOOL)lp ); + X11DRV_resize_desktop( (BOOL)lp ); return 0; case WM_X11DRV_SET_CURSOR: if ((data = get_win_data( hwnd ))) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 1f8af184808..ff0aeb7dab2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -657,7 +657,7 @@ struct x11drv_mode_info }; extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) DECLSPEC_HIDDEN; -extern void X11DRV_resize_desktop(UINT, BOOL) DECLSPEC_HIDDEN; +extern void X11DRV_resize_desktop(BOOL) DECLSPEC_HIDDEN; extern BOOL is_virtual_desktop(void) DECLSPEC_HIDDEN; extern BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN; extern BOOL create_desktop_win_data( Window win ) DECLSPEC_HIDDEN;