Source/BoardView.m
changeset 18 ed057f4a72ca
parent 16 28392c9a969f
child 22 4cb50131788f
     1.1 --- a/Source/BoardView.m	Mon Jul 14 21:00:15 2008 -0700
     1.2 +++ b/Source/BoardView.m	Wed Jul 16 10:49:04 2008 -0700
     1.3 @@ -110,16 +110,22 @@
     1.4  }
     1.5  
     1.6  
     1.7 +- (NSView*) fullScreenView
     1.8 +{
     1.9 +    return _fullScreenView ?: self;
    1.10 +}
    1.11 +
    1.12 +
    1.13  - (IBAction) enterFullScreen: (id)sender
    1.14  {
    1.15 -    [self _removeGameBoard];
    1.16 -    if( self.isInFullScreenMode ) {
    1.17 -        [self exitFullScreenModeWithOptions: nil];
    1.18 +    //[self _removeGameBoard];
    1.19 +    if( self.fullScreenView.isInFullScreenMode ) {
    1.20 +        [self.fullScreenView exitFullScreenModeWithOptions: nil];
    1.21      } else {
    1.22 -        [self enterFullScreenMode: self.window.screen 
    1.23 -                      withOptions: nil];
    1.24 +        [self.fullScreenView enterFullScreenMode: self.window.screen 
    1.25 +                                     withOptions: nil];
    1.26      }
    1.27 -    [self createGameBoard];
    1.28 +    //[self createGameBoard];
    1.29  }
    1.30  
    1.31  
    1.32 @@ -135,7 +141,9 @@
    1.33      if( _oldSize.width > 0.0f ) {
    1.34          CGAffineTransform xform = _table.affineTransform;
    1.35          xform.a = xform.d = MIN(newSize.width,newSize.height)/MIN(_oldSize.width,_oldSize.height);
    1.36 +        BeginDisableAnimations();
    1.37          _table.affineTransform = xform;
    1.38 +        EndDisableAnimations();
    1.39      } else
    1.40          [self createGameBoard];
    1.41  }
    1.42 @@ -152,12 +160,16 @@
    1.43  #pragma mark KEY EVENTS:
    1.44  
    1.45  
    1.46 -- (void) keyDown: (NSEvent*)ev
    1.47 +- (BOOL) performKeyEquivalent: (NSEvent*)ev
    1.48  {
    1.49 -    if( self.isInFullScreenMode ) {
    1.50 -        if( [ev.charactersIgnoringModifiers hasPrefix: @"\033"] )       // Esc key
    1.51 -            [self enterFullScreen: self];
    1.52 +    if( [ev.charactersIgnoringModifiers hasPrefix: @"\033"] ) {       // Esc key
    1.53 +        if( self.fullScreenView.isInFullScreenMode ) {
    1.54 +            [self performSelector: @selector(enterFullScreen:) withObject: nil afterDelay: 0.0];
    1.55 +            // without the delayed-perform, NSWindow crashes right after this method returns!
    1.56 +            return YES;
    1.57 +        }
    1.58      }
    1.59 +    return NO;
    1.60  }
    1.61  
    1.62