winemac: For SetCursorPos(), reset positions of pending mouse button and scroll events.
They are effectively deemed to have happened after the SetCursorPos().
This commit is contained in:
parent
a6722029e5
commit
51129752bc
|
@ -1032,8 +1032,8 @@ - (BOOL) setCursorPosition:(CGPoint)pos
|
|||
{
|
||||
[self clipCursorLocation:&pos];
|
||||
|
||||
ret = [self warpCursorTo:&pos from:NULL];
|
||||
synthesizedLocation = pos;
|
||||
ret = [self warpCursorTo:&synthesizedLocation from:NULL];
|
||||
if (ret)
|
||||
{
|
||||
// We want to discard mouse-move events that have already been
|
||||
|
@ -1076,6 +1076,7 @@ - (BOOL) setCursorPosition:(CGPoint)pos
|
|||
[queue discardEventsMatchingMask:event_mask_for_type(MOUSE_MOVED) |
|
||||
event_mask_for_type(MOUSE_MOVED_ABSOLUTE)
|
||||
forWindow:nil];
|
||||
[queue resetMouseEventPositions:pos];
|
||||
}
|
||||
[eventQueuesLock unlock];
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ - (void) discardEventsMatchingMask:(macdrv_event_mask)mask forWindow:(NSWindow*)
|
|||
- (BOOL) query:(macdrv_query*)query timeout:(NSTimeInterval)timeout processEvents:(BOOL)processEvents;
|
||||
- (BOOL) query:(macdrv_query*)query timeout:(NSTimeInterval)timeout;
|
||||
|
||||
- (void) resetMouseEventPositions:(CGPoint)pos;
|
||||
|
||||
@end
|
||||
|
||||
void OnMainThread(dispatch_block_t block);
|
||||
|
|
|
@ -280,6 +280,29 @@ - (BOOL) query:(macdrv_query*)query timeout:(NSTimeInterval)timeout
|
|||
return [self query:query timeout:timeout processEvents:FALSE];
|
||||
}
|
||||
|
||||
- (void) resetMouseEventPositions:(CGPoint)pos
|
||||
{
|
||||
MacDrvEvent* event;
|
||||
|
||||
[eventsLock lock];
|
||||
|
||||
for (event in events)
|
||||
{
|
||||
if (event->event->type == MOUSE_BUTTON)
|
||||
{
|
||||
event->event->mouse_button.x = pos.x;
|
||||
event->event->mouse_button.y = pos.y;
|
||||
}
|
||||
else if (event->event->type == MOUSE_SCROLL)
|
||||
{
|
||||
event->event->mouse_scroll.x = pos.x;
|
||||
event->event->mouse_scroll.y = pos.y;
|
||||
}
|
||||
}
|
||||
|
||||
[eventsLock unlock];
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* OnMainThread
|
||||
|
|
Loading…
Reference in New Issue