Commit 8bca1b29 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Scale coordinates in ClipCursor() based on DPI awareness.

parent 910f3ed4
...@@ -2116,12 +2116,22 @@ HCURSOR WINAPI GetCursor(void) ...@@ -2116,12 +2116,22 @@ HCURSOR WINAPI GetCursor(void)
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH ClipCursor( const RECT *rect ) BOOL WINAPI DECLSPEC_HOTPATCH ClipCursor( const RECT *rect )
{ {
UINT dpi;
BOOL ret; BOOL ret;
RECT new_rect; RECT new_rect;
TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) ); TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) );
if (rect && (rect->left > rect->right || rect->top > rect->bottom)) return FALSE; if (rect)
{
if (rect->left > rect->right || rect->top > rect->bottom) return FALSE;
if ((dpi = get_thread_dpi()))
{
new_rect = map_dpi_rect( *rect, dpi,
get_monitor_dpi( MonitorFromRect( rect, MONITOR_DEFAULTTOPRIMARY )));
rect = &new_rect;
}
}
SERVER_START_REQ( set_cursor ) SERVER_START_REQ( set_cursor )
{ {
...@@ -2155,6 +2165,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH ClipCursor( const RECT *rect ) ...@@ -2155,6 +2165,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH ClipCursor( const RECT *rect )
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect ) BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect )
{ {
DPI_AWARENESS_CONTEXT context;
UINT dpi;
BOOL ret; BOOL ret;
if (!rect) return FALSE; if (!rect) return FALSE;
...@@ -2171,6 +2183,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect ) ...@@ -2171,6 +2183,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect )
} }
} }
SERVER_END_REQ; 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 ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment