Ken Thomases : winemac: Use NSMouseInRect() instead of NSPointInRect() to compensate for Cocoa's off-by-one coordinate system.

Alexandre Julliard julliard at winehq.org
Thu Sep 19 17:21:01 CDT 2013


Module: wine
Branch: master
Commit: 018d629b3cc6bf1d8424a73bbb00279223bfb323
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=018d629b3cc6bf1d8424a73bbb00279223bfb323

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Sep 18 13:53:21 2013 -0500

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.

---

 dlls/winemac.drv/cocoa_app.m |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 615a9ab..afe0608 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1550,7 +1550,7 @@ int macdrv_err_on;
                     // Test if the click was in the window's content area.
                     NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)];
                     NSRect contentRect = [window contentRectForFrameRect:[window frame]];
-                    process = NSPointInRect(nspoint, contentRect);
+                    process = NSMouseInRect(nspoint, contentRect, NO);
                     if (process && [window styleMask] & NSResizableWindowMask)
                     {
                         // Ignore clicks in the grow box (resize widget).
@@ -1573,7 +1573,7 @@ int macdrv_err_on;
                                                         NSMinY(contentRect),
                                                         bounds.size.width,
                                                         bounds.size.height);
-                            process = !NSPointInRect(nspoint, growBox);
+                            process = !NSMouseInRect(nspoint, growBox, NO);
                         }
                     }
                 }
@@ -1643,7 +1643,7 @@ int macdrv_err_on;
                 // Only process the event if it was in the window's content area.
                 NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)];
                 NSRect contentRect = [window contentRectForFrameRect:[window frame]];
-                process = NSPointInRect(nspoint, contentRect);
+                process = NSMouseInRect(nspoint, contentRect, NO);
             }
 
             if (process)




More information about the wine-cvs mailing list