diff src/video/quartz/SDL_QuartzWM.m @ 683:5d2f027b3349

Date: Sat, 9 Aug 2003 20:14:06 -0400 From: Darrell Walisser Subject: Re: Updated projects? >> Did you get a chance to look at my "Custom Cocoa" demo? I have a few >> minor patches that enable SDL/Cocoa integration, and a project >> template. > > I didn't yet, but go ahead and send me the patches. :) > I updated the patch for current CVS. There are a lot of changes, but I don't think I've broken anything. This patch also improves the behavior of window minimize/deminimize.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 10 Aug 2003 07:21:43 +0000
parents 7ec821f3cbd0
children c5b2b6d2d1fe
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzWM.m	Sat Aug 09 22:49:28 2003 +0000
+++ b/src/video/quartz/SDL_QuartzWM.m	Sun Aug 10 07:21:43 2003 +0000
@@ -119,28 +119,35 @@
 /* Convert SDL coordinate to Cocoa coordinate */
 static void QZ_PrivateSDLToCocoa (_THIS, NSPoint *p) {
 
-    int height;
-    
     if ( CGDisplayIsCaptured (display_id) ) { /* capture signals fullscreen */
     
-        height = CGDisplayPixelsHigh (display_id);
+        p->y = CGDisplayPixelsHigh (display_id) - p->y - 1;
     }
     else {
         
-        height = NSHeight ( [ qz_window frame ] );
-        if ( [ qz_window styleMask ] & NSTitledWindowMask ) {
+        NSPoint newPoint;
         
-            height -= 22;
-        }
+        newPoint = [ window_view convertPoint:*p toView:[ qz_window contentView ] ];
+        
+        *p = newPoint;
     }
-    
-    p->y = height - p->y - 1;
 }
 
 /* Convert Cocoa coordinate to SDL coordinate */
 static void QZ_PrivateCocoaToSDL (_THIS, NSPoint *p) {
 
-    QZ_PrivateSDLToCocoa (this, p);
+    if ( CGDisplayIsCaptured (display_id) ) { /* capture signals fullscreen */
+    
+        p->y = CGDisplayPixelsHigh (display_id) - p->y - 1;
+    }
+    else {
+        
+        NSPoint newPoint;
+        
+        newPoint = [ window_view convertPoint:*p fromView:[ qz_window contentView ] ];
+        
+        *p = newPoint;
+    }
 }
 
 /* Convert SDL coordinate to window server (CoreGraphics) coordinate */
@@ -165,6 +172,7 @@
     return cgp;
 }
 
+#if 0 /* Dead code */
 /* Convert window server (CoreGraphics) coordinate to SDL coordinate */
 static void QZ_PrivateCGToSDL (_THIS, NSPoint *p) {
             
@@ -180,6 +188,7 @@
         QZ_PrivateCocoaToSDL (this, p);
     }
 }
+#endif /* Dead code */
 
 static void  QZ_PrivateWarpCursor (_THIS, int x, int y) {
     
@@ -188,7 +197,6 @@
     
     p = NSMakePoint (x, y);
     cgp = QZ_PrivateSDLToCG (this, &p);
-    QZ_PrivateCGToSDL (this, &p);
     
     /* this is the magic call that fixes cursor "freezing" after warp */
     CGSetLocalEventsSuppressionInterval (0.0);