winemac: Implement GetCursorPos().

This commit is contained in:
Ken Thomases 2013-02-24 22:53:29 -06:00 committed by Alexandre Julliard
parent b79d955342
commit 38f7a4d518
4 changed files with 38 additions and 0 deletions

View file

@ -815,3 +815,20 @@ void macdrv_set_cursor(CFStringRef name, CFArrayRef frames)
}
}
}
/***********************************************************************
* macdrv_get_cursor_position
*
* Obtains the current cursor position. Returns zero on failure,
* non-zero on success.
*/
int macdrv_get_cursor_position(CGPoint *pos)
{
OnMainThread(^{
NSPoint location = [NSEvent mouseLocation];
location = [NSApp flippedMouseLocation:location];
*pos = NSPointToCGPoint(location);
});
return TRUE;
}

View file

@ -120,6 +120,7 @@
/* cursor */
extern void macdrv_set_cursor(CFStringRef name, CFArrayRef frames) DECLSPEC_HIDDEN;
extern int macdrv_get_cursor_position(CGPoint *pos) DECLSPEC_HIDDEN;
/* display */

View file

@ -735,6 +735,25 @@ void CDECL macdrv_DestroyCursorIcon(HCURSOR cursor)
}
/***********************************************************************
* GetCursorPos (MACDRV.@)
*/
BOOL CDECL macdrv_GetCursorPos(LPPOINT pos)
{
CGPoint pt;
BOOL ret;
ret = macdrv_get_cursor_position(&pt);
if (ret)
{
TRACE("pointer at (%g,%g) server pos %d,%d\n", pt.x, pt.y, pos->x, pos->y);
pos->x = pt.x;
pos->y = pt.y;
}
return ret;
}
/***********************************************************************
* SetCursor (MACDRV.@)
*/

View file

@ -13,6 +13,7 @@
@ cdecl DestroyWindow(long) macdrv_DestroyWindow
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) macdrv_EnumDisplaySettingsEx
@ cdecl GetCursorPos(ptr) macdrv_GetCursorPos
@ cdecl GetKeyboardLayout(long) macdrv_GetKeyboardLayout
@ cdecl GetKeyboardLayoutName(ptr) macdrv_GetKeyboardLayoutName
@ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText