win32u: Move GetCursorPos implementation from user.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8c5befe49b
commit
b5b9126c73
|
@ -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 )
|
static BOOL CDECL nulldrv_SetCursorPos( INT x, INT y )
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -298,11 +293,6 @@ static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
|
||||||
load_driver()->pSetCursor( 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 )
|
static BOOL CDECL loaderdrv_SetCursorPos( INT x, INT y )
|
||||||
{
|
{
|
||||||
return load_driver()->pSetCursorPos( x, y );
|
return load_driver()->pSetCursorPos( x, y );
|
||||||
|
@ -371,7 +361,7 @@ static struct user_driver_funcs lazy_load_driver =
|
||||||
/* cursor/icon functions */
|
/* cursor/icon functions */
|
||||||
nulldrv_DestroyCursorIcon,
|
nulldrv_DestroyCursorIcon,
|
||||||
loaderdrv_SetCursor,
|
loaderdrv_SetCursor,
|
||||||
loaderdrv_GetCursorPos,
|
NULL,
|
||||||
loaderdrv_SetCursorPos,
|
loaderdrv_SetCursorPos,
|
||||||
loaderdrv_ClipCursor,
|
loaderdrv_ClipCursor,
|
||||||
/* clipboard functions */
|
/* 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(UnregisterHotKey);
|
||||||
SET_USER_FUNC(DestroyCursorIcon);
|
SET_USER_FUNC(DestroyCursorIcon);
|
||||||
SET_USER_FUNC(SetCursor);
|
SET_USER_FUNC(SetCursor);
|
||||||
SET_USER_FUNC(GetCursorPos);
|
|
||||||
SET_USER_FUNC(SetCursorPos);
|
SET_USER_FUNC(SetCursorPos);
|
||||||
SET_USER_FUNC(ClipCursor);
|
SET_USER_FUNC(ClipCursor);
|
||||||
SET_USER_FUNC(UpdateClipboard);
|
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 WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
|
||||||
{
|
{
|
||||||
BOOL ret;
|
return NtUserCallOneParam( (UINT_PTR)pt, NtUserGetCursorPos );
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1010,6 +1010,11 @@ static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
|
||||||
load_driver()->pSetCursor( 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 )
|
static BOOL CDECL loaderdrv_SetCursorPos( INT x, INT y )
|
||||||
{
|
{
|
||||||
return load_driver()->pSetCursorPos( x, y );
|
return load_driver()->pSetCursorPos( x, y );
|
||||||
|
@ -1049,6 +1054,7 @@ static const struct user_driver_funcs lazy_load_driver =
|
||||||
.pVkKeyScanEx = loaderdrv_VkKeyScanEx,
|
.pVkKeyScanEx = loaderdrv_VkKeyScanEx,
|
||||||
/* cursor/icon functions */
|
/* cursor/icon functions */
|
||||||
.pSetCursor = loaderdrv_SetCursor,
|
.pSetCursor = loaderdrv_SetCursor,
|
||||||
|
.pGetCursorPos = loaderdrv_GetCursorPos,
|
||||||
.pSetCursorPos = loaderdrv_SetCursorPos,
|
.pSetCursorPos = loaderdrv_SetCursorPos,
|
||||||
.pClipCursor = loaderdrv_ClipCursor,
|
.pClipCursor = loaderdrv_ClipCursor,
|
||||||
/* clipboard functions */
|
/* clipboard functions */
|
||||||
|
|
|
@ -96,6 +96,38 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* 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
|
* get_locale_kbd_layout
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4492,6 +4492,8 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
|
||||||
{
|
{
|
||||||
case NtUserGetClipCursor:
|
case NtUserGetClipCursor:
|
||||||
return get_clip_cursor( (RECT *)arg );
|
return get_clip_cursor( (RECT *)arg );
|
||||||
|
case NtUserGetCursorPos:
|
||||||
|
return get_cursor_pos( (POINT *)arg );
|
||||||
case NtUserGetSysColor:
|
case NtUserGetSysColor:
|
||||||
return get_sys_color( arg );
|
return get_sys_color( arg );
|
||||||
case NtUserRealizePalette:
|
case NtUserRealizePalette:
|
||||||
|
|
|
@ -245,6 +245,9 @@ struct unix_funcs
|
||||||
/* cursoricon.c */
|
/* cursoricon.c */
|
||||||
extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN;
|
extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
/* input.c */
|
||||||
|
extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* sysparams.c */
|
/* sysparams.c */
|
||||||
extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
|
extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
|
||||||
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
|
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct enum_display_monitor_params
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
NtUserGetClipCursor,
|
NtUserGetClipCursor,
|
||||||
|
NtUserGetCursorPos,
|
||||||
NtUserGetSysColor,
|
NtUserGetSysColor,
|
||||||
NtUserGetSysColorBrush,
|
NtUserGetSysColorBrush,
|
||||||
NtUserGetSysColorPen,
|
NtUserGetSysColorPen,
|
||||||
|
|
Loading…
Reference in New Issue