winemac: Use floor() rather than truncation when converting Cocoa event positions to integers.

This is so negative coordinates are adjusted in the same direction as
positive ones (left and up).

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2016-05-04 10:11:04 -05:00 committed by Alexandre Julliard
parent 6dd6c76299
commit 3d73f62f01
3 changed files with 12 additions and 12 deletions

View File

@ -1592,8 +1592,8 @@ - (void) handleMouseMove:(NSEvent*)anEvent
[self clipCursorLocation:&point];
event = macdrv_create_event(MOUSE_MOVED_ABSOLUTE, targetWindow);
event->mouse_moved.x = point.x;
event->mouse_moved.y = point.y;
event->mouse_moved.x = floor(point.x);
event->mouse_moved.y = floor(point.y);
mouseMoveDeltaX = 0;
mouseMoveDeltaY = 0;
@ -1733,8 +1733,8 @@ - (void) handleMouseButton:(NSEvent*)theEvent
event = macdrv_create_event(MOUSE_BUTTON, window);
event->mouse_button.button = [theEvent buttonNumber];
event->mouse_button.pressed = pressed;
event->mouse_button.x = pt.x;
event->mouse_button.y = pt.y;
event->mouse_button.x = floor(pt.x);
event->mouse_button.y = floor(pt.y);
event->mouse_button.time_ms = [self ticksForEventTime:[theEvent timestamp]];
[window.queue postEvent:event];
@ -1812,8 +1812,8 @@ - (void) handleScrollWheel:(NSEvent*)theEvent
BOOL continuous = FALSE;
event = macdrv_create_event(MOUSE_SCROLL, window);
event->mouse_scroll.x = pt.x;
event->mouse_scroll.y = pt.y;
event->mouse_scroll.x = floor(pt.x);
event->mouse_scroll.y = floor(pt.y);
event->mouse_scroll.time_ms = [self ticksForEventTime:[theEvent timestamp]];
if (CGEventGetIntegerValueField(cgevent, kCGScrollWheelEventIsContinuous))

View File

@ -2630,8 +2630,8 @@ - (NSDragOperation) draggingUpdated:(id <NSDraggingInfo>)sender
macdrv_query* query = macdrv_create_query();
query->type = QUERY_DRAG_OPERATION;
query->window = (macdrv_window)[self retain];
query->drag_operation.x = pt.x;
query->drag_operation.y = pt.y;
query->drag_operation.x = floor(pt.x);
query->drag_operation.y = floor(pt.y);
query->drag_operation.offered_ops = [sender draggingSourceOperationMask];
query->drag_operation.accepted_op = NSDragOperationNone;
query->drag_operation.pasteboard = (CFTypeRef)[pb retain];
@ -2652,8 +2652,8 @@ - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender
macdrv_query* query = macdrv_create_query();
query->type = QUERY_DRAG_DROP;
query->window = (macdrv_window)[self retain];
query->drag_drop.x = pt.x;
query->drag_drop.y = pt.y;
query->drag_drop.x = floor(pt.x);
query->drag_drop.y = floor(pt.y);
query->drag_drop.op = [sender draggingSourceOperationMask];
query->drag_drop.pasteboard = (CFTypeRef)[pb retain];

View File

@ -697,8 +697,8 @@ BOOL CDECL macdrv_GetCursorPos(LPPOINT pos)
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;
pos->x = floor(pt.x);
pos->y = floor(pt.y);
}
return ret;
}