Commit 3d73f62f authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6dd6c762
......@@ -1592,8 +1592,8 @@ static NSString* WineLocalizedString(unsigned int stringID)
[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 @@ static NSString* WineLocalizedString(unsigned int stringID)
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 @@ static NSString* WineLocalizedString(unsigned int stringID)
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))
......
......@@ -2630,8 +2630,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
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 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
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];
......
......@@ -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;
}
......
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