From 39f2a082770d150edb38a82b289193772e4af1b6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 23 Apr 2008 15:22:17 +0200 Subject: [PATCH] winex11: Moved the X11DRV_resize_desktop function to desktop.c. --- dlls/winex11.drv/desktop.c | 67 +++++++++++++++++++++++++++++++++++ dlls/winex11.drv/winpos.c | 72 +------------------------------------- dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 69 insertions(+), 71 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 1699318cc4..14fba93957 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -155,3 +155,70 @@ Window X11DRV_create_desktop( UINT width, UINT height ) if (win != None) X11DRV_init_desktop( win, width, height ); return win; } + + +struct desktop_resize_data +{ + RECT old_screen_rect; + RECT old_virtual_rect; +}; + +static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam ) +{ + struct x11drv_win_data *data; + Display *display = thread_display(); + struct desktop_resize_data *resize_data = (struct desktop_resize_data *)lparam; + int mask = 0; + + if (!(data = X11DRV_get_win_data( hwnd ))) return TRUE; + + /* update the full screen state */ + update_net_wm_states( display, data ); + + if (resize_data->old_virtual_rect.left != virtual_screen_rect.left) mask |= CWX; + if (resize_data->old_virtual_rect.top != virtual_screen_rect.top) mask |= CWY; + if (mask && data->whole_window) + { + XWindowChanges changes; + + wine_tsx11_lock(); + changes.x = data->whole_rect.left - virtual_screen_rect.left; + changes.y = data->whole_rect.top - virtual_screen_rect.top; + XReconfigureWMWindow( display, data->whole_window, + DefaultScreen(display), mask, &changes ); + wine_tsx11_unlock(); + } + return TRUE; +} + + +/*********************************************************************** + * X11DRV_resize_desktop + */ +void X11DRV_resize_desktop( unsigned int width, unsigned int height ) +{ + HWND hwnd = GetDesktopWindow(); + struct desktop_resize_data resize_data; + + SetRect( &resize_data.old_screen_rect, 0, 0, screen_width, screen_height ); + resize_data.old_virtual_rect = virtual_screen_rect; + + xinerama_init( width, height ); + + if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) + { + SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, MAKELPARAM( width, height ) ); + } + else + { + TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height ); + SetWindowPos( hwnd, 0, virtual_screen_rect.left, virtual_screen_rect.top, + virtual_screen_rect.right - virtual_screen_rect.left, + virtual_screen_rect.bottom - virtual_screen_rect.top, + SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); + SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp, + MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL ); + } + + EnumWindows( update_windows_on_desktop_resize, (LPARAM)&resize_data ); +} diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index 5348ec6275..2f66a21b89 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -51,7 +51,7 @@ static const char managed_prop[] = "__wine_x11_managed"; /*********************************************************************** * update_net_wm_states */ -static void update_net_wm_states( Display *display, struct x11drv_win_data *data ) +void update_net_wm_states( Display *display, struct x11drv_win_data *data ) { static const unsigned int state_atoms[NB_NET_WM_STATES] = { @@ -464,73 +464,3 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags, XFlush( display ); /* make sure changes are done before we start painting again */ wine_tsx11_unlock(); } - - -struct desktop_resize_data -{ - RECT old_screen_rect; - RECT old_virtual_rect; -}; - -static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam ) -{ - struct x11drv_win_data *data; - Display *display = thread_display(); - struct desktop_resize_data *resize_data = (struct desktop_resize_data *)lparam; - int mask = 0; - - if (!(data = X11DRV_get_win_data( hwnd ))) return TRUE; - - if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE) - { - /* update the full screen state */ - update_net_wm_states( display, data ); - } - - if (resize_data->old_virtual_rect.left != virtual_screen_rect.left) mask |= CWX; - if (resize_data->old_virtual_rect.top != virtual_screen_rect.top) mask |= CWY; - if (mask && data->whole_window) - { - XWindowChanges changes; - - wine_tsx11_lock(); - changes.x = data->whole_rect.left - virtual_screen_rect.left; - changes.y = data->whole_rect.top - virtual_screen_rect.top; - XReconfigureWMWindow( display, data->whole_window, - DefaultScreen(display), mask, &changes ); - wine_tsx11_unlock(); - } - return TRUE; -} - - -/*********************************************************************** - * X11DRV_resize_desktop - */ -void X11DRV_resize_desktop( unsigned int width, unsigned int height ) -{ - HWND hwnd = GetDesktopWindow(); - struct desktop_resize_data resize_data; - - SetRect( &resize_data.old_screen_rect, 0, 0, screen_width, screen_height ); - resize_data.old_virtual_rect = virtual_screen_rect; - - xinerama_init( width, height ); - - if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) - { - SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, MAKELPARAM( width, height ) ); - } - else - { - TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height ); - SetWindowPos( hwnd, 0, virtual_screen_rect.left, virtual_screen_rect.top, - virtual_screen_rect.right - virtual_screen_rect.left, - virtual_screen_rect.bottom - virtual_screen_rect.top, - SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); - SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp, - MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL ); - } - - EnumWindows( update_windows_on_desktop_resize, (LPARAM)&resize_data ); -} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 287acbbb5b..f40445b8f4 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -711,6 +711,7 @@ extern void flush_gl_drawable( X11DRV_PDEVICE *physDev ); extern int get_window_wm_state( Display *display, struct x11drv_win_data *data ); extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set ); +extern void update_net_wm_states( Display *display, struct x11drv_win_data *data ); extern void make_window_embedded( Display *display, struct x11drv_win_data *data ); /* X context to associate a hwnd to an X window */