From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 10 ++++- dlls/win32u/window.c | 49 +++++++++++----------- dlls/wineandroid.drv/android.h | 3 +- dlls/wineandroid.drv/window.c | 3 +- dlls/winemac.drv/gdi.c | 1 + dlls/winemac.drv/macdrv.h | 5 ++- dlls/winemac.drv/window.c | 67 ++++++++++++++----------------- dlls/winewayland.drv/waylanddrv.h | 3 +- dlls/winewayland.drv/window.c | 3 +- dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/window.c | 67 ++++++++++++++----------------- dlls/winex11.drv/x11drv.h | 7 ++-- include/wine/gdi_driver.h | 5 ++- 13 files changed, 110 insertions(+), 114 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 3c4146450e5..a3ad2c49501 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -886,10 +886,14 @@ static BOOL nulldrv_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *su return FALSE; }
+static void nulldrv_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, const RECT *valid_rects ) +{ +} + static void nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface ) + const RECT *visible_rect, struct window_surface *surface ) { }
@@ -1282,6 +1286,7 @@ static const struct user_driver_funcs lazy_load_driver = nulldrv_WindowMessage, nulldrv_WindowPosChanging, nulldrv_CreateWindowSurface, + nulldrv_MoveWindowBits, nulldrv_WindowPosChanged, /* system parameters */ nulldrv_SystemParametersInfo, @@ -1369,6 +1374,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version SET_USER_FUNC(WindowMessage); SET_USER_FUNC(WindowPosChanging); SET_USER_FUNC(CreateWindowSurface); + SET_USER_FUNC(MoveWindowBits); SET_USER_FUNC(WindowPosChanged); SET_USER_FUNC(SystemParametersInfo); SET_USER_FUNC(VulkanInit); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 35970e5b39a..75628f93dc9 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2006,39 +2006,38 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru move_window_bits_surface( hwnd, window_rect, old_surface, &old_visible_rect, valid_rects ); else move_window_bits( hwnd, visible_rect, &old_visible_rect, window_rect, valid_rects ); - valid_rects = NULL; /* prevent the driver from trying to also move the bits */ } window_surface_release( old_surface ); } - else if (surface_win && surface_win != hwnd) - { - if (valid_rects) + else if (valid_rects) + { + RECT rects[2]; + int x_offset = old_visible_rect.left - visible_rect->left; + int y_offset = old_visible_rect.top - visible_rect->top; + + /* if all that happened is that the whole window moved, copy everything */ + if (!(swp_flags & SWP_FRAMECHANGED) && + old_visible_rect.right - visible_rect->right == x_offset && + old_visible_rect.bottom - visible_rect->bottom == y_offset && + old_client_rect.left - client_rect->left == x_offset && + old_client_rect.right - client_rect->right == x_offset && + old_client_rect.top - client_rect->top == y_offset && + old_client_rect.bottom - client_rect->bottom == y_offset && + EqualRect( &valid_rects[0], client_rect )) { - RECT rects[2]; - int x_offset = old_visible_rect.left - visible_rect->left; - int y_offset = old_visible_rect.top - visible_rect->top; - - /* if all that happened is that the whole window moved, copy everything */ - if (!(swp_flags & SWP_FRAMECHANGED) && - old_visible_rect.right - visible_rect->right == x_offset && - old_visible_rect.bottom - visible_rect->bottom == y_offset && - old_client_rect.left - client_rect->left == x_offset && - old_client_rect.right - client_rect->right == x_offset && - old_client_rect.top - client_rect->top == y_offset && - old_client_rect.bottom - client_rect->bottom == y_offset && - EqualRect( &valid_rects[0], client_rect )) - { - rects[0] = *visible_rect; - rects[1] = old_visible_rect; - valid_rects = rects; - } - move_window_bits( hwnd, visible_rect, visible_rect, window_rect, valid_rects ); - valid_rects = NULL; /* prevent the driver from trying to also move the bits */ + rects[0] = *visible_rect; + rects[1] = old_visible_rect; + valid_rects = rects; } + + if (surface_win && surface_win != hwnd) + move_window_bits( hwnd, visible_rect, visible_rect, window_rect, valid_rects ); + else + user_driver->pMoveWindowBits( hwnd, window_rect, client_rect, visible_rect, valid_rects ); }
user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect, - client_rect, visible_rect, valid_rects, new_surface ); + client_rect, visible_rect, new_surface ); }
return ret; diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index f31a295354b..4e2465e5e7c 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -102,8 +102,7 @@ extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, c extern BOOL ANDROID_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ); extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface ); + const RECT *visible_rect, struct window_surface *surface );
/* unixlib interface */
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 7d20a58930e..6e3c11d5027 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1081,8 +1081,7 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_r */ void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface ) + const RECT *visible_rect, struct window_surface *surface ) { struct android_win_data *data; UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index dba4acc49a3..0505938a822 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -306,6 +306,7 @@ static const struct user_driver_funcs macdrv_funcs = .pImeProcessKey = macdrv_ImeProcessKey, .pNotifyIMEStatus = macdrv_NotifyIMEStatus, .pWindowMessage = macdrv_WindowMessage, + .pMoveWindowBits = macdrv_MoveWindowBits, .pWindowPosChanged = macdrv_WindowPosChanged, .pWindowPosChanging = macdrv_WindowPosChanging, .pCreateWindowSurface = macdrv_CreateWindowSurface, diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index f5d6943bfc3..04b090ea6a5 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -150,10 +150,11 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect); extern BOOL macdrv_CreateWindowSurface(HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface); +extern void macdrv_MoveWindowBits(HWND hwnd, const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, const RECT *valid_rects); extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface); + const RECT *visible_rect, struct window_surface *surface); extern void macdrv_DestroyCursorIcon(HCURSOR cursor); extern BOOL macdrv_GetCursorPos(LPPOINT pos); extern void macdrv_SetCapture(HWND hwnd, UINT flags); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 3ee3c866379..d665eb97e50 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1889,14 +1889,43 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const RECT return ret; }
+/*********************************************************************** + * MoveWindowBits (MACDRV.@) + */ +void macdrv_MoveWindowBits(HWND hwnd, const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, const RECT *valid_rects) +{ + RECT old_visible_rect, old_client_rect; + struct macdrv_win_data *data; + macdrv_window window; + + if (!(data = get_win_data(hwnd))) return; + old_visible_rect = data->whole_rect; + old_client_rect = data->client_rect; + window = data->cocoa_window; + release_win_data(data); + + /* if all that happened is that the whole window moved, copy everything */ + if (EqualRect(&valid_rects[0], visible_rect) && EqualRect(&valid_rects[1], &old_visible_rect)) + { + /* A Cocoa window's bits are moved automatically */ + if (!window && (valid_rects[0].left - valid_rects[1].left || valid_rects[0].top - valid_rects[1].top)) + move_window_bits(hwnd, 0, &old_visible_rect, visible_rect, + &old_client_rect, client_rect, window_rect); + } + else + { + move_window_bits(hwnd, window, &valid_rects[1], &valid_rects[0], + &old_client_rect, client_rect, window_rect); + } +}
/*********************************************************************** * WindowPosChanged (MACDRV.@) */ void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface) + const RECT *visible_rect, struct window_surface *surface) { struct macdrv_thread_data *thread_data; struct macdrv_win_data *data; @@ -1941,40 +1970,6 @@ void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, wine_dbgstr_rect(visible_rect), wine_dbgstr_rect(client_rect), new_style, swp_flags, surface);
- if (!IsRectEmpty(&valid_rects[0])) - { - macdrv_window window = data->cocoa_window; - int x_offset = old_whole_rect.left - data->whole_rect.left; - int y_offset = old_whole_rect.top - data->whole_rect.top; - - /* if all that happened is that the whole window moved, copy everything */ - if (!(swp_flags & SWP_FRAMECHANGED) && - old_whole_rect.right - data->whole_rect.right == x_offset && - old_whole_rect.bottom - data->whole_rect.bottom == y_offset && - old_client_rect.left - data->client_rect.left == x_offset && - old_client_rect.right - data->client_rect.right == x_offset && - old_client_rect.top - data->client_rect.top == y_offset && - old_client_rect.bottom - data->client_rect.bottom == y_offset && - EqualRect(&valid_rects[0], &data->client_rect)) - { - /* A Cocoa window's bits are moved automatically */ - if (!window && (x_offset != 0 || y_offset != 0)) - { - release_win_data(data); - move_window_bits(hwnd, window, &old_whole_rect, visible_rect, - &old_client_rect, client_rect, window_rect); - if (!(data = get_win_data(hwnd))) return; - } - } - else - { - release_win_data(data); - move_window_bits(hwnd, window, &valid_rects[1], &valid_rects[0], - &old_client_rect, client_rect, window_rect); - if (!(data = get_win_data(hwnd))) return; - } - } - sync_gl_view(data, &old_whole_rect, &old_client_rect);
if (!data->cocoa_window && !data->cocoa_view) goto done; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 7b476528aa5..6a2aa0100ab 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -358,8 +358,7 @@ UINT WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manage LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface); + const RECT *visible_rect, struct window_surface *surface); BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect); BOOL WAYLAND_CreateWindowSurface(HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface); diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 7c694246fb7..fe9bc4382b5 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -448,8 +448,7 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const REC */ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface) + const RECT *visible_rect, struct window_surface *surface) { struct wayland_win_data *data; BOOL managed; diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 4a78073cb9b..297a451f82b 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -424,6 +424,7 @@ static const struct user_driver_funcs x11drv_funcs = .pWindowMessage = X11DRV_WindowMessage, .pWindowPosChanging = X11DRV_WindowPosChanging, .pCreateWindowSurface = X11DRV_CreateWindowSurface, + .pMoveWindowBits = X11DRV_MoveWindowBits, .pWindowPosChanged = X11DRV_WindowPosChanged, .pSystemParametersInfo = X11DRV_SystemParametersInfo, .pVulkanInit = X11DRV_VulkanInit, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 8c166473d32..e91801a774d 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2620,14 +2620,43 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const REC return ret; }
+/*********************************************************************** + * MoveWindowBits (X11DRV.@) + */ +void X11DRV_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, const RECT *valid_rects ) +{ + RECT old_visible_rect, old_client_rect; + struct x11drv_win_data *data; + Window window; + + if (!(data = get_win_data( hwnd ))) return; + old_visible_rect = data->whole_rect; + old_client_rect = data->client_rect; + window = data->whole_window; + release_win_data( data ); + + /* if all that happened is that the whole window moved, copy everything */ + if (EqualRect( &valid_rects[0], visible_rect ) && EqualRect( &valid_rects[1], &old_visible_rect )) + { + /* if we have an X window the bits will be moved by the X server */ + if (!window && (valid_rects[0].left - valid_rects[1].left || valid_rects[0].top - valid_rects[1].top)) + move_window_bits( hwnd, 0, &old_visible_rect, visible_rect, + &old_client_rect, client_rect, window_rect ); + } + else + { + move_window_bits( hwnd, window, &valid_rects[1], &valid_rects[0], + &old_client_rect, client_rect, window_rect ); + } +}
/*********************************************************************** * WindowPosChanged (X11DRV.@) */ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *rectWindow, const RECT *rectClient, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface ) + const RECT *visible_rect, struct window_surface *surface ) { struct x11drv_thread_data *thread_data; struct x11drv_win_data *data; @@ -2655,40 +2684,6 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, TRACE( "win %p window %s client %s style %08x flags %08x\n", hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style, swp_flags );
- if (!IsRectEmpty( &valid_rects[0] )) - { - Window window = data->whole_window; - int x_offset = old_whole_rect.left - data->whole_rect.left; - int y_offset = old_whole_rect.top - data->whole_rect.top; - - /* if all that happened is that the whole window moved, copy everything */ - if (!(swp_flags & SWP_FRAMECHANGED) && - old_whole_rect.right - data->whole_rect.right == x_offset && - old_whole_rect.bottom - data->whole_rect.bottom == y_offset && - old_client_rect.left - data->client_rect.left == x_offset && - old_client_rect.right - data->client_rect.right == x_offset && - old_client_rect.top - data->client_rect.top == y_offset && - old_client_rect.bottom - data->client_rect.bottom == y_offset && - EqualRect( &valid_rects[0], &data->client_rect )) - { - /* if we have an X window the bits will be moved by the X server */ - if (!window && (x_offset != 0 || y_offset != 0)) - { - release_win_data( data ); - move_window_bits( hwnd, window, &old_whole_rect, visible_rect, - &old_client_rect, rectClient, rectWindow ); - if (!(data = get_win_data( hwnd ))) return; - } - } - else - { - release_win_data( data ); - move_window_bits( hwnd, window, &valid_rects[1], &valid_rects[0], - &old_client_rect, rectClient, rectWindow ); - if (!(data = get_win_data( hwnd ))) return; - } - } - XFlush( gdi_display ); /* make sure painting is done before we move the window */
sync_client_position( data, &old_client_rect, &old_whole_rect ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8941f023a0f..17cf8000ece 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -245,10 +245,11 @@ extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ); extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ); +extern void X11DRV_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, const RECT *valid_rects ); extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, - const RECT *rectWindow, const RECT *rectClient, - const RECT *visible_rect, const RECT *valid_rects, - struct window_surface *surface ); + const RECT *window_rect, const RECT *client_rect, + const RECT *visible_rect, struct window_surface *surface ); extern BOOL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags ); extern void X11DRV_ThreadDetach(void); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 6321740f41a..7c19895dd23 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -193,7 +193,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 89 +#define WINE_GDI_DRIVER_VERSION 90
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -360,8 +360,9 @@ struct user_driver_funcs LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const RECT *,const RECT *,RECT *); BOOL (*pCreateWindowSurface)(HWND,BOOL,const RECT *,struct window_surface**); + void (*pMoveWindowBits)(HWND,const RECT *,const RECT *,const RECT *,const RECT *); void (*pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *, - const RECT *,struct window_surface*); + struct window_surface*); /* system parameters */ BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT); /* vulkan support */