Module: wine Branch: master Commit: 1af4919a3f161c66c16feb6ab1ebeda9dfb7f287 URL: https://source.winehq.org/git/wine.git/?a=commit;h=1af4919a3f161c66c16feb6ab...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Feb 14 14:07:34 2022 +0100
win32u: Move GetClipCursor implementation from user32.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/cursoricon.c | 27 +-------------------------- dlls/win32u/cursoricon.c | 28 ++++++++++++++++++++++++++++ dlls/win32u/sysparams.c | 2 ++ dlls/win32u/win32u_private.h | 4 ++++ include/ntuser.h | 1 + 5 files changed, 36 insertions(+), 26 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 32c04852bf9..59c50ae53d8 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -1947,32 +1947,7 @@ HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cu */ BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect ) { - DPI_AWARENESS_CONTEXT context; - UINT dpi; - BOOL ret; - - if (!rect) return FALSE; - - SERVER_START_REQ( set_cursor ) - { - req->flags = 0; - if ((ret = !wine_server_call( req ))) - { - rect->left = reply->new_clip.left; - rect->top = reply->new_clip.top; - rect->right = reply->new_clip.right; - rect->bottom = reply->new_clip.bottom; - } - } - SERVER_END_REQ; - - if (ret && (dpi = get_thread_dpi())) - { - context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); - *rect = map_dpi_rect( *rect, get_monitor_dpi( MonitorFromRect( rect, MONITOR_DEFAULTTOPRIMARY )), dpi ); - SetThreadDpiAwarenessContext( context ); - } - return ret; + return NtUserCallOneParam( (UINT_PTR)rect, NtUserGetClipCursor ); }
diff --git a/dlls/win32u/cursoricon.c b/dlls/win32u/cursoricon.c index 7b23dfb7d0b..cafea198809 100644 --- a/dlls/win32u/cursoricon.c +++ b/dlls/win32u/cursoricon.c @@ -127,3 +127,31 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect ) if (ret) user_driver->pClipCursor( &new_rect ); return ret; } + +BOOL get_clip_cursor( RECT *rect ) +{ + UINT dpi; + BOOL ret; + + if (!rect) return FALSE; + + SERVER_START_REQ( set_cursor ) + { + req->flags = 0; + if ((ret = !wine_server_call( req ))) + { + rect->left = reply->new_clip.left; + rect->top = reply->new_clip.top; + rect->right = reply->new_clip.right; + rect->bottom = reply->new_clip.bottom; + } + } + SERVER_END_REQ; + + if (ret && (dpi = get_thread_dpi())) + { + HMONITOR monitor = monitor_from_rect( rect, MONITOR_DEFAULTTOPRIMARY, 0 ); + *rect = map_dpi_rect( *rect, get_monitor_dpi( monitor ), dpi ); + } + return ret; +} diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index d57203e330c..f409921785f 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4462,6 +4462,8 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) { switch(code) { + case NtUserGetClipCursor: + return get_clip_cursor( (RECT *)arg ); case NtUserGetSysColor: return get_sys_color( arg ); case NtUserRealizePalette: diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index ee26d4af52a..6594d7b10b7 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -241,6 +241,10 @@ struct unix_funcs struct window_surface *surface ); };
+/* cursoricon.c */ +extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN; + +/* sysparams.c */ extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN; extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN; extern UINT get_system_dpi(void) DECLSPEC_HIDDEN; diff --git a/include/ntuser.h b/include/ntuser.h index b2aa11f90fd..11bc0bbcb44 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -52,6 +52,7 @@ struct enum_display_monitor_params /* NtUserCallOneParam codes, not compatible with Windows */ enum { + NtUserGetClipCursor, NtUserGetSysColor, NtUserGetSysColorBrush, NtUserGetSysColorPen,