From: Rémi Bernon rbernon@codeweavers.com
This is used to move pixels when drawing directly to the host window. In this case, the DC operations are all in window DPI, and DPI scaling isn't supported. --- dlls/win32u/driver.c | 3 ++- dlls/win32u/window.c | 6 +----- dlls/winex11.drv/window.c | 18 ++++++++---------- dlls/winex11.drv/x11drv.h | 12 ++---------- include/wine/gdi_driver.h | 2 +- 5 files changed, 14 insertions(+), 27 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 02478b18a8a..5ef417a9346 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -886,7 +886,8 @@ static BOOL nulldrv_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *su return FALSE; }
-static void nulldrv_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ) +static void nulldrv_MoveWindowBits( HWND hwnd, const struct window_rects *old_rects, + const struct window_rects *new_rects, const RECT *valid_rects ) { }
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index cb7b1f6e3a6..5ad846f5a89 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2125,11 +2125,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 - { - rects[0] = map_dpi_rect( valid_rects[0], get_thread_dpi(), monitor_dpi ); - rects[1] = map_dpi_rect( valid_rects[1], get_thread_dpi(), monitor_dpi ); - user_driver->pMoveWindowBits( hwnd, &monitor_rects, rects ); - } + user_driver->pMoveWindowBits( hwnd, &old_rects, new_rects, valid_rects ); }
user_driver->pWindowPosChanged( hwnd, insert_after, swp_flags, is_fullscreen, &monitor_rects, get_driver_window_surface( new_surface, monitor_dpi ) ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f18ab302e5e..a4327398b8a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1460,9 +1460,9 @@ static void move_window_bits( HWND hwnd, Window window, const RECT *old_rect, co /* map region to client rect since we are using DCX_WINDOW */ NtGdiOffsetRgn( rgn, new_window_rect->left - new_client_rect->left, new_window_rect->top - new_client_rect->top ); - redraw_window( hwnd, NULL, rgn, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN ); + NtUserRedrawWindow( hwnd, NULL, rgn, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN ); } - else redraw_window( hwnd, NULL, rgn, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ); + else NtUserRedrawWindow( hwnd, NULL, rgn, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ); NtGdiDeleteObjectApp( rgn ); } } @@ -2515,30 +2515,28 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const str /*********************************************************************** * MoveWindowBits (X11DRV.@) */ -void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ) +void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *old_rects, + const struct window_rects *new_rects, 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->rects.visible; - old_client_rect = data->rects.client; 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], &new_rects->visible ) && EqualRect( &valid_rects[1], &old_visible_rect )) + if (EqualRect( &valid_rects[0], &new_rects->visible ) && EqualRect( &valid_rects[1], &old_rects->visible )) { /* 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, &new_rects->visible, - &old_client_rect, &new_rects->client, &new_rects->window ); + move_window_bits( hwnd, 0, &old_rects->visible, &new_rects->visible, + &old_rects->client, &new_rects->client, &new_rects->window ); } else { move_window_bits( hwnd, window, &valid_rects[1], &valid_rects[0], - &old_client_rect, &new_rects->client, &new_rects->window ); + &old_rects->client, &new_rects->client, &new_rects->window ); } }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 02cba58f09f..74fa9c17973 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -244,7 +244,8 @@ extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ); extern BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ); extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ); -extern void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ); +extern void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *old_rects, + const struct window_rects *new_rects, const RECT *valid_rects ); extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, BOOL fullscreen, const struct window_rects *new_rects, struct window_surface *surface ); extern BOOL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, @@ -881,15 +882,6 @@ static inline BOOL set_window_pos( HWND hwnd, HWND after, INT x, INT y, INT cx, return ret; }
-/* per-monitor DPI aware NtUserRedrawWindow call */ -static inline BOOL redraw_window( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags ) -{ - UINT context = NtUserSetThreadDpiAwarenessContext( NTUSER_DPI_PER_MONITOR_AWARE_V2 ); - BOOL ret = NtUserRedrawWindow( hwnd, rect, hrgn, flags ); - NtUserSetThreadDpiAwarenessContext( context ); - return ret; -} - /* per-monitor DPI aware NtUserChildWindowFromPointEx call */ static inline HWND child_window_from_point( HWND parent, LONG x, LONG y, UINT flags ) { diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 8d628a426ae..66ab52754a0 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -386,7 +386,7 @@ struct user_driver_funcs BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const struct window_rects *); BOOL (*pGetWindowStyleMasks)(HWND,UINT,UINT,UINT*,UINT*); BOOL (*pCreateWindowSurface)(HWND,BOOL,const RECT *,struct window_surface**); - void (*pMoveWindowBits)(HWND,const struct window_rects *,const RECT *); + void (*pMoveWindowBits)(HWND,const struct window_rects *,const struct window_rects *,const RECT *); void (*pWindowPosChanged)(HWND,HWND,UINT,BOOL,const struct window_rects*,struct window_surface*); /* system parameters */ BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT);