Commit 72e89323 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Consolidate mouse move handling into -[WineApplicationController handleMouseMove:].

parent 76691853
...@@ -60,6 +60,7 @@ enum { ...@@ -60,6 +60,7 @@ enum {
WineWindow* lastTargetWindow; WineWindow* lastTargetWindow;
BOOL forceNextMouseMoveAbsolute; BOOL forceNextMouseMoveAbsolute;
double mouseMoveDeltaX, mouseMoveDeltaY;
NSMutableArray* orderedWineWindows; NSMutableArray* orderedWineWindows;
......
...@@ -1157,6 +1157,7 @@ int macdrv_err_on; ...@@ -1157,6 +1157,7 @@ int macdrv_err_on;
if ([targetWindow isKindOfClass:[WineWindow class]]) if ([targetWindow isKindOfClass:[WineWindow class]])
{ {
macdrv_event* event;
BOOL absolute = forceNextMouseMoveAbsolute || (targetWindow != lastTargetWindow); BOOL absolute = forceNextMouseMoveAbsolute || (targetWindow != lastTargetWindow);
forceNextMouseMoveAbsolute = FALSE; forceNextMouseMoveAbsolute = FALSE;
...@@ -1172,7 +1173,42 @@ int macdrv_err_on; ...@@ -1172,7 +1173,42 @@ int macdrv_err_on;
absolute = TRUE; absolute = TRUE;
} }
[targetWindow postMouseMovedEvent:anEvent absolute:absolute]; if (absolute)
{
CGPoint point = CGEventGetLocation([anEvent CGEvent]);
event = macdrv_create_event(MOUSE_MOVED_ABSOLUTE, targetWindow);
event->mouse_moved.x = point.x;
event->mouse_moved.y = point.y;
mouseMoveDeltaX = 0;
mouseMoveDeltaY = 0;
}
else
{
/* Add event delta to accumulated delta error */
/* deltaY is already flipped */
mouseMoveDeltaX += [anEvent deltaX];
mouseMoveDeltaY += [anEvent deltaY];
event = macdrv_create_event(MOUSE_MOVED, targetWindow);
event->mouse_moved.x = mouseMoveDeltaX;
event->mouse_moved.y = mouseMoveDeltaY;
/* Keep the remainder after integer truncation. */
mouseMoveDeltaX -= event->mouse_moved.x;
mouseMoveDeltaY -= event->mouse_moved.y;
}
if (event->type == MOUSE_MOVED_ABSOLUTE || event->mouse_moved.x || event->mouse_moved.y)
{
event->mouse_moved.time_ms = [self ticksForEventTime:[anEvent timestamp]];
[targetWindow.queue postEvent:event];
}
macdrv_release_event(event);
lastTargetWindow = targetWindow; lastTargetWindow = targetWindow;
} }
else if (lastTargetWindow) else if (lastTargetWindow)
......
...@@ -48,8 +48,6 @@ ...@@ -48,8 +48,6 @@
NSUInteger lastModifierFlags; NSUInteger lastModifierFlags;
double mouseMoveDeltaX, mouseMoveDeltaY;
NSInteger levelWhenActive; NSInteger levelWhenActive;
NSTimer* liveResizeDisplayTimer; NSTimer* liveResizeDisplayTimer;
...@@ -68,6 +66,4 @@ ...@@ -68,6 +66,4 @@
- (void) adjustWindowLevel; - (void) adjustWindowLevel;
- (void) postMouseMovedEvent:(NSEvent *)theEvent absolute:(BOOL)absolute;
@end @end
...@@ -952,47 +952,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) ...@@ -952,47 +952,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
event:theEvent]; event:theEvent];
} }
- (void) postMouseMovedEvent:(NSEvent *)theEvent absolute:(BOOL)absolute
{
macdrv_event* event;
if (absolute)
{
CGPoint point = CGEventGetLocation([theEvent CGEvent]);
event = macdrv_create_event(MOUSE_MOVED_ABSOLUTE, self);
event->mouse_moved.x = point.x;
event->mouse_moved.y = point.y;
mouseMoveDeltaX = 0;
mouseMoveDeltaY = 0;
}
else
{
/* Add event delta to accumulated delta error */
/* deltaY is already flipped */
mouseMoveDeltaX += [theEvent deltaX];
mouseMoveDeltaY += [theEvent deltaY];
event = macdrv_create_event(MOUSE_MOVED, self);
event->mouse_moved.x = mouseMoveDeltaX;
event->mouse_moved.y = mouseMoveDeltaY;
/* Keep the remainder after integer truncation. */
mouseMoveDeltaX -= event->mouse_moved.x;
mouseMoveDeltaY -= event->mouse_moved.y;
}
if (event->type == MOUSE_MOVED_ABSOLUTE || event->mouse_moved.x || event->mouse_moved.y)
{
event->mouse_moved.time_ms = [[WineApplicationController sharedController] ticksForEventTime:[theEvent timestamp]];
[queue postEvent:event];
}
macdrv_release_event(event);
}
- (void) setLevelWhenActive:(NSInteger)level - (void) setLevelWhenActive:(NSInteger)level
{ {
levelWhenActive = level; levelWhenActive = level;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment