Commit 26b26a2e authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

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: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent fd6f50c0
......@@ -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 );
}
......@@ -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 */
......
......@@ -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 )))
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment