changeset 946:c64d3ca566f9

Attempt at inverting the window position and mouse pointer coordinates on Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 30 Apr 2011 21:33:27 +0000
parents 254b50be1bc1
children c9f6ba940453
files mac/dw.m
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Sat Apr 30 19:35:32 2011 +0000
+++ b/mac/dw.m	Sat Apr 30 21:33:27 2011 +0000
@@ -6350,7 +6350,7 @@
     }
     if(y)
     {
-        *y = mouseLoc.y;
+        *y = [[NSScreen mainScreen] frame].size.height - mouseLoc.y;
     }
 }
 
@@ -6418,8 +6418,9 @@
     NSView *view = [object isKindOfClass:[NSWindow class]] ? [object contentView] : parent;
     NSWindow *window = [view window];
     NSEvent *event = [DWApp currentEvent];
+    NSPoint p = NSMakePoint(x, [[NSScreen mainScreen] frame].size.height - y);
     NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown
-                                       location:[window convertScreenToBase:NSMakePoint(x, y)]
+                                       location:[window convertScreenToBase:p]
                                   modifierFlags:0
                                       timestamp:[event timestamp]
                                    windowNumber:[window windowNumber]
@@ -7533,7 +7534,7 @@
     NSObject *object = handle;
     NSPoint point;
     point.x = x;
-    point.y = y;
+    point.y = [[NSScreen mainScreen] frame].size.height - y;
 
     if([ object isKindOfClass:[ NSWindow class ] ])
     {
@@ -7578,7 +7579,7 @@
         if(x)
             *x = rect.origin.x;
         if(y)
-            *y = rect.origin.y;
+            *y = [[NSScreen mainScreen] frame].size.height - rect.origin.y;
         if(width)
             *width = rect.size.width;
         if(height)