Commit 018d629b authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Use NSMouseInRect() instead of NSPointInRect() to compensate for…

winemac: Use NSMouseInRect() instead of NSPointInRect() to compensate for Cocoa's off-by-one coordinate system. This matches what Cocoa does when determining how to handle an event so that, for example, our test if a click is in the window grow box corresponds to whether Cocoa will run an internal mouse-tracking loop to resize the window when we pass it the event. This fixes a problem where both Cocoa and user32 would try to run a resize loop and the cursor would get "stuck" resizing the window after the button was released.
parent e5f61e6e
...@@ -1550,7 +1550,7 @@ int macdrv_err_on; ...@@ -1550,7 +1550,7 @@ int macdrv_err_on;
// Test if the click was in the window's content area. // Test if the click was in the window's content area.
NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)]; NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)];
NSRect contentRect = [window contentRectForFrameRect:[window frame]]; NSRect contentRect = [window contentRectForFrameRect:[window frame]];
process = NSPointInRect(nspoint, contentRect); process = NSMouseInRect(nspoint, contentRect, NO);
if (process && [window styleMask] & NSResizableWindowMask) if (process && [window styleMask] & NSResizableWindowMask)
{ {
// Ignore clicks in the grow box (resize widget). // Ignore clicks in the grow box (resize widget).
...@@ -1573,7 +1573,7 @@ int macdrv_err_on; ...@@ -1573,7 +1573,7 @@ int macdrv_err_on;
NSMinY(contentRect), NSMinY(contentRect),
bounds.size.width, bounds.size.width,
bounds.size.height); bounds.size.height);
process = !NSPointInRect(nspoint, growBox); process = !NSMouseInRect(nspoint, growBox, NO);
} }
} }
} }
...@@ -1643,7 +1643,7 @@ int macdrv_err_on; ...@@ -1643,7 +1643,7 @@ int macdrv_err_on;
// Only process the event if it was in the window's content area. // Only process the event if it was in the window's content area.
NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)]; NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)];
NSRect contentRect = [window contentRectForFrameRect:[window frame]]; NSRect contentRect = [window contentRectForFrameRect:[window frame]];
process = NSPointInRect(nspoint, contentRect); process = NSMouseInRect(nspoint, contentRect, NO);
} }
if (process) if (process)
......
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