src/video/quartz/SDL_QuartzWindow.m
changeset 631 52864d66d168
parent 501 74262d2647ca
child 683 5d2f027b3349
equal deleted inserted replaced
630:550bccdf04bd 631:52864d66d168
    29 @interface SDL_QuartzWindow : NSWindow
    29 @interface SDL_QuartzWindow : NSWindow
    30 {}
    30 {}
    31 - (void)miniaturize:(id)sender;
    31 - (void)miniaturize:(id)sender;
    32 - (void)display;
    32 - (void)display;
    33 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
    33 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
       
    34 - (void)appDidHide:(NSNotification*)note;
       
    35 - (void)appDidUnhide:(NSNotification*)note;
       
    36 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
    34 @end
    37 @end
    35 
    38 
    36 @implementation SDL_QuartzWindow
    39 @implementation SDL_QuartzWindow
    37 
    40 
    38 /* we override these methods to fix the miniaturize animation/dock icon bug */
    41 /* we override these methods to fix the miniaturize animation/dock icon bug */
    49         
    52         
    50         /* make the alpha channel opaque so anim won't have holes in it */
    53         /* make the alpha channel opaque so anim won't have holes in it */
    51         QZ_SetPortAlphaOpaque ();
    54         QZ_SetPortAlphaOpaque ();
    52     }
    55     }
    53     
    56     
       
    57     /* window is hidden now */
       
    58     SDL_PrivateAppActive (0, SDL_APPACTIVE);
       
    59     
    54     [ super miniaturize:sender ];
    60     [ super miniaturize:sender ];
    55 }
    61 }
    56 
    62 
    57 - (void)display
    63 - (void)display
    58 {    
    64 {    
    61         So, it's just the right place to fixup the alpha channel - which
    67         So, it's just the right place to fixup the alpha channel - which
    62         makes the deminiaturize animation look right.
    68         makes the deminiaturize animation look right.
    63     */
    69     */
    64     if ( (SDL_VideoSurface->flags & SDL_OPENGL) == 0)
    70     if ( (SDL_VideoSurface->flags & SDL_OPENGL) == 0)
    65         QZ_SetPortAlphaOpaque ();
    71         QZ_SetPortAlphaOpaque ();
       
    72 
       
    73     /* window is visible again */
       
    74     SDL_PrivateAppActive (1, SDL_APPACTIVE);
    66 }
    75 }
    67 
    76 
    68 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag
    77 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag
    69 {
    78 {
    70 
    79 
    98             UnlockPortBits ( [ window_view qdPort ] );
   107             UnlockPortBits ( [ window_view qdPort ] );
    99         }
   108         }
   100     }
   109     }
   101 }
   110 }
   102 
   111 
       
   112 - (void)appDidHide:(NSNotification*)note
       
   113 {
       
   114     SDL_PrivateAppActive (0, SDL_APPACTIVE);
       
   115 }
       
   116 
       
   117 - (void)appDidUnhide:(NSNotification*)note
       
   118 {
       
   119     SDL_PrivateAppActive (1, SDL_APPACTIVE);
       
   120 }
       
   121 
       
   122 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
       
   123 {
       
   124     /* Make our window subclass receive these application notifications */
       
   125     [ [ NSNotificationCenter defaultCenter ] addObserver:self
       
   126         selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ];
       
   127     
       
   128     [ [ NSNotificationCenter defaultCenter ] addObserver:self
       
   129         selector:@selector(appDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp ];
       
   130         
       
   131     return [ super initWithContentRect:contentRect styleMask:styleMask backing:backingType defer:flag ];
       
   132 }
       
   133 
   103 @end
   134 @end
   104 
   135 
   105 /* Delegate for our NSWindow to send SDLQuit() on close */
   136 /* Delegate for our NSWindow to send SDLQuit() on close */
   106 @interface SDL_QuartzWindowDelegate : NSObject
   137 @interface SDL_QuartzWindowDelegate : NSObject
   107 {}
   138 {}