winemac: Implement SetCursorPos().
This commit is contained in:
parent
de079223bf
commit
5c933c89ad
@ -58,6 +58,8 @@
|
|||||||
int cursorFrame;
|
int cursorFrame;
|
||||||
NSTimer* cursorTimer;
|
NSTimer* cursorTimer;
|
||||||
BOOL cursorHidden;
|
BOOL cursorHidden;
|
||||||
|
|
||||||
|
NSTimeInterval lastSetCursorPositionTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
|
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
|
||||||
|
@ -548,6 +548,31 @@ int macdrv_err_on;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) setCursorPosition:(CGPoint)pos
|
||||||
|
{
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
ret = (CGWarpMouseCursorPosition(pos) == kCGErrorSuccess);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
WineEventQueue* queue;
|
||||||
|
|
||||||
|
lastSetCursorPositionTime = [[NSProcessInfo processInfo] systemUptime];
|
||||||
|
|
||||||
|
// Discard all pending mouse move events.
|
||||||
|
[eventQueuesLock lock];
|
||||||
|
for (queue in eventQueues)
|
||||||
|
{
|
||||||
|
[queue discardEventsMatchingMask:event_mask_for_type(MOUSE_MOVED) |
|
||||||
|
event_mask_for_type(MOUSE_MOVED_ABSOLUTE)
|
||||||
|
forWindow:nil];
|
||||||
|
}
|
||||||
|
[eventQueuesLock unlock];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------- NSApplication method overrides ----------
|
* ---------- NSApplication method overrides ----------
|
||||||
@ -587,6 +612,17 @@ int macdrv_err_on;
|
|||||||
BOOL absolute = forceNextMouseMoveAbsolute || (targetWindow != lastTargetWindow);
|
BOOL absolute = forceNextMouseMoveAbsolute || (targetWindow != lastTargetWindow);
|
||||||
forceNextMouseMoveAbsolute = FALSE;
|
forceNextMouseMoveAbsolute = FALSE;
|
||||||
|
|
||||||
|
// If we recently warped the cursor, discard mouse move events until
|
||||||
|
// we see an event which is later than that time.
|
||||||
|
if (lastSetCursorPositionTime)
|
||||||
|
{
|
||||||
|
if ([anEvent timestamp] <= lastSetCursorPositionTime)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastSetCursorPositionTime = 0;
|
||||||
|
absolute = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
[targetWindow postMouseMovedEvent:anEvent absolute:absolute];
|
[targetWindow postMouseMovedEvent:anEvent absolute:absolute];
|
||||||
lastTargetWindow = targetWindow;
|
lastTargetWindow = targetWindow;
|
||||||
}
|
}
|
||||||
@ -893,3 +929,20 @@ int macdrv_get_cursor_position(CGPoint *pos)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* macdrv_set_cursor_position
|
||||||
|
*
|
||||||
|
* Sets the cursor position without generating events. Returns zero on
|
||||||
|
* failure, non-zero on success.
|
||||||
|
*/
|
||||||
|
int macdrv_set_cursor_position(CGPoint pos)
|
||||||
|
{
|
||||||
|
__block int ret;
|
||||||
|
|
||||||
|
OnMainThread(^{
|
||||||
|
ret = [NSApp setCursorPosition:pos];
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -121,6 +121,7 @@ extern void macdrv_beep(void) DECLSPEC_HIDDEN;
|
|||||||
/* cursor */
|
/* cursor */
|
||||||
extern void macdrv_set_cursor(CFStringRef name, CFArrayRef frames) DECLSPEC_HIDDEN;
|
extern void macdrv_set_cursor(CFStringRef name, CFArrayRef frames) DECLSPEC_HIDDEN;
|
||||||
extern int macdrv_get_cursor_position(CGPoint *pos) DECLSPEC_HIDDEN;
|
extern int macdrv_get_cursor_position(CGPoint *pos) DECLSPEC_HIDDEN;
|
||||||
|
extern int macdrv_set_cursor_position(CGPoint pos) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
|
||||||
/* display */
|
/* display */
|
||||||
|
@ -847,6 +847,20 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetCursorPos (MACDRV.@)
|
||||||
|
*/
|
||||||
|
BOOL CDECL macdrv_SetCursorPos(INT x, INT y)
|
||||||
|
{
|
||||||
|
BOOL ret = macdrv_set_cursor_position(CGPointMake(x, y));
|
||||||
|
if (ret)
|
||||||
|
TRACE("warped to %d,%d\n", x, y);
|
||||||
|
else
|
||||||
|
ERR("failed to warp to %d,%d\n", x, y);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* macdrv_mouse_button
|
* macdrv_mouse_button
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
|
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
|
||||||
@ cdecl ScrollDC(long long long ptr ptr long ptr) macdrv_ScrollDC
|
@ cdecl ScrollDC(long long long ptr ptr long ptr) macdrv_ScrollDC
|
||||||
@ cdecl SetCursor(long) macdrv_SetCursor
|
@ cdecl SetCursor(long) macdrv_SetCursor
|
||||||
|
@ cdecl SetCursorPos(long long) macdrv_SetCursorPos
|
||||||
@ cdecl SetFocus(long) macdrv_SetFocus
|
@ cdecl SetFocus(long) macdrv_SetFocus
|
||||||
@ cdecl SetLayeredWindowAttributes(long long long long) macdrv_SetLayeredWindowAttributes
|
@ cdecl SetLayeredWindowAttributes(long long long long) macdrv_SetLayeredWindowAttributes
|
||||||
@ cdecl SetParent(long long long) macdrv_SetParent
|
@ cdecl SetParent(long long long) macdrv_SetParent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user