Commit b5b9126c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move GetCursorPos implementation from user.

parent 8c5befe4
......@@ -136,11 +136,6 @@ static void CDECL nulldrv_SetCursor( HCURSOR cursor )
{
}
static BOOL CDECL nulldrv_GetCursorPos( LPPOINT pt )
{
return TRUE;
}
static BOOL CDECL nulldrv_SetCursorPos( INT x, INT y )
{
return TRUE;
......@@ -298,11 +293,6 @@ static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
load_driver()->pSetCursor( cursor );
}
static BOOL CDECL loaderdrv_GetCursorPos( LPPOINT pt )
{
return load_driver()->pGetCursorPos( pt );
}
static BOOL CDECL loaderdrv_SetCursorPos( INT x, INT y )
{
return load_driver()->pSetCursorPos( x, y );
......@@ -371,7 +361,7 @@ static struct user_driver_funcs lazy_load_driver =
/* cursor/icon functions */
nulldrv_DestroyCursorIcon,
loaderdrv_SetCursor,
loaderdrv_GetCursorPos,
NULL,
loaderdrv_SetCursorPos,
loaderdrv_ClipCursor,
/* clipboard functions */
......@@ -431,7 +421,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
SET_USER_FUNC(UnregisterHotKey);
SET_USER_FUNC(DestroyCursorIcon);
SET_USER_FUNC(SetCursor);
SET_USER_FUNC(GetCursorPos);
SET_USER_FUNC(SetCursorPos);
SET_USER_FUNC(ClipCursor);
SET_USER_FUNC(UpdateClipboard);
......
......@@ -305,33 +305,7 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
{
BOOL ret;
DWORD last_change;
UINT dpi;
if (!pt) return FALSE;
SERVER_START_REQ( set_cursor )
{
if ((ret = !wine_server_call( req )))
{
pt->x = reply->new_x;
pt->y = reply->new_y;
last_change = reply->last_change;
}
}
SERVER_END_REQ;
/* query new position from graphics driver if we haven't updated recently */
if (ret && GetTickCount() - last_change > 100) ret = USER_Driver->pGetCursorPos( pt );
if (ret && (dpi = get_thread_dpi()))
{
DPI_AWARENESS_CONTEXT context;
context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
*pt = map_dpi_point( *pt, get_monitor_dpi( MonitorFromPoint( *pt, MONITOR_DEFAULTTOPRIMARY )), dpi );
SetThreadDpiAwarenessContext( context );
}
return ret;
return NtUserCallOneParam( (UINT_PTR)pt, NtUserGetCursorPos );
}
......
......@@ -1010,6 +1010,11 @@ static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
load_driver()->pSetCursor( cursor );
}
static BOOL CDECL loaderdrv_GetCursorPos( POINT *pt )
{
return load_driver()->pGetCursorPos( pt );
}
static BOOL CDECL loaderdrv_SetCursorPos( INT x, INT y )
{
return load_driver()->pSetCursorPos( x, y );
......@@ -1049,6 +1054,7 @@ static const struct user_driver_funcs lazy_load_driver =
.pVkKeyScanEx = loaderdrv_VkKeyScanEx,
/* cursor/icon functions */
.pSetCursor = loaderdrv_SetCursor,
.pGetCursorPos = loaderdrv_GetCursorPos,
.pSetCursorPos = loaderdrv_SetCursorPos,
.pClipCursor = loaderdrv_ClipCursor,
/* clipboard functions */
......
......@@ -97,6 +97,38 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y )
}
/***********************************************************************
* get_cursor_pos
*/
BOOL get_cursor_pos( POINT *pt )
{
BOOL ret;
DWORD last_change;
UINT dpi;
if (!pt) return FALSE;
SERVER_START_REQ( set_cursor )
{
if ((ret = !wine_server_call( req )))
{
pt->x = reply->new_x;
pt->y = reply->new_y;
last_change = reply->last_change;
}
}
SERVER_END_REQ;
/* query new position from graphics driver if we haven't updated recently */
if (ret && NtGetTickCount() - last_change > 100) ret = user_driver->pGetCursorPos( pt );
if (ret && (dpi = get_thread_dpi()))
{
HMONITOR monitor = monitor_from_point( *pt, MONITOR_DEFAULTTOPRIMARY, 0 );
*pt = map_dpi_point( *pt, get_monitor_dpi( monitor ), dpi );
}
return ret;
}
/***********************************************************************
* get_locale_kbd_layout
*/
static HKL get_locale_kbd_layout(void)
......
......@@ -4492,6 +4492,8 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
{
case NtUserGetClipCursor:
return get_clip_cursor( (RECT *)arg );
case NtUserGetCursorPos:
return get_cursor_pos( (POINT *)arg );
case NtUserGetSysColor:
return get_sys_color( arg );
case NtUserRealizePalette:
......
......@@ -245,6 +245,9 @@ struct unix_funcs
/* cursoricon.c */
extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN;
/* input.c */
extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN;
/* sysparams.c */
extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
......
......@@ -53,6 +53,7 @@ struct enum_display_monitor_params
enum
{
NtUserGetClipCursor,
NtUserGetCursorPos,
NtUserGetSysColor,
NtUserGetSysColorBrush,
NtUserGetSysColorPen,
......
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