diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 44fa2821569..d22596e1cde 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -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; +} diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 269dbea30aa..c3ad6ba7669 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -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 */ diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index 8e16388e3f1..b0288f67ef4 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -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.@) */ diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 6fd4bef8f4f..99746b48cd9 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -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