Commit 2538b010 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

winex11.drv: Calculate mask in X11DRV_resize_desktop().

Calculate XReconfigureWMWindow() mask in X11DRV_resize_desktop() instead of doing it in EnumWindows() callback update_windows_on_desktop_resize() because the result is the same anyway. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a45d3639
...@@ -321,26 +321,16 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) ...@@ -321,26 +321,16 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height )
return TRUE; return TRUE;
} }
struct desktop_resize_data
{
RECT old_virtual_rect;
RECT new_virtual_rect;
};
static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam ) static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam )
{ {
struct x11drv_win_data *data; struct x11drv_win_data *data;
struct desktop_resize_data *resize_data = (struct desktop_resize_data *)lparam; UINT mask = (UINT)lparam;
int mask = 0;
if (!(data = get_win_data( hwnd ))) return TRUE; if (!(data = get_win_data( hwnd ))) return TRUE;
/* update the full screen state */ /* update the full screen state */
update_net_wm_states( data ); update_net_wm_states( data );
if (resize_data->old_virtual_rect.left != resize_data->new_virtual_rect.left) mask |= CWX;
if (resize_data->old_virtual_rect.top != resize_data->new_virtual_rect.top) mask |= CWY;
if (mask && data->whole_window) if (mask && data->whole_window)
{ {
POINT pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top ); POINT pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top );
...@@ -399,14 +389,18 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height) ...@@ -399,14 +389,18 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height)
*/ */
void X11DRV_resize_desktop( unsigned int width, unsigned int height ) void X11DRV_resize_desktop( unsigned int width, unsigned int height )
{ {
RECT old_virtual_rect, new_virtual_rect;
HWND hwnd = GetDesktopWindow(); HWND hwnd = GetDesktopWindow();
struct desktop_resize_data resize_data; UINT mask = 0;
resize_data.old_virtual_rect = get_virtual_screen_rect(); old_virtual_rect = get_virtual_screen_rect();
desktop_width = width; desktop_width = width;
desktop_height = height; desktop_height = height;
X11DRV_DisplayDevices_Init( TRUE ); X11DRV_DisplayDevices_Init( TRUE );
resize_data.new_virtual_rect = get_virtual_screen_rect(); new_virtual_rect = get_virtual_screen_rect();
if (old_virtual_rect.left != new_virtual_rect.left) mask |= CWX;
if (old_virtual_rect.top != new_virtual_rect.top) mask |= CWY;
if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId())
{ {
...@@ -416,14 +410,13 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height ) ...@@ -416,14 +410,13 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height )
{ {
TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height ); TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
update_desktop_fullscreen( width, height ); update_desktop_fullscreen( width, height );
SetWindowPos( hwnd, 0, resize_data.new_virtual_rect.left, resize_data.new_virtual_rect.top, SetWindowPos( hwnd, 0, new_virtual_rect.left, new_virtual_rect.top,
resize_data.new_virtual_rect.right - resize_data.new_virtual_rect.left, new_virtual_rect.right - new_virtual_rect.left, new_virtual_rect.bottom - new_virtual_rect.top,
resize_data.new_virtual_rect.bottom - resize_data.new_virtual_rect.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
ungrab_clipping_window(); ungrab_clipping_window();
SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp, SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp,
MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL ); MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL );
} }
EnumWindows( update_windows_on_desktop_resize, (LPARAM)&resize_data ); EnumWindows( update_windows_on_desktop_resize, (LPARAM)mask );
} }
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