diff src/video/quartz/SDL_QuartzEvents.m @ 158:4382c38dfbee

Date: Tue, 21 Aug 2001 03:50:01 +0200 From: Max Horn <max@quendi.de> Subject: New patch for OS X Attached a .patch file for SDL/OSX with some nice bug fixes / enhancments. * fixes the activation issues, which also caused the window to be always drawn like an inactive. The close/minimize widgets now are animated properly, too. * the menu items are automatically adjusted to use the app name instead of just "SDL App". I did this so that we really can use one central SDLMain.nib file, w/o requiring developers to make a copy of it and adjust it. * libSDLMain now contains the proper cocoa code, not as before the carbon code. This means apps no longer have to carry a copy of SDLMain.m/SDLMain.h * revamped configure.in to properly build a Cocoa/Quartz SDL lib, not a Carbon based SDL lib
author Sam Lantinga <slouken@libsdl.org>
date Tue, 21 Aug 2001 07:19:59 +0000
parents 2d162219f433
children e92aa316c517
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzEvents.m	Mon Aug 20 04:41:49 2001 +0000
+++ b/src/video/quartz/SDL_QuartzEvents.m	Tue Aug 21 07:19:59 2001 +0000
@@ -223,7 +223,7 @@
 }
 
 static void QZ_PumpEvents (_THIS)
-{ 
+{
     NSDate *distantPast;
     NSEvent *event;
     NSRect winRect;
@@ -247,27 +247,29 @@
     
         if (event != nil) {
             unsigned int type;
+            BOOL isForGameWin;
 
-            #define DO_MOUSE_DOWN(button, sendToWindow)                      \
+            #define DO_MOUSE_DOWN(button, sendToWindow) do {                 \
                 if ( inForeground ) {                                        \
                     if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN) ||       \
                          NSPointInRect([event locationInWindow], winRect) )  \
                         SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);  \
-                    else if (sendToWindow)                                   \
-                            [ window sendEvent:event ];                      \
                 }                                                            \
                 else {                                                       \
                     QZ_DoActivate (this);                                    \
-                }       
-            
-            #define DO_MOUSE_UP(button, sendToWindow)                        \
+                }                                                            \
+                [ NSApp sendEvent:event ];                                   \
+                } while(0)
+                
+            #define DO_MOUSE_UP(button, sendToWindow) do {                   \
                 if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN) ||           \
                      !NSPointInRect([event locationInWindow], titleBarRect) )\
                     SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);     \
-                if (sendToWindow)                                            \
-                    [ window sendEvent:event ]
-                    
+                [ NSApp sendEvent:event ];                                   \
+                } while(0)
+
             type = [ event type ];
+            isForGameWin = (qz_window == [ event window ]);
             switch (type) {
             
             case NSLeftMouseDown:  
@@ -351,8 +353,8 @@
             case NSFlagsChanged:
                 QZ_DoModifiers( [ event modifierFlags ] );
                 break;
-            case NSMouseEntered: break;
-            case NSMouseExited: break;
+//            case NSMouseEntered: break;
+//            case NSMouseExited: break;
             case NSAppKitDefined:
                 switch ( [ event subtype ] ) {
                 case NSApplicationActivatedEventType:
@@ -361,14 +363,14 @@
                 case NSApplicationDeactivatedEventType:
                     QZ_DoDeactivate (this);
                     break;
-                case NSWindowMovedEventType:
-                    [ window sendEvent:event ];
-                    break;
                 }
+                [ NSApp sendEvent:event ];
                 break;
-            case NSApplicationDefined: break;
-            case NSPeriodic: break;
-            case NSCursorUpdate: break;
+//            case NSApplicationDefined: break;
+//            case NSPeriodic: break;
+//            case NSCursorUpdate: break;
+            default:
+                [ NSApp sendEvent:event ];
             }
         }
       } while (event != nil);