-- v2: win32u: Keep a window_rects struct in the WND structure. win32u: Pass a window_rects struct to calc_ncsize helper. win32u: Pass a window_rects struct from get_window_rects helper. win32u: Introduce new get_(client|window)_rect_rel helpers. win32u: Pass a window_rects struct to MoveWindowBits driver entry. win32u: Pass a window_rects struct to WindowPosChanging driver entry. win32u: Pass a window_rects struct to WindowPosChanged driver entry. win32u: Pass window_rects structs to create_window_surface. win32u: Use window_rects structs in apply_window_pos. win32u: Split driver side window bits move to a separate entry.
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 */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 78 +++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 40 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 75628f93dc9..6af4bb70d32 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1908,23 +1908,24 @@ static struct window_surface *create_window_surface( HWND hwnd, UINT swp_flags, * Backend implementation of SetWindowPos. */ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, struct window_surface *new_surface, - const RECT *window_rect, const RECT *client_rect, const RECT *visible_rect, const RECT *valid_rects ) + const struct window_rects *new_rects, const RECT *valid_rects ) { WND *win; HWND surface_win = 0; BOOL ret, is_layered, needs_update = FALSE; - RECT old_visible_rect, old_window_rect, old_client_rect, extra_rects[3]; + struct window_rects old_rects; + RECT extra_rects[3]; struct window_surface *old_surface;
is_layered = new_surface && new_surface->alpha_mask;
- get_window_rects( hwnd, COORDS_SCREEN, &old_window_rect, NULL, get_thread_dpi() ); + get_window_rects( hwnd, COORDS_SCREEN, &old_rects.window, NULL, get_thread_dpi() ); if (IsRectEmpty( &valid_rects[0] ) || is_layered) valid_rects = NULL;
if (!(win = get_win_ptr( hwnd )) || win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE;
- old_visible_rect = win->visible_rect; - old_client_rect = win->client_rect; + old_rects.visible = win->visible_rect; + old_rects.client = win->client_rect; old_surface = win->surface; if (old_surface != new_surface) swp_flags |= SWP_FRAMECHANGED; /* force refreshing non-client area */ if (new_surface == &dummy_surface) swp_flags |= SWP_NOREDRAW; @@ -1939,15 +1940,15 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru req->handle = wine_server_user_handle( hwnd ); req->previous = wine_server_user_handle( insert_after ); req->swp_flags = swp_flags; - req->window = wine_server_rectangle( *window_rect ); - req->client = wine_server_rectangle( *client_rect ); - if (!EqualRect( window_rect, visible_rect ) || new_surface || valid_rects) + req->window = wine_server_rectangle( new_rects->window ); + req->client = wine_server_rectangle( new_rects->client ); + if (!EqualRect( &new_rects->window, &new_rects->visible ) || new_surface || valid_rects) { - extra_rects[0] = extra_rects[1] = *visible_rect; + extra_rects[0] = extra_rects[1] = new_rects->visible; if (new_surface) { extra_rects[1] = new_surface->rect; - OffsetRect( &extra_rects[1], visible_rect->left, visible_rect->top ); + OffsetRect( &extra_rects[1], new_rects->visible.left, new_rects->visible.top ); } if (valid_rects) extra_rects[2] = valid_rects[0]; else SetRectEmpty( &extra_rects[2] ); @@ -1962,9 +1963,9 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru { win->dwStyle = reply->new_style; win->dwExStyle = reply->new_ex_style; - win->window_rect = *window_rect; - win->client_rect = *client_rect; - win->visible_rect = *visible_rect; + win->window_rect = new_rects->window; + win->client_rect = new_rects->client; + win->visible_rect = new_rects->visible; if ((win->surface = new_surface)) window_surface_add_ref( win->surface ); surface_win = wine_server_ptr_handle( reply->surface_win ); needs_update = reply->needs_update; @@ -1978,7 +1979,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru } /* if an RTL window is resized the children have moved */ if (win->dwExStyle & WS_EX_LAYOUTRTL && - client_rect->right - client_rect->left != old_client_rect.right - old_client_rect.left) + new_rects->client.right - new_rects->client.left != old_rects.client.right - old_rects.client.left) win->flags |= WIN_CHILDREN_MOVED; } } @@ -1989,7 +1990,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru if (needs_update) update_surface_region( surface_win ); if (((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) || (swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED | SWP_FRAMECHANGED))) - invalidate_dce( win, &old_window_rect ); + invalidate_dce( win, &old_rects.window ); }
release_win_ptr( win ); @@ -2003,41 +2004,41 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru if (valid_rects) { if (old_surface != new_surface) - move_window_bits_surface( hwnd, window_rect, old_surface, &old_visible_rect, valid_rects ); + move_window_bits_surface( hwnd, &new_rects->window, old_surface, &old_rects.visible, valid_rects ); else - move_window_bits( hwnd, visible_rect, &old_visible_rect, window_rect, valid_rects ); + move_window_bits( hwnd, &new_rects->visible, &old_rects.visible, &new_rects->window, valid_rects ); } window_surface_release( old_surface ); } 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; + int x_offset = old_rects.visible.left - new_rects->visible.left; + int y_offset = old_rects.visible.top - new_rects->visible.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 )) + old_rects.visible.right - new_rects->visible.right == x_offset && + old_rects.visible.bottom - new_rects->visible.bottom == y_offset && + old_rects.client.left - new_rects->client.left == x_offset && + old_rects.client.right - new_rects->client.right == x_offset && + old_rects.client.top - new_rects->client.top == y_offset && + old_rects.client.bottom - new_rects->client.bottom == y_offset && + EqualRect( &valid_rects[0], &new_rects->client )) { - rects[0] = *visible_rect; - rects[1] = old_visible_rect; + rects[0] = new_rects->visible; + rects[1] = old_rects.visible; valid_rects = rects; }
if (surface_win && surface_win != hwnd) - move_window_bits( hwnd, visible_rect, visible_rect, window_rect, valid_rects ); + move_window_bits( hwnd, &new_rects->visible, &new_rects->visible, &new_rects->window, valid_rects ); else - user_driver->pMoveWindowBits( hwnd, window_rect, client_rect, visible_rect, valid_rects ); + user_driver->pMoveWindowBits( hwnd, &new_rects->window, &new_rects->client, &new_rects->visible, valid_rects ); }
- user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect, - client_rect, visible_rect, new_surface ); + user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, &new_rects->window, + &new_rects->client, &new_rects->visible, new_surface ); }
return ret; @@ -2240,7 +2241,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ TRACE( "window %p new_rects %s\n", hwnd, debugstr_window_rects( &new_rects ) );
surface = create_window_surface( hwnd, swp_flags, TRUE, &new_rects.window, &new_rects.client, &new_rects.visible, &surface_rect ); - apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects.window, &new_rects.client, &new_rects.visible, NULL ); + apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects, NULL ); if (!surface) return FALSE;
if (!hdc_src || surface == &dummy_surface) ret = TRUE; @@ -3558,7 +3559,7 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) surface = create_window_surface( winpos->hwnd, winpos->flags, FALSE, &new_rects.window, &new_rects.client, &new_rects.visible, &surface_rect ); if (!apply_window_pos( winpos->hwnd, winpos->hwndInsertAfter, winpos->flags, surface, - &new_rects.window, &new_rects.client, &new_rects.visible, valid_rects )) + &new_rects, valid_rects )) { if (surface) window_surface_release( surface ); goto done; @@ -4357,8 +4358,7 @@ void update_window_state( HWND hwnd )
surface = create_window_surface( hwnd, swp_flags, FALSE, &new_rects.window, &new_rects.client, &new_rects.visible, &surface_rect ); - apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects.window, &new_rects.client, - &new_rects.visible, valid_rects ); + apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects, valid_rects ); if (surface) window_surface_release( surface );
set_thread_dpi_awareness_context( context ); @@ -5413,8 +5413,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
surface = create_window_surface( hwnd, SWP_NOZORDER | SWP_NOACTIVATE, FALSE, &new_rects.window, &new_rects.client, &new_rects.visible, &surface_rect ); - if (!apply_window_pos( hwnd, 0, SWP_NOZORDER | SWP_NOACTIVATE, surface, &new_rects.window, &new_rects.client, - &new_rects.visible, NULL )) + if (!apply_window_pos( hwnd, 0, SWP_NOZORDER | SWP_NOACTIVATE, surface, &new_rects, NULL )) { if (surface) window_surface_release( surface ); goto failed; @@ -5454,8 +5453,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
surface = create_window_surface( hwnd, SWP_NOACTIVATE, FALSE, &new_rects.window, &new_rects.client, &new_rects.visible, &surface_rect ); - apply_window_pos( hwnd, insert_after, SWP_NOACTIVATE, surface, &new_rects.window, &new_rects.client, - &new_rects.visible, NULL ); + apply_window_pos( hwnd, insert_after, SWP_NOACTIVATE, surface, &new_rects, NULL ); if (surface) window_surface_release( surface ); } else goto failed;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 6af4bb70d32..269dbce3f3d 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1840,8 +1840,7 @@ static BOOL get_default_window_surface( HWND hwnd, const RECT *surface_rect, str }
static struct window_surface *create_window_surface( HWND hwnd, UINT swp_flags, BOOL create_layered, - const RECT *window_rect, const RECT *client_rect, - RECT *visible_rect, RECT *surface_rect ) + struct window_rects *rects, RECT *surface_rect ) { BOOL shaped, needs_surface, create_opaque, is_layered; HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); @@ -1852,14 +1851,14 @@ static struct window_surface *create_window_surface( HWND hwnd, UINT swp_flags, if (get_window_region( hwnd, FALSE, &shape, &dummy )) shaped = FALSE; else if ((shaped = !!shape)) NtGdiDeleteObjectApp( shape );
- *visible_rect = *window_rect; - if (!user_driver->pWindowPosChanging( hwnd, swp_flags, shaped, window_rect, client_rect, visible_rect )) needs_surface = FALSE; + rects->visible = rects->window; + if (!user_driver->pWindowPosChanging( hwnd, swp_flags, shaped, &rects->window, &rects->client, &rects->visible )) needs_surface = FALSE; else if (parent && parent != NtUserGetDesktopWindow()) needs_surface = FALSE; else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; else if (swp_flags & SWP_SHOWWINDOW) needs_surface = TRUE; else needs_surface = !!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE);
- if (!get_surface_rect( visible_rect, surface_rect )) needs_surface = FALSE; + if (!get_surface_rect( &rects->visible, surface_rect )) needs_surface = FALSE; if (!get_default_window_surface( hwnd, surface_rect, &new_surface )) return NULL;
is_layered = new_surface && new_surface->alpha_mask; @@ -2240,7 +2239,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_
TRACE( "window %p new_rects %s\n", hwnd, debugstr_window_rects( &new_rects ) );
- surface = create_window_surface( hwnd, swp_flags, TRUE, &new_rects.window, &new_rects.client, &new_rects.visible, &surface_rect ); + surface = create_window_surface( hwnd, swp_flags, TRUE, &new_rects, &surface_rect ); apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects, NULL ); if (!surface) return FALSE;
@@ -3556,8 +3555,7 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) calc_ncsize( winpos, &old_rects.window, &old_rects.client, &new_rects.window, &new_rects.client, valid_rects, parent_x, parent_y );
- surface = create_window_surface( winpos->hwnd, winpos->flags, FALSE, &new_rects.window, &new_rects.client, - &new_rects.visible, &surface_rect ); + surface = create_window_surface( winpos->hwnd, winpos->flags, FALSE, &new_rects, &surface_rect ); if (!apply_window_pos( winpos->hwnd, winpos->hwndInsertAfter, winpos->flags, surface, &new_rects, valid_rects )) { @@ -4356,8 +4354,7 @@ void update_window_state( HWND hwnd ) get_window_rects( hwnd, COORDS_PARENT, &new_rects.window, &new_rects.client, get_thread_dpi() ); valid_rects[0] = valid_rects[1] = new_rects.client;
- surface = create_window_surface( hwnd, swp_flags, FALSE, &new_rects.window, &new_rects.client, - &new_rects.visible, &surface_rect ); + surface = create_window_surface( hwnd, swp_flags, FALSE, &new_rects, &surface_rect ); apply_window_pos( hwnd, 0, swp_flags, surface, &new_rects, valid_rects ); if (surface) window_surface_release( surface );
@@ -5411,8 +5408,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, if (cs.y > 0x7fffffff - cy) new_rects.window.bottom = 0x7fffffff; new_rects.client = new_rects.window;
- surface = create_window_surface( hwnd, SWP_NOZORDER | SWP_NOACTIVATE, FALSE, &new_rects.window, &new_rects.client, - &new_rects.visible, &surface_rect ); + surface = create_window_surface( hwnd, SWP_NOZORDER | SWP_NOACTIVATE, FALSE, &new_rects, &surface_rect ); if (!apply_window_pos( hwnd, 0, SWP_NOZORDER | SWP_NOACTIVATE, surface, &new_rects, NULL )) { if (surface) window_surface_release( surface ); @@ -5451,8 +5447,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, send_message( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&new_rects.client ); map_window_points( 0, parent, (POINT *)&new_rects.client, 2, win_dpi );
- surface = create_window_surface( hwnd, SWP_NOACTIVATE, FALSE, &new_rects.window, &new_rects.client, - &new_rects.visible, &surface_rect ); + surface = create_window_surface( hwnd, SWP_NOACTIVATE, FALSE, &new_rects, &surface_rect ); apply_window_pos( hwnd, insert_after, SWP_NOACTIVATE, surface, &new_rects, NULL ); if (surface) window_surface_release( surface ); }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 5 ++--- dlls/win32u/window.c | 3 +-- dlls/wineandroid.drv/android.h | 5 ++--- dlls/wineandroid.drv/window.c | 18 ++++++++---------- dlls/winemac.drv/macdrv.h | 5 ++--- dlls/winemac.drv/window.c | 17 +++++++---------- dlls/winewayland.drv/waylanddrv.h | 5 ++--- dlls/winewayland.drv/window.c | 17 +++++++---------- dlls/winex11.drv/window.c | 23 +++++++++++------------ dlls/winex11.drv/x11drv.h | 5 ++--- include/wine/gdi_driver.h | 5 ++--- 11 files changed, 46 insertions(+), 62 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index a3ad2c49501..6da282b1dab 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -891,9 +891,8 @@ static void nulldrv_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RE { }
-static void nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, - const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, struct window_surface *surface ) +static void nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + struct window_surface *surface ) { }
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 269dbce3f3d..819efab798b 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2036,8 +2036,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru user_driver->pMoveWindowBits( hwnd, &new_rects->window, &new_rects->client, &new_rects->visible, valid_rects ); }
- user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, &new_rects->window, - &new_rects->client, &new_rects->visible, new_surface ); + user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, new_rects, new_surface ); }
return ret; diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 4e2465e5e7c..18aa1ef738d 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -100,9 +100,8 @@ extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ); 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, struct window_surface *surface ); +extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + struct window_surface *surface );
/* unixlib interface */
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 6e3c11d5027..9f1a7a6ab82 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1079,9 +1079,8 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_r /*********************************************************************** * ANDROID_WindowPosChanged */ -void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, - const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, struct window_surface *surface ) +void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + struct window_surface *surface ) { struct android_win_data *data; UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); @@ -1089,9 +1088,9 @@ void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
if (!(data = get_win_data( hwnd ))) return;
- data->window_rect = *window_rect; - data->whole_rect = *visible_rect; - data->client_rect = *client_rect; + data->window_rect = new_rects->window; + data->whole_rect = new_rects->visible; + data->client_rect = new_rects->client;
if (!is_argb_surface( data->surface )) { @@ -1104,11 +1103,10 @@ void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
if (!(swp_flags & SWP_NOZORDER)) insert_after = NtUserGetWindowRelative( hwnd, GW_HWNDPREV );
- TRACE( "win %p window %s client %s style %08x owner %p after %p flags %08x\n", hwnd, - wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), - new_style, owner, insert_after, swp_flags ); + TRACE( "win %p new_rects %s style %08x owner %p after %p flags %08x\n", hwnd, + debugstr_window_rects(new_rects), new_style, owner, insert_after, swp_flags );
- ioctl_window_pos_changed( hwnd, window_rect, client_rect, visible_rect, + ioctl_window_pos_changed( hwnd, &new_rects->window, &new_rects->client, &new_rects->visible, new_style, swp_flags, insert_after, owner ); }
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 04b090ea6a5..b7d8f6b1a60 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -152,9 +152,8 @@ extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, con 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, struct window_surface *surface); +extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + 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 d665eb97e50..5cca10c567f 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1923,9 +1923,8 @@ void macdrv_MoveWindowBits(HWND hwnd, const RECT *window_rect, const RECT *clien /*********************************************************************** * 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, struct window_surface *surface) +void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + struct window_surface *surface) { struct macdrv_thread_data *thread_data; struct macdrv_win_data *data; @@ -1939,9 +1938,9 @@ void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, old_window_rect = data->window_rect; old_whole_rect = data->whole_rect; old_client_rect = data->client_rect; - data->window_rect = *window_rect; - data->whole_rect = *visible_rect; - data->client_rect = *client_rect; + data->window_rect = new_rects->window; + data->whole_rect = new_rects->visible; + data->client_rect = new_rects->client; if (data->cocoa_window && !data->ulw_layered) { if (surface) window_surface_add_ref(surface); @@ -1965,10 +1964,8 @@ void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, data->surface = surface; }
- TRACE("win %p/%p window %s whole %s client %s style %08x flags %08x surface %p\n", - hwnd, data->cocoa_window, wine_dbgstr_rect(window_rect), - wine_dbgstr_rect(visible_rect), wine_dbgstr_rect(client_rect), - new_style, swp_flags, surface); + TRACE("win %p/%p new_rects %s style %08x flags %08x surface %p\n", hwnd, data->cocoa_window, + debugstr_window_rects(new_rects), new_style, swp_flags, surface);
sync_gl_view(data, &old_whole_rect, &old_client_rect);
diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 6a2aa0100ab..bb24837766b 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -356,9 +356,8 @@ void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text); LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); UINT WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager, void *param); 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, struct window_surface *surface); +void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + 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 fe9bc4382b5..9f91fafa721 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -446,33 +446,30 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const REC /*********************************************************************** * WAYLAND_WindowPosChanged */ -void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, - const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, struct window_surface *surface) +void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + struct window_surface *surface) { struct wayland_win_data *data; BOOL managed;
- TRACE("hwnd %p window %s client %s visible %s after %p flags %08x\n", - hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), - wine_dbgstr_rect(visible_rect), insert_after, swp_flags); + TRACE("hwnd %p new_rects %s after %p flags %08x\n", hwnd, debugstr_window_rects(new_rects), insert_after, swp_flags);
/* Get the managed state with win_data unlocked, as is_window_managed * may need to query win_data information about other HWNDs and thus * acquire the lock itself internally. */ - managed = is_window_managed(hwnd, swp_flags, window_rect); + managed = is_window_managed(hwnd, swp_flags, &new_rects->window);
if (!(data = wayland_win_data_get(hwnd))) return;
- data->window_rect = *window_rect; - data->client_rect = *client_rect; + data->window_rect = new_rects->window; + data->client_rect = new_rects->client; data->managed = managed;
if (surface) window_surface_add_ref(surface); if (data->window_surface) window_surface_release(data->window_surface); data->window_surface = surface;
- wayland_win_data_update_wayland_surface(data, visible_rect); + wayland_win_data_update_wayland_surface(data, &new_rects->visible); if (data->wayland_surface) wayland_win_data_update_wayland_state(data);
wayland_win_data_release(data); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e91801a774d..5b10a577541 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2654,9 +2654,8 @@ void X11DRV_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RECT *clie /*********************************************************************** * WindowPosChanged (X11DRV.@) */ -void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, - const RECT *rectWindow, const RECT *rectClient, - const RECT *visible_rect, struct window_surface *surface ) +void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + struct window_surface *surface ) { struct x11drv_thread_data *thread_data; struct x11drv_win_data *data; @@ -2671,9 +2670,9 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, old_window_rect = data->window_rect; old_whole_rect = data->whole_rect; old_client_rect = data->client_rect; - data->window_rect = *rectWindow; - data->whole_rect = *visible_rect; - data->client_rect = *rectClient; + data->window_rect = new_rects->window; + data->whole_rect = new_rects->visible; + data->client_rect = new_rects->client; if (data->vis.visualid == default_visual.visualid) { if (surface) window_surface_add_ref( surface ); @@ -2681,8 +2680,8 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, data->surface = surface; }
- 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 ); + TRACE( "win %p/%lx new_rects %s style %08x flags %08x\n", hwnd, data->whole_window, + debugstr_window_rects(new_rects), new_style, swp_flags );
XFlush( gdi_display ); /* make sure painting is done before we move the window */
@@ -2716,7 +2715,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, { if (((swp_flags & SWP_HIDEWINDOW) && !(new_style & WS_VISIBLE)) || (!event_type && !(new_style & WS_MINIMIZE) && - !is_window_rect_mapped( rectWindow ) && is_window_rect_mapped( &old_window_rect ))) + !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_window_rect ))) { release_win_data( data ); unmap_window( hwnd ); @@ -2732,7 +2731,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, sync_window_position( data, swp_flags, &old_window_rect, &old_whole_rect, &old_client_rect );
if ((new_style & WS_VISIBLE) && - ((new_style & WS_MINIMIZE) || is_window_rect_mapped( rectWindow ))) + ((new_style & WS_MINIMIZE) || is_window_rect_mapped( &new_rects->window ))) { if (!data->mapped) { @@ -2741,7 +2740,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
/* layered windows are mapped only once their attributes are set */ if (NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) - needs_map = data->layered || IsRectEmpty( rectWindow ); + needs_map = data->layered || IsRectEmpty( &new_rects->window ); release_win_data( data ); if (needs_icon) fetch_icon_data( hwnd, 0, 0 ); if (needs_map) map_window( hwnd, new_style ); @@ -2754,7 +2753,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic ); if (data->iconic) XIconifyWindow( data->display, data->whole_window, data->vis.screen ); - else if (is_window_rect_mapped( rectWindow )) + else if (is_window_rect_mapped( &new_rects->window )) XMapWindow( data->display, data->whole_window ); update_net_wm_states( data ); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 17cf8000ece..90b29a18d38 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -247,9 +247,8 @@ extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, co 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 *window_rect, const RECT *client_rect, - const RECT *visible_rect, struct window_surface *surface ); +extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, + 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 7c19895dd23..d102878a52e 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 90 +#define WINE_GDI_DRIVER_VERSION 91
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -361,8 +361,7 @@ struct user_driver_funcs 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 *, - struct window_surface*); + void (*pWindowPosChanged)(HWND,HWND,UINT,const struct window_rects*,struct window_surface*); /* system parameters */ BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT); /* vulkan support */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 2 +- dlls/win32u/window.c | 2 +- dlls/wineandroid.drv/android.h | 3 +-- dlls/wineandroid.drv/window.c | 9 +++------ dlls/winemac.drv/macdrv.h | 3 +-- dlls/winemac.drv/window.c | 14 +++++--------- dlls/winewayland.drv/waylanddrv.h | 3 +-- dlls/winewayland.drv/window.c | 9 +++------ dlls/winex11.drv/window.c | 15 ++++++--------- dlls/winex11.drv/x11drv.h | 3 +-- include/wine/gdi_driver.h | 8 ++++---- 11 files changed, 27 insertions(+), 44 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 6da282b1dab..d9935b0ed53 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -876,7 +876,7 @@ static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM return 0; }
-static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ) +static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ) { return TRUE; } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 819efab798b..207aa8ac272 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1852,7 +1852,7 @@ static struct window_surface *create_window_surface( HWND hwnd, UINT swp_flags, else if ((shaped = !!shape)) NtGdiDeleteObjectApp( shape );
rects->visible = rects->window; - if (!user_driver->pWindowPosChanging( hwnd, swp_flags, shaped, &rects->window, &rects->client, &rects->visible )) needs_surface = FALSE; + if (!user_driver->pWindowPosChanging( hwnd, swp_flags, shaped, rects )) needs_surface = FALSE; else if (parent && parent != NtUserGetDesktopWindow()) needs_surface = FALSE; else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; else if (swp_flags & SWP_SHOWWINDOW) needs_surface = TRUE; diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 18aa1ef738d..e5bae80f3fc 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -97,8 +97,7 @@ extern void ANDROID_SetCapture( HWND hwnd, UINT flags ); extern void ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ); extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); -extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, - const RECT *client_rect, RECT *visible_rect ); +extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ); 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 struct window_rects *new_rects, struct window_surface *surface ); diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 9f1a7a6ab82..7eb37f05202 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1039,16 +1039,13 @@ static struct android_win_data *create_win_data( HWND hwnd, const RECT *window_r /*********************************************************************** * ANDROID_WindowPosChanging */ -BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, - const RECT *client_rect, RECT *visible_rect ) +BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ) { struct android_win_data *data = get_win_data( hwnd );
- TRACE( "hwnd %p, swp_flags %04x, shaped %u, window_rect %s, client_rect %s, visible_rect %s\n", - hwnd, swp_flags, shaped, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), - wine_dbgstr_rect(visible_rect) ); + TRACE( "hwnd %p, swp_flags %#x, shaped %u, rects %s\n", hwnd, swp_flags, shaped, debugstr_window_rects( rects ) );
- if (!data && !(data = create_win_data( hwnd, window_rect, client_rect ))) return FALSE; /* use default surface */ + if (!data && !(data = create_win_data( hwnd, &rects->window, &rects->client ))) return FALSE; /* use default surface */ release_win_data(data);
return TRUE; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index b7d8f6b1a60..c887e4b3ea5 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -147,8 +147,7 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); extern void macdrv_UpdateLayeredWindow(HWND hwnd, UINT flags); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); -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_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects); 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); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 5cca10c567f..0ef69a2a65f 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1865,23 +1865,19 @@ LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) /*********************************************************************** * WindowPosChanging (MACDRV.@) */ -BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, - const RECT *client_rect, RECT *visible_rect) +BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects) { struct macdrv_win_data *data = get_win_data(hwnd); DWORD style = NtUserGetWindowLongW(hwnd, GWL_STYLE); BOOL ret = FALSE;
- TRACE("hwnd %p, swp_flags %04x, shaped %u, window_rect %s, client_rect %s, visible_rect %s\n", - hwnd, swp_flags, shaped, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), - wine_dbgstr_rect(visible_rect)); + TRACE("hwnd %p, swp_flags %04x, shaped %u, rects %s\n", hwnd, swp_flags, shaped, debugstr_window_rects(rects));
- if (!data && !(data = macdrv_create_win_data(hwnd, window_rect, client_rect))) return FALSE; /* use default surface */ + if (!data && !(data = macdrv_create_win_data(hwnd, &rects->window, &rects->client))) return FALSE; /* use default surface */ data->shaped = shaped;
- macdrv_window_to_mac_rect(data, style, visible_rect, window_rect, client_rect); - TRACE("visible_rect %s -> %s\n", wine_dbgstr_rect(window_rect), - wine_dbgstr_rect(visible_rect)); + macdrv_window_to_mac_rect(data, style, &rects->visible, &rects->window, &rects->client); + TRACE("-> %s\n", debugstr_window_rects(rects));
ret = !!data->cocoa_window; /* use default surface if we don't have a window */ release_win_data(data); diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index bb24837766b..5bde94a0ac9 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 struct window_rects *new_rects, 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_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects); BOOL WAYLAND_CreateWindowSurface(HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface); UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs); struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version); diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 9f91fafa721..233ca0e5a62 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -427,16 +427,13 @@ void WAYLAND_DestroyWindow(HWND hwnd) /*********************************************************************** * WAYLAND_WindowPosChanging */ -BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, - const RECT *client_rect, RECT *visible_rect) +BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects) { struct wayland_win_data *data = wayland_win_data_get(hwnd);
- TRACE("hwnd %p, swp_flags %04x, shaped %u, window_rect %s, client_rect %s, visible_rect %s\n", - hwnd, swp_flags, shaped, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), - wine_dbgstr_rect(visible_rect)); + TRACE("hwnd %p, swp_flags %04x, shaped %u, rects %s\n", hwnd, swp_flags, shaped, debugstr_window_rects(rects));
- if (!data && !(data = wayland_win_data_create(hwnd, window_rect, client_rect))) return FALSE; /* use default surface */ + if (!data && !(data = wayland_win_data_create(hwnd, &rects->window, &rects->client))) return FALSE; /* use default surface */ wayland_win_data_release(data);
return TRUE; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 5b10a577541..c428ea98539 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2588,21 +2588,18 @@ done: /*********************************************************************** * WindowPosChanging (X11DRV.@) */ -BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const RECT *window_rect, - const RECT *client_rect, RECT *visible_rect ) +BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ) { struct x11drv_win_data *data = get_win_data( hwnd ); BOOL ret = FALSE;
- TRACE( "hwnd %p, swp_flags %04x, shaped %u, window_rect %s, client_rect %s, visible_rect %s\n", - hwnd, swp_flags, shaped, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), - wine_dbgstr_rect(visible_rect) ); + TRACE( "hwnd %p, swp_flags %#x, shaped %u, rects %s\n", hwnd, swp_flags, shaped, debugstr_window_rects( rects ) );
- if (!data && !(data = X11DRV_create_win_data( hwnd, window_rect, client_rect ))) return FALSE; /* use default surface */ + if (!data && !(data = X11DRV_create_win_data( hwnd, &rects->window, &rects->client ))) return FALSE; /* use default surface */ data->shaped = shaped;
/* check if we need to switch the window to managed */ - if (!data->managed && data->whole_window && is_window_managed( hwnd, swp_flags, window_rect )) + if (!data->managed && data->whole_window && is_window_managed( hwnd, swp_flags, &rects->window )) { TRACE( "making win %p/%lx managed\n", hwnd, data->whole_window ); release_win_data( data ); @@ -2611,8 +2608,8 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const REC data->managed = TRUE; }
- X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect ); - TRACE( "visible_rect %s -> %s\n", wine_dbgstr_rect(window_rect), wine_dbgstr_rect(visible_rect) ); + X11DRV_window_to_X_rect( data, &rects->visible, &rects->window, &rects->client ); + TRACE( "-> %s\n", debugstr_window_rects(rects) );
ret = !!data->whole_window; /* use default surface if we don't have a window */ release_win_data( data ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 90b29a18d38..9d3be3868ab 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -242,8 +242,7 @@ extern LRESULT X11DRV_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARA extern void X11DRV_UpdateClipboard(void); extern void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ); 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_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ); 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 ); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index d102878a52e..c04ea5edef6 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -54,8 +54,8 @@ struct window_rects
static inline const char *debugstr_window_rects( const struct window_rects *rects ) { - return wine_dbg_sprintf( "{ window %s, client %s }", wine_dbgstr_rect( &rects->window ), - wine_dbgstr_rect( &rects->client ) ); + return wine_dbg_sprintf( "{ window %s, client %s, visible %s }", wine_dbgstr_rect( &rects->window ), + wine_dbgstr_rect( &rects->client ), wine_dbgstr_rect( &rects->visible ) ); }
typedef struct gdi_physdev @@ -193,7 +193,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 91 +#define WINE_GDI_DRIVER_VERSION 92
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -358,7 +358,7 @@ struct user_driver_funcs LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM); void (*pUpdateLayeredWindow)(HWND,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); - BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const RECT *,const RECT *,RECT *); + BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,struct window_rects *); 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 struct window_rects*,struct window_surface*);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 3 +-- dlls/win32u/window.c | 2 +- dlls/winemac.drv/macdrv.h | 3 +-- dlls/winemac.drv/window.c | 11 +++++------ dlls/winex11.drv/window.c | 11 +++++------ dlls/winex11.drv/x11drv.h | 3 +-- include/wine/gdi_driver.h | 4 ++-- 7 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index d9935b0ed53..ca31eec5f49 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -886,8 +886,7 @@ 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_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ) { }
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 207aa8ac272..b93428707a7 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2033,7 +2033,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru if (surface_win && surface_win != hwnd) move_window_bits( hwnd, &new_rects->visible, &new_rects->visible, &new_rects->window, valid_rects ); else - user_driver->pMoveWindowBits( hwnd, &new_rects->window, &new_rects->client, &new_rects->visible, valid_rects ); + user_driver->pMoveWindowBits( hwnd, new_rects, valid_rects ); }
user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, new_rects, new_surface ); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index c887e4b3ea5..7fffa8e722f 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -149,8 +149,7 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects); 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_MoveWindowBits(HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects); extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, struct window_surface *surface); extern void macdrv_DestroyCursorIcon(HCURSOR cursor); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 0ef69a2a65f..97f781738af 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1888,8 +1888,7 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct win /*********************************************************************** * MoveWindowBits (MACDRV.@) */ -void macdrv_MoveWindowBits(HWND hwnd, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects) +void macdrv_MoveWindowBits(HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects) { RECT old_visible_rect, old_client_rect; struct macdrv_win_data *data; @@ -1902,17 +1901,17 @@ void macdrv_MoveWindowBits(HWND hwnd, const RECT *window_rect, const RECT *clien 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 (EqualRect(&valid_rects[0], &new_rects->visible) && 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); + move_window_bits(hwnd, 0, &old_visible_rect, &new_rects->visible, + &old_client_rect, &new_rects->client, &new_rects->window); } else { move_window_bits(hwnd, window, &valid_rects[1], &valid_rects[0], - &old_client_rect, client_rect, window_rect); + &old_client_rect, &new_rects->client, &new_rects->window); } }
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c428ea98539..cbf13b8f4da 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2620,8 +2620,7 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct wi /*********************************************************************** * MoveWindowBits (X11DRV.@) */ -void X11DRV_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RECT *client_rect, - const RECT *visible_rect, const RECT *valid_rects ) +void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ) { RECT old_visible_rect, old_client_rect; struct x11drv_win_data *data; @@ -2634,17 +2633,17 @@ void X11DRV_MoveWindowBits( HWND hwnd, const RECT *window_rect, const RECT *clie 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 (EqualRect( &valid_rects[0], &new_rects->visible ) && 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 ); + move_window_bits( hwnd, 0, &old_visible_rect, &new_rects->visible, + &old_client_rect, &new_rects->client, &new_rects->window ); } else { move_window_bits( hwnd, window, &valid_rects[1], &valid_rects[0], - &old_client_rect, client_rect, window_rect ); + &old_client_rect, &new_rects->client, &new_rects->window ); } }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9d3be3868ab..83e7889fb59 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -244,8 +244,7 @@ extern void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ); 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_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ); extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, struct window_surface *surface ); extern BOOL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index c04ea5edef6..69bd096a1a5 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 92 +#define WINE_GDI_DRIVER_VERSION 93
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -360,7 +360,7 @@ struct user_driver_funcs LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,struct window_rects *); BOOL (*pCreateWindowSurface)(HWND,BOOL,const RECT *,struct window_surface**); - void (*pMoveWindowBits)(HWND,const RECT *,const RECT *,const RECT *,const RECT *); + void (*pMoveWindowBits)(HWND,const struct window_rects *,const RECT *); void (*pWindowPosChanged)(HWND,HWND,UINT,const struct window_rects*,struct window_surface*); /* system parameters */ BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/dce.c | 2 +- dlls/win32u/defwnd.c | 12 +++++----- dlls/win32u/menu.c | 2 +- dlls/win32u/scroll.c | 6 ++--- dlls/win32u/win32u_private.h | 2 ++ dlls/win32u/window.c | 44 ++++++++++++++++++++++-------------- 6 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 8bbd2592cf4..d7225edc995 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1963,7 +1963,7 @@ INT WINAPI NtUserScrollWindowEx( HWND hwnd, INT dx, INT dy, const RECT *rect,
for (i = 0; list[i]; i++) { - get_window_rects( list[i], COORDS_PARENT, &r, NULL, get_thread_dpi() ); + get_window_rect_rel( list[i], COORDS_PARENT, &r, get_thread_dpi() ); if (!rect || intersect_rect( &dummy, &r, rect )) NtUserSetWindowPos( list[i], 0, r.left + dx, r.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 003ba7c0846..b67a1a0ca8b 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -492,7 +492,7 @@ static void handle_window_pos_changed( HWND hwnd, const WINDOWPOS *winpos ) { RECT rect;
- get_window_rects( hwnd, COORDS_PARENT, NULL, &rect, get_thread_dpi() ); + get_client_rect_rel( hwnd, COORDS_PARENT, &rect, get_thread_dpi() ); if (!(winpos->flags & SWP_NOCLIENTMOVE)) send_message( hwnd, WM_MOVE, 0, MAKELONG( rect.left, rect.top ));
@@ -711,7 +711,7 @@ static void sys_command_size_move( HWND hwnd, WPARAM wparam )
minmax = get_min_max_info( hwnd ); dpi = get_thread_dpi(); - get_window_rects( hwnd, COORDS_PARENT, &sizing_rect, NULL, dpi ); + get_window_rect_rel( hwnd, COORDS_PARENT, &sizing_rect, dpi ); orig_rect = sizing_rect; if (style & WS_CHILD) { @@ -1029,7 +1029,7 @@ static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam ) static void get_inside_rect( HWND hwnd, enum coords_relative relative, RECT *rect, DWORD style, DWORD ex_style ) { - get_window_rects( hwnd, relative, rect, NULL, get_thread_dpi() ); + get_window_rect_rel( hwnd, relative, rect, get_thread_dpi() );
/* Remove frame from rectangle */ if (has_thick_frame( style, ex_style )) @@ -1718,7 +1718,7 @@ static void nc_paint( HWND hwnd, HRGN clip )
TRACE( "%p %d\n", hwnd, active );
- get_window_rects( hwnd, COORDS_SCREEN, NULL, &rectClient, get_thread_dpi() ); + get_client_rect_rel( hwnd, COORDS_SCREEN, &rectClient, get_thread_dpi() ); hrgn = NtGdiCreateRectRgn( rectClient.left, rectClient.top, rectClient.right, rectClient.bottom );
@@ -1738,7 +1738,7 @@ static void nc_paint( HWND hwnd, HRGN clip ) return; }
- get_window_rects( hwnd, COORDS_WINDOW, &rect, NULL, get_thread_dpi() ); + get_window_rect_rel( hwnd, COORDS_WINDOW, &rect, get_thread_dpi() ); NtGdiGetAppClipBox( hdc, &clip_rect );
NtGdiSelectPen( hdc, get_sys_color_pen( COLOR_WINDOWFRAME )); @@ -2355,7 +2355,7 @@ static LRESULT handle_nc_mouse_move( HWND hwnd, WPARAM wparam, LPARAM lparam ) if (wparam != HTHSCROLL && wparam != HTVSCROLL) return 0;
- get_window_rects( hwnd, COORDS_CLIENT, &rect, NULL, get_thread_dpi() ); + get_window_rect_rel( hwnd, COORDS_CLIENT, &rect, get_thread_dpi() );
pt.x = (short)LOWORD( lparam ); pt.y = (short)HIWORD( lparam ); diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 8a3f1350004..81b5fda6176 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -755,7 +755,7 @@ BOOL WINAPI NtUserEnableMenuItem( HMENU handle, UINT id, UINT flags ) release_menu_ptr( parent_menu );
/* Refresh the frame to reflect the change */ - get_window_rects( hwnd, COORDS_CLIENT, &rc, NULL, get_thread_dpi() ); + get_window_rect_rel( hwnd, COORDS_CLIENT, &rc, get_thread_dpi() ); rc.bottom = 0; NtUserRedrawWindow( hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN ); } diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index a42a7437175..fce07980dcf 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -196,7 +196,7 @@ static BOOL get_scroll_bar_rect( HWND hwnd, int bar, RECT *rect, int *arrow_size switch(bar) { case SB_HORZ: - get_window_rects( hwnd, COORDS_WINDOW, NULL, rect, get_thread_dpi() ); + get_client_rect_rel( hwnd, COORDS_WINDOW, rect, get_thread_dpi() ); rect->top = rect->bottom; rect->bottom += get_system_metrics( SM_CYHSCROLL ); if (win->dwStyle & WS_VSCROLL) rect->right++; @@ -204,7 +204,7 @@ static BOOL get_scroll_bar_rect( HWND hwnd, int bar, RECT *rect, int *arrow_size break;
case SB_VERT: - get_window_rects( hwnd, COORDS_WINDOW, NULL, rect, get_thread_dpi() ); + get_client_rect_rel( hwnd, COORDS_WINDOW, rect, get_thread_dpi() ); if (win->dwExStyle & WS_EX_LEFTSCROLLBAR) { rect->right = rect->left; @@ -817,7 +817,7 @@ void track_scroll_bar( HWND hwnd, int scrollbar, POINT pt )
if (scrollbar != SB_CTL) { - get_window_rects( hwnd, COORDS_CLIENT, &rect, NULL, get_thread_dpi() ); + get_window_rect_rel( hwnd, COORDS_CLIENT, &rect, get_thread_dpi() ); screen_to_client( hwnd, &pt ); pt.x -= rect.left; pt.y -= rect.top; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index fc0f0c62c93..3d7e3b41592 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -257,6 +257,8 @@ extern DWORD get_window_long( HWND hwnd, INT offset ); extern ULONG_PTR get_window_long_ptr( HWND hwnd, INT offset, BOOL ansi ); extern BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ); enum coords_relative; +extern BOOL get_window_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ); +extern BOOL get_client_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ); extern BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_rect, RECT *client_rect, UINT dpi ); extern HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *class, diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index b93428707a7..39d21907ca3 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -389,7 +389,7 @@ HWND get_parent( HWND hwnd ) */ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) { - RECT window_rect, old_screen_rect, new_screen_rect; + RECT window_rect = {0}, old_screen_rect = {0}, new_screen_rect = {0}; UINT context; WINDOWPOS winpos; HWND full_handle; @@ -439,8 +439,8 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) win = get_win_ptr( hwnd ); if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP) return 0;
- get_window_rects( hwnd, COORDS_PARENT, &window_rect, NULL, get_dpi_for_window(hwnd) ); - get_window_rects( hwnd, COORDS_SCREEN, &old_screen_rect, NULL, 0 ); + get_window_rect_rel( hwnd, COORDS_PARENT, &window_rect, get_dpi_for_window(hwnd) ); + get_window_rect_rel( hwnd, COORDS_SCREEN, &old_screen_rect, 0 );
SERVER_START_REQ( set_parent ) { @@ -458,7 +458,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) release_win_ptr( win ); if (!ret) return 0;
- get_window_rects( hwnd, COORDS_SCREEN, &new_screen_rect, NULL, 0 ); + get_window_rect_rel( hwnd, COORDS_SCREEN, &new_screen_rect, 0 ); context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd ));
user_driver->pSetParent( full_handle, parent, old_parent ); @@ -1682,16 +1682,26 @@ other_process: return ret; }
+BOOL get_window_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ) +{ + return get_window_rects( hwnd, rel, rect, NULL, dpi ); +} + /* see GetWindowRect */ BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ) { - return get_window_rects( hwnd, COORDS_SCREEN, rect, NULL, dpi ); + return get_window_rect_rel( hwnd, COORDS_SCREEN, rect, dpi ); +} + +BOOL get_client_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ) +{ + return get_window_rects( hwnd, rel, NULL, rect, dpi ); }
/* see GetClientRect */ BOOL get_client_rect( HWND hwnd, RECT *rect, UINT dpi ) { - return get_window_rects( hwnd, COORDS_CLIENT, NULL, rect, dpi ); + return get_client_rect_rel( hwnd, COORDS_CLIENT, rect, dpi ); }
/* see GetWindowInfo */ @@ -1970,8 +1980,8 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru needs_update = reply->needs_update; if (get_window_long( win->parent, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) { - RECT client; - get_window_rects( win->parent, COORDS_CLIENT, NULL, &client, get_thread_dpi() ); + RECT client = {0}; + get_client_rect_rel( win->parent, COORDS_CLIENT, &client, get_thread_dpi() ); mirror_rect( &client, &win->window_rect ); mirror_rect( &client, &win->client_rect ); mirror_rect( &client, &win->visible_rect ); @@ -2400,13 +2410,13 @@ HWND WINAPI NtUserChildWindowFromPointEx( HWND parent, LONG x, LONG y, UINT flag RECT rect; HWND ret;
- get_client_rect( parent, &rect, get_thread_dpi() ); + if (!get_client_rect( parent, &rect, get_thread_dpi() )) return 0; if (!PtInRect( &rect, pt )) return 0; if (!(list = list_window_children( 0, parent, NULL, 0 ))) return parent;
for (i = 0; list[i]; i++) { - if (!get_window_rects( list[i], COORDS_PARENT, &rect, NULL, get_thread_dpi() )) continue; + if (!get_window_rect_rel( list[i], COORDS_PARENT, &rect, get_thread_dpi() )) continue; if (!PtInRect( &rect, pt )) continue; if (flags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED)) { @@ -4150,7 +4160,7 @@ static POINT get_minimized_pos( HWND hwnd, POINT pt ) if (child == hwnd) continue; if ((get_window_long( child, GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != (WS_VISIBLE|WS_MINIMIZE)) continue; - if (get_window_rects( child, COORDS_PARENT, &rect, NULL, get_thread_dpi() )) + if (get_window_rect_rel( child, COORDS_PARENT, &rect, get_thread_dpi() )) { NtGdiSetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom ); NtGdiCombineRgn( hrgn, hrgn, tmp, RGN_OR ); @@ -4509,10 +4519,10 @@ static BOOL show_window( HWND hwnd, INT cmd ) { /* should happen only in CreateWindowEx() */ int wParam = SIZE_RESTORED; - RECT client; + RECT client = {0}; LPARAM lparam;
- get_window_rects( hwnd, COORDS_PARENT, NULL, &client, get_thread_dpi() ); + get_client_rect_rel( hwnd, COORDS_PARENT, &client, get_thread_dpi() ); lparam = MAKELONG( client.right - client.left, client.bottom - client.top ); win->flags &= ~WIN_NEED_SIZE; if (win->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED; @@ -5435,7 +5445,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
/* send WM_NCCALCSIZE */
- if (get_window_rects( hwnd, COORDS_PARENT, &new_rects.window, NULL, win_dpi )) + if (get_window_rect_rel( hwnd, COORDS_PARENT, &new_rects.window, win_dpi )) { /* yes, even if the CBT hook was called with HWND_TOP */ HWND insert_after = (get_window_long( hwnd, GWL_STYLE ) & WS_CHILD) ? HWND_BOTTOM : HWND_TOP; @@ -5466,8 +5476,8 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
if (!(win_get_flags( hwnd ) & WIN_NEED_SIZE)) { - RECT rect; - get_window_rects( hwnd, COORDS_PARENT, NULL, &rect, win_dpi ); + RECT rect = {0}; + get_client_rect_rel( hwnd, COORDS_PARENT, &rect, win_dpi ); send_message( hwnd, WM_SIZE, SIZE_RESTORED, MAKELONG( rect.right - rect.left, rect.bottom - rect.top ) ); send_message( hwnd, WM_MOVE, 0, MAKELONG( rect.left, rect.top ) ); } @@ -5656,7 +5666,7 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return enable_window( hwnd, param );
case NtUserCallHwndParam_GetChildRect: - return get_window_rects( hwnd, COORDS_PARENT, (RECT *)param, NULL, get_thread_dpi() ); + return get_window_rect_rel( hwnd, COORDS_PARENT, (RECT *)param, get_thread_dpi() );
case NtUserCallHwndParam_GetClassLongA: return get_class_long( hwnd, param, TRUE );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/dce.c | 13 ++--- dlls/win32u/defwnd.c | 98 ++++++++++++++++++------------------ dlls/win32u/win32u_private.h | 4 +- dlls/win32u/window.c | 58 ++++++++++++++------- 4 files changed, 98 insertions(+), 75 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index d7225edc995..5faea17a6a2 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1328,25 +1328,26 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags )
if (whole_rgn) { + struct window_rects rects; UINT context; - RECT client, window, update; + RECT update; INT type;
context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd ));
/* check if update rgn overlaps with nonclient area */ type = NtGdiGetRgnBox( whole_rgn, &update ); - get_window_rects( hwnd, COORDS_SCREEN, &window, &client, get_thread_dpi() ); + get_window_rects( hwnd, COORDS_SCREEN, &rects, get_thread_dpi() );
if ((*flags & UPDATE_NONCLIENT) || - update.left < client.left || update.top < client.top || - update.right > client.right || update.bottom > client.bottom) + update.left < rects.client.left || update.top < rects.client.top || + update.right > rects.client.right || update.bottom > rects.client.bottom) { - client_rgn = NtGdiCreateRectRgn( client.left, client.top, client.right, client.bottom ); + client_rgn = NtGdiCreateRectRgn( rects.client.left, rects.client.top, rects.client.right, rects.client.bottom ); NtGdiCombineRgn( client_rgn, client_rgn, whole_rgn, RGN_AND );
/* check if update rgn contains complete nonclient area */ - if (type == SIMPLEREGION && EqualRect( &window, &update )) + if (type == SIMPLEREGION && EqualRect( &rects.window, &update )) { NtGdiDeleteObjectApp( whole_rgn ); whole_rgn = (HRGN)1; diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index b67a1a0ca8b..c8b9897644c 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -1905,51 +1905,51 @@ static void handle_nc_calc_size( HWND hwnd, WPARAM wparam, RECT *win_rect )
LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) { - RECT rect, client_rect; + struct window_rects rects; DWORD style, ex_style;
TRACE( "hwnd %p pt %d,%d\n", hwnd, (int)pt.x, (int)pt.y );
- get_window_rects( hwnd, COORDS_SCREEN, &rect, &client_rect, get_thread_dpi() ); - if (!PtInRect( &rect, pt )) return HTNOWHERE; + get_window_rects( hwnd, COORDS_SCREEN, &rects, get_thread_dpi() ); + if (!PtInRect( &rects.window, pt )) return HTNOWHERE;
style = get_window_long( hwnd, GWL_STYLE ); ex_style = get_window_long( hwnd, GWL_EXSTYLE );
- if (PtInRect( &client_rect, pt )) return HTCLIENT; + if (PtInRect( &rects.client, pt )) return HTCLIENT;
/* Check borders */ if (has_thick_frame( style, ex_style )) { - InflateRect( &rect, -get_system_metrics( SM_CXFRAME ), -get_system_metrics( SM_CYFRAME )); - if (!PtInRect( &rect, pt )) + InflateRect( &rects.window, -get_system_metrics( SM_CXFRAME ), -get_system_metrics( SM_CYFRAME )); + if (!PtInRect( &rects.window, pt )) { /* Check top sizing border */ - if (pt.y < rect.top) + if (pt.y < rects.window.top) { - if (pt.x < rect.left + get_system_metrics( SM_CXSIZE )) return HTTOPLEFT; - if (pt.x >= rect.right - get_system_metrics( SM_CXSIZE )) return HTTOPRIGHT; + if (pt.x < rects.window.left + get_system_metrics( SM_CXSIZE )) return HTTOPLEFT; + if (pt.x >= rects.window.right - get_system_metrics( SM_CXSIZE )) return HTTOPRIGHT; return HTTOP; } /* Check bottom sizing border */ - if (pt.y >= rect.bottom) + if (pt.y >= rects.window.bottom) { - if (pt.x < rect.left + get_system_metrics( SM_CXSIZE )) return HTBOTTOMLEFT; - if (pt.x >= rect.right - get_system_metrics( SM_CXSIZE )) return HTBOTTOMRIGHT; + if (pt.x < rects.window.left + get_system_metrics( SM_CXSIZE )) return HTBOTTOMLEFT; + if (pt.x >= rects.window.right - get_system_metrics( SM_CXSIZE )) return HTBOTTOMRIGHT; return HTBOTTOM; } /* Check left sizing border */ - if (pt.x < rect.left) + if (pt.x < rects.window.left) { - if (pt.y < rect.top + get_system_metrics( SM_CYSIZE )) return HTTOPLEFT; - if (pt.y >= rect.bottom - get_system_metrics( SM_CYSIZE )) return HTBOTTOMLEFT; + if (pt.y < rects.window.top + get_system_metrics( SM_CYSIZE )) return HTTOPLEFT; + if (pt.y >= rects.window.bottom - get_system_metrics( SM_CYSIZE )) return HTBOTTOMLEFT; return HTLEFT; } /* Check right sizing border */ - if (pt.x >= rect.right) + if (pt.x >= rects.window.right) { - if (pt.y < rect.top + get_system_metrics( SM_CYSIZE )) return HTTOPRIGHT; - if (pt.y >= rect.bottom-get_system_metrics( SM_CYSIZE )) return HTBOTTOMRIGHT; + if (pt.y < rects.window.top + get_system_metrics( SM_CYSIZE )) return HTTOPRIGHT; + if (pt.y >= rects.window.bottom-get_system_metrics( SM_CYSIZE )) return HTBOTTOMRIGHT; return HTRIGHT; } } @@ -1957,22 +1957,22 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) else /* No thick frame */ { if (has_dialog_frame( style, ex_style )) - InflateRect( &rect, -get_system_metrics( SM_CXDLGFRAME ), + InflateRect( &rects.window, -get_system_metrics( SM_CXDLGFRAME ), -get_system_metrics( SM_CYDLGFRAME )); else if (has_thin_frame( style )) - InflateRect(&rect, -get_system_metrics( SM_CXBORDER ), + InflateRect(&rects.window, -get_system_metrics( SM_CXBORDER ), -get_system_metrics( SM_CYBORDER )); - if (!PtInRect( &rect, pt )) return HTBORDER; + if (!PtInRect( &rects.window, pt )) return HTBORDER; }
/* Check caption */ if ((style & WS_CAPTION) == WS_CAPTION) { if (ex_style & WS_EX_TOOLWINDOW) - rect.top += get_system_metrics( SM_CYSMCAPTION ) - 1; + rects.window.top += get_system_metrics( SM_CYSMCAPTION ) - 1; else - rect.top += get_system_metrics( SM_CYCAPTION ) - 1; - if (!PtInRect( &rect, pt )) + rects.window.top += get_system_metrics( SM_CYCAPTION ) - 1; + if (!PtInRect( &rects.window, pt )) { BOOL min_or_max_box = (style & WS_SYSMENU) && (style & (WS_MINIMIZEBOX | WS_MAXIMIZEBOX)); if (ex_style & WS_EX_LAYOUTRTL) @@ -1981,26 +1981,26 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) if ((style & WS_SYSMENU) && !(ex_style & WS_EX_TOOLWINDOW) && get_nc_icon_for_window( hwnd )) { - rect.right -= get_system_metrics( SM_CYCAPTION ) - 1; - if (pt.x > rect.right) return HTSYSMENU; + rects.window.right -= get_system_metrics( SM_CYCAPTION ) - 1; + if (pt.x > rects.window.right) return HTSYSMENU; }
/* Check close button */ if (style & WS_SYSMENU) { - rect.left += get_system_metrics( SM_CYCAPTION ); - if (pt.x < rect.left) return HTCLOSE; + rects.window.left += get_system_metrics( SM_CYCAPTION ); + if (pt.x < rects.window.left) return HTCLOSE; }
if (min_or_max_box && !(ex_style & WS_EX_TOOLWINDOW)) { /* Check maximize box */ - rect.left += get_system_metrics( SM_CXSIZE ); - if (pt.x < rect.left) return HTMAXBUTTON; + rects.window.left += get_system_metrics( SM_CXSIZE ); + if (pt.x < rects.window.left) return HTMAXBUTTON;
/* Check minimize box */ - rect.left += get_system_metrics( SM_CXSIZE ); - if (pt.x < rect.left) return HTMINBUTTON; + rects.window.left += get_system_metrics( SM_CXSIZE ); + if (pt.x < rects.window.left) return HTMINBUTTON; } } else @@ -2009,26 +2009,26 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) if ((style & WS_SYSMENU) && !(ex_style & WS_EX_TOOLWINDOW) && get_nc_icon_for_window( hwnd )) { - rect.left += get_system_metrics( SM_CYCAPTION ) - 1; - if (pt.x < rect.left) return HTSYSMENU; + rects.window.left += get_system_metrics( SM_CYCAPTION ) - 1; + if (pt.x < rects.window.left) return HTSYSMENU; }
/* Check close button */ if (style & WS_SYSMENU) { - rect.right -= get_system_metrics( SM_CYCAPTION ); - if (pt.x > rect.right) return HTCLOSE; + rects.window.right -= get_system_metrics( SM_CYCAPTION ); + if (pt.x > rects.window.right) return HTCLOSE; }
if (min_or_max_box && !(ex_style & WS_EX_TOOLWINDOW)) { /* Check maximize box */ - rect.right -= get_system_metrics( SM_CXSIZE ); - if (pt.x > rect.right) return HTMAXBUTTON; + rects.window.right -= get_system_metrics( SM_CXSIZE ); + if (pt.x > rects.window.right) return HTMAXBUTTON;
/* Check minimize box */ - rect.right -= get_system_metrics( SM_CXSIZE ); - if (pt.x > rect.right) return HTMINBUTTON; + rects.window.right -= get_system_metrics( SM_CXSIZE ); + if (pt.x > rects.window.right) return HTMINBUTTON; } } return HTCAPTION; @@ -2036,8 +2036,8 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) }
/* Check menu bar */ - if (has_menu( hwnd, style ) && (pt.y < client_rect.top) && - (pt.x >= client_rect.left) && (pt.x < client_rect.right)) + if (has_menu( hwnd, style ) && (pt.y < rects.client.top) && + (pt.x >= rects.client.left) && (pt.x < rects.client.right)) return HTMENU;
/* Check vertical scroll bar */ @@ -2045,23 +2045,23 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) if (style & WS_VSCROLL) { if (ex_style & WS_EX_LEFTSCROLLBAR) - client_rect.left -= get_system_metrics( SM_CXVSCROLL ); + rects.client.left -= get_system_metrics( SM_CXVSCROLL ); else - client_rect.right += get_system_metrics( SM_CXVSCROLL ); - if (PtInRect( &client_rect, pt )) return HTVSCROLL; + rects.client.right += get_system_metrics( SM_CXVSCROLL ); + if (PtInRect( &rects.client, pt )) return HTVSCROLL; }
/* Check horizontal scroll bar */ if (style & WS_HSCROLL) { - client_rect.bottom += get_system_metrics( SM_CYHSCROLL ); - if (PtInRect( &client_rect, pt )) + rects.client.bottom += get_system_metrics( SM_CYHSCROLL ); + if (PtInRect( &rects.client, pt )) { /* Check size box */ if ((style & WS_VSCROLL) && ((ex_style & WS_EX_LEFTSCROLLBAR) - ? (pt.x <= client_rect.left + get_system_metrics( SM_CXVSCROLL )) - : (pt.x >= client_rect.right - get_system_metrics( SM_CXVSCROLL )))) + ? (pt.x <= rects.client.left + get_system_metrics( SM_CXVSCROLL )) + : (pt.x >= rects.client.right - get_system_metrics( SM_CXVSCROLL )))) return HTSIZE; return HTHSCROLL; } diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 3d7e3b41592..73933acc14a 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -259,8 +259,8 @@ extern BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ); enum coords_relative; extern BOOL get_window_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ); extern BOOL get_client_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ); -extern BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_rect, - RECT *client_rect, UINT dpi ); +extern BOOL get_window_rects( HWND hwnd, enum coords_relative relative, + struct window_rects *rects, UINT dpi ); extern HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *class, DWORD tid ); extern int map_window_points( HWND hwnd_from, HWND hwnd_to, POINT *points, UINT count, diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 39d21907ca3..040411d3e79 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1562,8 +1562,7 @@ static void mirror_rect( const RECT *window_rect, RECT *rect ) * * Get the window and client rectangles. */ -BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_rect, - RECT *client_rect, UINT dpi ) +BOOL get_window_rects( HWND hwnd, enum coords_relative relative, struct window_rects *rects, UINT dpi ) { WND *win = get_win_ptr( hwnd ); BOOL ret = TRUE; @@ -1587,8 +1586,9 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_re { rect = get_primary_monitor_rect( dpi ); } - if (window_rect) *window_rect = rect; - if (client_rect) *client_rect = rect; + rects->window = rect; + rects->client = rect; + rects->visible = rect; return TRUE; } if (win != WND_OTHER_PROCESS) @@ -1596,20 +1596,29 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_re UINT window_dpi = get_dpi_for_window( hwnd ); RECT window = win->window_rect; RECT client = win->client_rect; + RECT visible = win->visible_rect;
switch (relative) { case COORDS_CLIENT: OffsetRect( &window, -win->client_rect.left, -win->client_rect.top ); OffsetRect( &client, -win->client_rect.left, -win->client_rect.top ); + OffsetRect( &visible, -win->client_rect.left, -win->client_rect.top ); if (win->dwExStyle & WS_EX_LAYOUTRTL) + { mirror_rect( &win->client_rect, &window ); + mirror_rect( &win->client_rect, &visible ); + } break; case COORDS_WINDOW: OffsetRect( &window, -win->window_rect.left, -win->window_rect.top ); OffsetRect( &client, -win->window_rect.left, -win->window_rect.top ); + OffsetRect( &visible, -win->window_rect.left, -win->window_rect.top ); if (win->dwExStyle & WS_EX_LAYOUTRTL) + { mirror_rect( &win->window_rect, &client ); + mirror_rect( &win->window_rect, &visible ); + } break; case COORDS_PARENT: if (win->parent) @@ -1631,6 +1640,7 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_re { mirror_rect( &parent->client_rect, &window ); mirror_rect( &parent->client_rect, &client ); + mirror_rect( &parent->client_rect, &visible ); } release_win_ptr( parent ); } @@ -1656,12 +1666,14 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_re { OffsetRect( &window, win->client_rect.left, win->client_rect.top ); OffsetRect( &client, win->client_rect.left, win->client_rect.top ); + OffsetRect( &visible, win->client_rect.left, win->client_rect.top ); } } break; } - if (window_rect) *window_rect = map_dpi_rect( window, window_dpi, dpi ); - if (client_rect) *client_rect = map_dpi_rect( client, window_dpi, dpi ); + rects->window = map_dpi_rect( window, window_dpi, dpi ); + rects->client = map_dpi_rect( client, window_dpi, dpi ); + rects->visible = map_dpi_rect( visible, window_dpi, dpi ); release_win_ptr( win ); return TRUE; } @@ -1674,8 +1686,9 @@ other_process: req->dpi = dpi; if ((ret = !wine_server_call_err( req ))) { - if (window_rect) *window_rect = wine_server_get_rect( reply->window ); - if (client_rect) *client_rect = wine_server_get_rect( reply->client ); + rects->window = wine_server_get_rect( reply->window ); + rects->client = wine_server_get_rect( reply->client ); + rects->visible = rects->window; } } SERVER_END_REQ; @@ -1684,7 +1697,10 @@ other_process:
BOOL get_window_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ) { - return get_window_rects( hwnd, rel, rect, NULL, dpi ); + struct window_rects rects; + BOOL ret = get_window_rects( hwnd, rel, &rects, dpi ); + if (ret) *rect = rects.window; + return ret; }
/* see GetWindowRect */ @@ -1695,7 +1711,10 @@ BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi )
BOOL get_client_rect_rel( HWND hwnd, enum coords_relative rel, RECT *rect, UINT dpi ) { - return get_window_rects( hwnd, rel, NULL, rect, dpi ); + struct window_rects rects; + BOOL ret = get_window_rects( hwnd, rel, &rects, dpi ); + if (ret) *rect = rects.client; + return ret; }
/* see GetClientRect */ @@ -1707,11 +1726,13 @@ BOOL get_client_rect( HWND hwnd, RECT *rect, UINT dpi ) /* see GetWindowInfo */ static BOOL get_window_info( HWND hwnd, WINDOWINFO *info ) { + struct window_rects rects;
- if (!info || !get_window_rects( hwnd, COORDS_SCREEN, &info->rcWindow, - &info->rcClient, get_thread_dpi() )) + if (!info || !get_window_rects( hwnd, COORDS_SCREEN, &rects, get_thread_dpi() )) return FALSE;
+ info->rcWindow = rects.window; + info->rcClient = rects.client; info->dwStyle = get_window_long( hwnd, GWL_STYLE ); info->dwExStyle = get_window_long( hwnd, GWL_EXSTYLE ); info->dwWindowStatus = get_active_window() == hwnd ? WS_ACTIVECAPTION : 0; @@ -1928,13 +1949,11 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru
is_layered = new_surface && new_surface->alpha_mask;
- get_window_rects( hwnd, COORDS_SCREEN, &old_rects.window, NULL, get_thread_dpi() ); + get_window_rects( hwnd, COORDS_SCREEN, &old_rects, get_thread_dpi() ); if (IsRectEmpty( &valid_rects[0] ) || is_layered) valid_rects = NULL;
if (!(win = get_win_ptr( hwnd )) || win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE;
- old_rects.visible = win->visible_rect; - old_rects.client = win->client_rect; old_surface = win->surface; if (old_surface != new_surface) swp_flags |= SWP_FRAMECHANGED; /* force refreshing non-client area */ if (new_surface == &dummy_surface) swp_flags |= SWP_NOREDRAW; @@ -2215,7 +2234,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ return FALSE; }
- get_window_rects( hwnd, COORDS_PARENT, &new_rects.window, &new_rects.client, get_thread_dpi() ); + get_window_rects( hwnd, COORDS_PARENT, &new_rects, get_thread_dpi() );
if (pts_dst) { @@ -2223,6 +2242,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ offset.cy = pts_dst->y - new_rects.window.top; OffsetRect( &new_rects.client, offset.cx, offset.cy ); OffsetRect( &new_rects.window, offset.cx, offset.cy ); + OffsetRect( &new_rects.visible, offset.cx, offset.cy ); swp_flags &= ~SWP_NOMOVE; } if (size) @@ -2243,6 +2263,8 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ new_rects.client.bottom += offset.cy; new_rects.window.right += offset.cx; new_rects.window.bottom += offset.cy; + new_rects.visible.right += offset.cx; + new_rects.visible.bottom += offset.cy; swp_flags &= ~SWP_NOSIZE; }
@@ -3137,7 +3159,7 @@ static BOOL calc_winpos( WINDOWPOS *winpos, struct window_rects *old_rects, stru win == WND_OTHER_PROCESS || win == WND_DESKTOP) return FALSE;
/* Calculate new position and size */ - get_window_rects( winpos->hwnd, COORDS_PARENT, &old_rects->window, &old_rects->client, get_thread_dpi() ); + get_window_rects( winpos->hwnd, COORDS_PARENT, old_rects, get_thread_dpi() ); old_rects->visible = win->visible_rect; *new_rects = *old_rects;
@@ -4360,7 +4382,7 @@ void update_window_state( HWND hwnd ) }
context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); - get_window_rects( hwnd, COORDS_PARENT, &new_rects.window, &new_rects.client, get_thread_dpi() ); + get_window_rects( hwnd, COORDS_PARENT, &new_rects, get_thread_dpi() ); valid_rects[0] = valid_rects[1] = new_rects.client;
surface = create_window_surface( hwnd, swp_flags, FALSE, &new_rects, &surface_rect );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 45 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 040411d3e79..635d14026d4 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3268,8 +3268,8 @@ static inline void get_valid_rects( const RECT *old_client, const RECT *new_clie } }
-static UINT calc_ncsize( WINDOWPOS *winpos, const RECT *old_window_rect, const RECT *old_client_rect, - const RECT *new_window_rect, RECT *new_client_rect, RECT *valid_rects, +static UINT calc_ncsize( WINDOWPOS *winpos, const struct window_rects *old_rects, + struct window_rects *new_rects, RECT *valid_rects, int parent_x, int parent_y ) { UINT wvr_flags = 0; @@ -3281,22 +3281,22 @@ static UINT calc_ncsize( WINDOWPOS *winpos, const RECT *old_window_rect, const R WINDOWPOS winposCopy; UINT class_style;
- params.rgrc[0] = *new_window_rect; - params.rgrc[1] = *old_window_rect; - params.rgrc[2] = *old_client_rect; + params.rgrc[0] = new_rects->window; + params.rgrc[1] = old_rects->window; + params.rgrc[2] = old_rects->client; params.lppos = &winposCopy; winposCopy = *winpos;
if (winpos->flags & SWP_NOMOVE) { - winposCopy.x = old_window_rect->left; - winposCopy.y = old_window_rect->top; + winposCopy.x = old_rects->window.left; + winposCopy.y = old_rects->window.top; }
if (winpos->flags & SWP_NOSIZE) { - winposCopy.cx = old_window_rect->right - old_window_rect->left; - winposCopy.cy = old_window_rect->bottom - old_window_rect->top; + winposCopy.cx = old_rects->window.right - old_rects->window.left; + winposCopy.cy = old_rects->window.bottom - old_rects->window.top; }
class_style = get_class_long( winpos->hwnd, GCL_STYLE, FALSE ); @@ -3305,24 +3305,24 @@ static UINT calc_ncsize( WINDOWPOS *winpos, const RECT *old_window_rect, const R
wvr_flags |= send_message( winpos->hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)¶ms );
- *new_client_rect = params.rgrc[0]; + new_rects->client = params.rgrc[0];
TRACE( "hwnd %p old win %s old client %s new win %s new client %s\n", winpos->hwnd, - wine_dbgstr_rect(old_window_rect), wine_dbgstr_rect(old_client_rect), - wine_dbgstr_rect(new_window_rect), wine_dbgstr_rect(new_client_rect) ); + wine_dbgstr_rect(&old_rects->window), wine_dbgstr_rect(&old_rects->client), + wine_dbgstr_rect(&new_rects->window), wine_dbgstr_rect(&new_rects->client) );
- if (new_client_rect->left != old_client_rect->left - parent_x || - new_client_rect->top != old_client_rect->top - parent_y) + if (new_rects->client.left != old_rects->client.left - parent_x || + new_rects->client.top != old_rects->client.top - parent_y) winpos->flags &= ~SWP_NOCLIENTMOVE;
- if ((new_client_rect->right - new_client_rect->left != - old_client_rect->right - old_client_rect->left)) + if ((new_rects->client.right - new_rects->client.left != + old_rects->client.right - old_rects->client.left)) winpos->flags &= ~SWP_NOCLIENTSIZE; else wvr_flags &= ~WVR_HREDRAW;
- if (new_client_rect->bottom - new_client_rect->top != - old_client_rect->bottom - old_client_rect->top) + if (new_rects->client.bottom - new_rects->client.top != + old_rects->client.bottom - old_rects->client.top) winpos->flags &= ~SWP_NOCLIENTSIZE; else wvr_flags &= ~WVR_VREDRAW; @@ -3333,8 +3333,8 @@ static UINT calc_ncsize( WINDOWPOS *winpos, const RECT *old_window_rect, const R else { if (!(winpos->flags & SWP_NOMOVE) && - (new_client_rect->left != old_client_rect->left - parent_x || - new_client_rect->top != old_client_rect->top - parent_y)) + (new_rects->client.left != old_rects->client.left - parent_x || + new_rects->client.top != old_rects->client.top - parent_y)) winpos->flags &= ~SWP_NOCLIENTMOVE; }
@@ -3343,7 +3343,7 @@ static UINT calc_ncsize( WINDOWPOS *winpos, const RECT *old_window_rect, const R SetRectEmpty( &valid_rects[0] ); SetRectEmpty( &valid_rects[1] ); } - else get_valid_rects( old_client_rect, new_client_rect, wvr_flags, valid_rects ); + else get_valid_rects( &old_rects->client, &new_rects->client, wvr_flags, valid_rects );
return wvr_flags; } @@ -3583,8 +3583,7 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y )
/* Common operations */
- calc_ncsize( winpos, &old_rects.window, &old_rects.client, - &new_rects.window, &new_rects.client, valid_rects, parent_x, parent_y ); + calc_ncsize( winpos, &old_rects, &new_rects, valid_rects, parent_x, parent_y );
surface = create_window_surface( winpos->hwnd, winpos->flags, FALSE, &new_rects, &surface_rect ); if (!apply_window_pos( winpos->hwnd, winpos->hwndInsertAfter, winpos->flags, surface,
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/ntuser_private.h | 4 +- dlls/win32u/window.c | 82 +++++++++++++++++------------------- 2 files changed, 40 insertions(+), 46 deletions(-)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index a361e1d73a5..fd594488c08 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -54,9 +54,7 @@ typedef struct tagWND WNDPROC winproc; /* Window procedure */ UINT tid; /* Owner thread id */ HINSTANCE hInstance; /* Window hInstance (from CreateWindow) */ - RECT client_rect; /* Client area rel. to parent client area */ - RECT window_rect; /* Whole window rel. to parent client area */ - RECT visible_rect; /* Visible part of the whole rect, rel. to parent client area */ + struct window_rects rects; /* window rects in window DPI, relative to the parent client area */ RECT normal_rect; /* Normal window rect saved when maximized/minimized */ POINT min_pos; /* Position for minimized window */ POINT max_pos; /* Position for maximized window */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 635d14026d4..1b8ed407e0a 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1594,30 +1594,28 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, struct window_r if (win != WND_OTHER_PROCESS) { UINT window_dpi = get_dpi_for_window( hwnd ); - RECT window = win->window_rect; - RECT client = win->client_rect; - RECT visible = win->visible_rect; + *rects = win->rects;
switch (relative) { case COORDS_CLIENT: - OffsetRect( &window, -win->client_rect.left, -win->client_rect.top ); - OffsetRect( &client, -win->client_rect.left, -win->client_rect.top ); - OffsetRect( &visible, -win->client_rect.left, -win->client_rect.top ); + OffsetRect( &rects->window, -win->rects.client.left, -win->rects.client.top ); + OffsetRect( &rects->client, -win->rects.client.left, -win->rects.client.top ); + OffsetRect( &rects->visible, -win->rects.client.left, -win->rects.client.top ); if (win->dwExStyle & WS_EX_LAYOUTRTL) { - mirror_rect( &win->client_rect, &window ); - mirror_rect( &win->client_rect, &visible ); + mirror_rect( &win->rects.client, &rects->window ); + mirror_rect( &win->rects.client, &rects->visible ); } break; case COORDS_WINDOW: - OffsetRect( &window, -win->window_rect.left, -win->window_rect.top ); - OffsetRect( &client, -win->window_rect.left, -win->window_rect.top ); - OffsetRect( &visible, -win->window_rect.left, -win->window_rect.top ); + OffsetRect( &rects->window, -win->rects.window.left, -win->rects.window.top ); + OffsetRect( &rects->client, -win->rects.window.left, -win->rects.window.top ); + OffsetRect( &rects->visible, -win->rects.window.left, -win->rects.window.top ); if (win->dwExStyle & WS_EX_LAYOUTRTL) { - mirror_rect( &win->window_rect, &client ); - mirror_rect( &win->window_rect, &visible ); + mirror_rect( &win->rects.window, &rects->client ); + mirror_rect( &win->rects.window, &rects->visible ); } break; case COORDS_PARENT: @@ -1638,9 +1636,9 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, struct window_r } if (parent->dwExStyle & WS_EX_LAYOUTRTL) { - mirror_rect( &parent->client_rect, &window ); - mirror_rect( &parent->client_rect, &client ); - mirror_rect( &parent->client_rect, &visible ); + mirror_rect( &parent->rects.client, &rects->window ); + mirror_rect( &parent->rects.client, &rects->client ); + mirror_rect( &parent->rects.client, &rects->visible ); } release_win_ptr( parent ); } @@ -1664,16 +1662,16 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, struct window_r win = parent; if (win->parent) { - OffsetRect( &window, win->client_rect.left, win->client_rect.top ); - OffsetRect( &client, win->client_rect.left, win->client_rect.top ); - OffsetRect( &visible, win->client_rect.left, win->client_rect.top ); + OffsetRect( &rects->window, win->rects.client.left, win->rects.client.top ); + OffsetRect( &rects->client, win->rects.client.left, win->rects.client.top ); + OffsetRect( &rects->visible, win->rects.client.left, win->rects.client.top ); } } break; } - rects->window = map_dpi_rect( window, window_dpi, dpi ); - rects->client = map_dpi_rect( client, window_dpi, dpi ); - rects->visible = map_dpi_rect( visible, window_dpi, dpi ); + rects->window = map_dpi_rect( rects->window, window_dpi, dpi ); + rects->client = map_dpi_rect( rects->client, window_dpi, dpi ); + rects->visible = map_dpi_rect( rects->visible, window_dpi, dpi ); release_win_ptr( win ); return TRUE; } @@ -1991,9 +1989,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru { win->dwStyle = reply->new_style; win->dwExStyle = reply->new_ex_style; - win->window_rect = new_rects->window; - win->client_rect = new_rects->client; - win->visible_rect = new_rects->visible; + win->rects = *new_rects; if ((win->surface = new_surface)) window_surface_add_ref( win->surface ); surface_win = wine_server_ptr_handle( reply->surface_win ); needs_update = reply->needs_update; @@ -2001,9 +1997,9 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru { RECT client = {0}; get_client_rect_rel( win->parent, COORDS_CLIENT, &client, get_thread_dpi() ); - mirror_rect( &client, &win->window_rect ); - mirror_rect( &client, &win->client_rect ); - mirror_rect( &client, &win->visible_rect ); + mirror_rect( &client, &win->rects.window ); + mirror_rect( &client, &win->rects.client ); + mirror_rect( &client, &win->rects.visible ); } /* if an RTL window is resized the children have moved */ if (win->dwExStyle & WS_EX_LAYOUTRTL && @@ -2523,8 +2519,8 @@ static void update_maximized_pos( WND *wnd, RECT *work_rect )
if (wnd->dwStyle & WS_MAXIMIZE) { - if (wnd->window_rect.left <= work_rect->left && wnd->window_rect.top <= work_rect->top && - wnd->window_rect.right >= work_rect->right && wnd->window_rect.bottom >= work_rect->bottom) + if (wnd->rects.window.left <= work_rect->left && wnd->rects.window.top <= work_rect->top && + wnd->rects.window.right >= work_rect->right && wnd->rects.window.bottom >= work_rect->bottom) wnd->max_pos.x = wnd->max_pos.y = -1; } else @@ -2588,17 +2584,17 @@ BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement ) /* update the placement according to the current style */ if (win->dwStyle & WS_MINIMIZE) { - win->min_pos.x = win->window_rect.left; - win->min_pos.y = win->window_rect.top; + win->min_pos.x = win->rects.window.left; + win->min_pos.y = win->rects.window.top; } else if (win->dwStyle & WS_MAXIMIZE) { - win->max_pos.x = win->window_rect.left; - win->max_pos.y = win->window_rect.top; + win->max_pos.x = win->rects.window.left; + win->max_pos.y = win->rects.window.top; } else { - win->normal_rect = win->window_rect; + win->normal_rect = win->rects.window; } update_maximized_pos( win, &work_rect );
@@ -2913,12 +2909,12 @@ static BOOL get_windows_offset( HWND hwnd_from, HWND hwnd_to, UINT dpi, BOOL *mi if (win->dwExStyle & WS_EX_LAYOUTRTL) { mirror_from = TRUE; - offset.x += win->client_rect.right - win->client_rect.left; + offset.x += win->rects.client.right - win->rects.client.left; } while (win->parent) { - offset.x += win->client_rect.left; - offset.y += win->client_rect.top; + offset.x += win->rects.client.left; + offset.y += win->rects.client.top; hwnd = win->parent; release_win_ptr( win ); if (!(win = get_win_ptr( hwnd ))) break; @@ -2951,12 +2947,12 @@ static BOOL get_windows_offset( HWND hwnd_from, HWND hwnd_to, UINT dpi, BOOL *mi if (win->dwExStyle & WS_EX_LAYOUTRTL) { mirror_to = TRUE; - pt.x += win->client_rect.right - win->client_rect.left; + pt.x += win->rects.client.right - win->rects.client.left; } while (win->parent) { - pt.x += win->client_rect.left; - pt.y += win->client_rect.top; + pt.x += win->rects.client.left; + pt.y += win->rects.client.top; hwnd = win->parent; release_win_ptr( win ); if (!(win = get_win_ptr( hwnd ))) break; @@ -3160,7 +3156,7 @@ static BOOL calc_winpos( WINDOWPOS *winpos, struct window_rects *old_rects, stru
/* Calculate new position and size */ get_window_rects( winpos->hwnd, COORDS_PARENT, old_rects, get_thread_dpi() ); - old_rects->visible = win->visible_rect; + old_rects->visible = win->rects.visible; *new_rects = *old_rects;
if (!(winpos->flags & SWP_NOSIZE)) @@ -3181,7 +3177,7 @@ static BOOL calc_winpos( WINDOWPOS *winpos, struct window_rects *old_rects, stru { /* If the window is toplevel minimized off-screen, force keep it there */ if ((win->dwStyle & WS_MINIMIZE) && - win->window_rect.left <= -32000 && win->window_rect.top <= -32000 && + win->rects.window.left <= -32000 && win->rects.window.top <= -32000 && (!win->parent || win->parent == get_desktop_window())) { winpos->x = -32000;
v2: Left get_window_rect / get_client_rect rect param unchanged on error, remove unnecessary initializations, add some now necessary rect initialization elsewhere to avoid warnings.
This merge request was approved by Huw Davies.