Ken Thomases : winemac: Implement GetCursorPos().
Alexandre Julliard
julliard at winehq.org
Mon Feb 25 14:33:46 CST 2013
Module: wine
Branch: master
Commit: 38f7a4d518c66537d0919ac07904332cb8f4e208
URL: http://source.winehq.org/git/wine.git/?a=commit;h=38f7a4d518c66537d0919ac07904332cb8f4e208
Author: Ken Thomases <ken at codeweavers.com>
Date: Sun Feb 24 22:53:29 2013 -0600
winemac: Implement GetCursorPos().
---
dlls/winemac.drv/cocoa_app.m | 17 +++++++++++++++++
dlls/winemac.drv/macdrv_cocoa.h | 1 +
dlls/winemac.drv/mouse.c | 19 +++++++++++++++++++
dlls/winemac.drv/winemac.drv.spec | 1 +
4 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 44fa282..d22596e 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 269dbea..c3ad6ba 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -120,6 +120,7 @@ extern void macdrv_beep(void) DECLSPEC_HIDDEN;
/* 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 8e16388..b0288f6 100644
--- a/dlls/winemac.drv/mouse.c
+++ b/dlls/winemac.drv/mouse.c
@@ -736,6 +736,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.@)
*/
void CDECL macdrv_SetCursor(HCURSOR cursor)
diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec
index 6fd4bef..99746b4 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
More information about the wine-cvs
mailing list