From: Jacek Caban jacek@codeweavers.com
To allow using it in drivers.
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/win32u/dce.c | 16 ++++++++-------- dlls/win32u/message.c | 6 +++--- dlls/win32u/sysparams.c | 6 ++++-- dlls/win32u/win32u_private.h | 1 - dlls/win32u/window.c | 28 ++++++++++++++-------------- 5 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index fbde3f3d0ec..62d84d7e77b 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -810,7 +810,7 @@ void invalidate_dce( WND *win, const RECT *extra_rect )
if (!win->parent) return;
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( win->obj.handle )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( win->obj.handle )); get_window_rect( win->obj.handle, &window_rect, get_thread_dpi() );
TRACE("%p parent %p %s (%s)\n", @@ -845,7 +845,7 @@ void invalidate_dce( WND *win, const RECT *extra_rect ) make_dc_dirty( dce ); } } - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); }
/*********************************************************************** @@ -1160,7 +1160,7 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags ) RECT client, window, update; INT type;
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd ));
/* check if update rgn overlaps with nonclient area */ type = NtGdiGetRgnBox( whole_rgn, &update ); @@ -1201,7 +1201,7 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags ) } if (whole_rgn > (HRGN)1) NtGdiDeleteObjectApp( whole_rgn ); } - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); } return client_rgn; } @@ -1500,7 +1500,7 @@ INT WINAPI NtUserGetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ) UINT flags = UPDATE_NOCHILDREN; HRGN update_rgn;
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd ));
if (erase) flags |= UPDATE_NONCLIENT | UPDATE_ERASE;
@@ -1515,7 +1515,7 @@ INT WINAPI NtUserGetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ) /* map region to client coordinates */ map_window_region( 0, hwnd, hrgn ); } - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return retval; }
@@ -1564,12 +1564,12 @@ INT WINAPI NtUserExcludeUpdateRgn( HDC hdc, HWND hwnd ) DPI_AWARENESS_CONTEXT context; POINT pt;
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd )); NtGdiGetDCPoint( hdc, NtGdiGetDCOrg, &pt ); map_window_points( 0, hwnd, &pt, 1, get_thread_dpi() ); NtGdiOffsetRgn( update_rgn, -pt.x, -pt.y ); ret = NtGdiExtSelectClipRgn( hdc, update_rgn, RGN_DIFF ); - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); } NtGdiDeleteObjectApp( update_rgn ); return ret; diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index bc6db20d164..b41d252457d 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1420,7 +1420,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H }
msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt ); - set_thread_dpi_awareness_context( get_window_dpi_awareness_context( msg->hwnd )); + SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( msg->hwnd ));
/* FIXME: is this really the right place for this hook? */ event.message = msg->message; @@ -1599,7 +1599,7 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardwar get_user_thread_info()->msg_source.originId = msg_data->source.origin;
/* hardware messages are always in physical coords */ - context = set_thread_dpi_awareness_context( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); + context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
if (msg->message == WM_INPUT || msg->message == WM_INPUT_DEVICE_CHANGE) ret = user_callbacks && user_callbacks->process_rawinput_message( msg, hw_id, msg_data ); @@ -1609,7 +1609,7 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardwar ret = process_mouse_message( msg, hw_id, msg_data->info, hwnd_filter, first, last, remove ); else ERR( "unknown message type %x\n", msg->message ); - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return ret; }
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index b68bfa3a7ce..902cd7ddb0c 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1459,8 +1459,10 @@ static DPI_AWARENESS get_awareness_from_dpi_awareness_context( DPI_AWARENESS_CON } }
-/* see SetThreadDpiAwarenessContext */ -DPI_AWARENESS_CONTEXT set_thread_dpi_awareness_context( DPI_AWARENESS_CONTEXT context ) +/********************************************************************** + * SetThreadDpiAwarenessContext (win32u.so) + */ +DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT context ) { struct user_thread_info *info = get_user_thread_info(); DPI_AWARENESS prev, val = get_awareness_from_dpi_awareness_context( context ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 053fb25fe36..fd6dba82da2 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -427,7 +427,6 @@ extern RECT rect_thread_to_win_dpi( HWND hwnd, RECT rect ) DECLSPEC_HIDDEN; extern HMONITOR monitor_from_point( POINT pt, DWORD flags, UINT dpi ) DECLSPEC_HIDDEN; extern HMONITOR monitor_from_rect( const RECT *rect, DWORD flags, UINT dpi ) DECLSPEC_HIDDEN; extern HMONITOR monitor_from_window( HWND hwnd, DWORD flags, UINT dpi ) DECLSPEC_HIDDEN; -extern DPI_AWARENESS_CONTEXT set_thread_dpi_awareness_context( DPI_AWARENESS_CONTEXT context ) DECLSPEC_HIDDEN; extern void user_lock(void) DECLSPEC_HIDDEN; extern void user_unlock(void) DECLSPEC_HIDDEN; extern void user_check_not_lock(void) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 338063f5fb5..319f47712e6 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -461,7 +461,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) if (!ret) return 0;
get_window_rects( hwnd, COORDS_SCREEN, &new_screen_rect, NULL, 0 ); - context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd ));
user_driver->pSetParent( full_handle, parent, old_parent );
@@ -478,7 +478,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent )
if (was_visible) NtUserShowWindow( hwnd, SW_SHOW );
- set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return old_parent; }
@@ -3405,7 +3405,7 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) else if (winpos->cy > 32767) winpos->cy = 32767; }
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( winpos->hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( winpos->hwnd ));
if (!calc_winpos( winpos, &old_window_rect, &old_client_rect, &new_window_rect, &new_client_rect )) goto done; @@ -3480,7 +3480,7 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) } ret = TRUE; done: - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return ret; }
@@ -3816,7 +3816,7 @@ MINMAXINFO get_min_max_info( HWND hwnd ) RECT rc; WND *win;
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd ));
/* Compute default values */
@@ -3887,7 +3887,7 @@ MINMAXINFO get_min_max_info( HWND hwnd ) minmax.ptMaxTrackSize.x = max( minmax.ptMaxTrackSize.x, minmax.ptMinTrackSize.x ); minmax.ptMaxTrackSize.y = max( minmax.ptMaxTrackSize.y, minmax.ptMinTrackSize.y );
- set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return minmax; }
@@ -4198,13 +4198,13 @@ void update_window_state( HWND hwnd ) return; }
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd )); get_window_rects( hwnd, COORDS_PARENT, &window_rect, &client_rect, get_thread_dpi() ); valid_rects[0] = valid_rects[1] = client_rect; apply_window_pos( hwnd, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW, &window_rect, &client_rect, valid_rects ); - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); }
/*********************************************************************** @@ -4225,7 +4225,7 @@ static BOOL show_window( HWND hwnd, INT cmd )
TRACE( "hwnd=%p, cmd=%d, was_visible %d\n", hwnd, cmd, was_visible );
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd ));
switch(cmd) { @@ -4377,7 +4377,7 @@ static BOOL show_window( HWND hwnd, INT cmd ) }
done: - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return was_visible; }
@@ -5163,7 +5163,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
if (parent) map_dpi_create_struct( &cs, thread_dpi, win_dpi );
- context = set_thread_dpi_awareness_context( get_window_dpi_awareness_context( hwnd )); + context = SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( hwnd ));
/* send the WM_GETMINMAXINFO message and fix the size if needed */
@@ -5261,7 +5261,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, send_parent_notify( hwnd, WM_CREATE ); if (!is_window( hwnd )) { - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return 0; }
@@ -5290,12 +5290,12 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, call_hooks( WH_SHELL, HSHELL_WINDOWCREATED, (WPARAM)hwnd, 0, TRUE );
TRACE( "created window %p\n", hwnd ); - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return hwnd;
failed: destroy_window( hwnd ); - set_thread_dpi_awareness_context( context ); + SetThreadDpiAwarenessContext( context ); return 0; }