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 <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-05-11 16:55:38 +08:00 committed by Alexandre Julliard
parent fd6f50c0d3
commit 26b26a2e0e
4 changed files with 31 additions and 30 deletions

View File

@ -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 );
}

View File

@ -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 */

View File

@ -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 )))

View File

@ -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;