src/video/cocoa/SDL_cocoawindow.m
changeset 9643 413b222c4b64
parent 9628 065e4ddc8753
child 9679 7fc4a8be47a8
equal deleted inserted replaced
9642:cd237569d0f6 9643:413b222c4b64
   253         [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:window];
   253         [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:window];
   254         [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:window];
   254         [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:window];
   255         [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window];
   255         [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window];
   256         [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window];
   256         [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window];
   257         [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window];
   257         [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window];
       
   258         [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window];
   258         [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window];
   259         [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window];
   259         [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window];
   260         [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window];
   260         [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window];
   261         [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window];
   261         [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
   262         [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
   262     } else {
   263     } else {
   383         [center removeObserver:self name:NSWindowDidResizeNotification object:window];
   384         [center removeObserver:self name:NSWindowDidResizeNotification object:window];
   384         [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:window];
   385         [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:window];
   385         [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
   386         [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
   386         [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window];
   387         [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window];
   387         [center removeObserver:self name:NSWindowDidResignKeyNotification object:window];
   388         [center removeObserver:self name:NSWindowDidResignKeyNotification object:window];
       
   389         [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window];
   388         [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window];
   390         [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window];
   389         [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window];
   391         [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window];
   390         [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window];
   392         [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window];
   391         [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
   393         [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
   392     } else {
   394     } else {
   579         SDL_SetKeyboardFocus(NULL);
   581         SDL_SetKeyboardFocus(NULL);
   580     }
   582     }
   581 
   583 
   582     if (isFullscreenSpace) {
   584     if (isFullscreenSpace) {
   583         [NSMenu setMenuBarVisible:YES];
   585         [NSMenu setMenuBarVisible:YES];
       
   586     }
       
   587 }
       
   588 
       
   589 - (void)windowDidChangeBackingProperties:(NSNotification *)aNotification
       
   590 {
       
   591     NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey];
       
   592 
       
   593     if (inFullscreenTransition) {
       
   594         return;
       
   595     }
       
   596 
       
   597     if ([oldscale doubleValue] != [_data->nswindow backingScaleFactor]) {
       
   598         /* Force a resize event when the backing scale factor changes. */
       
   599         _data->window->w = 0;
       
   600         _data->window->h = 0;
       
   601         [self windowDidResize:aNotification];
   584     }
   602     }
   585 }
   603 }
   586 
   604 
   587 - (void)windowWillEnterFullScreen:(NSNotification *)aNotification
   605 - (void)windowWillEnterFullScreen:(NSNotification *)aNotification
   588 {
   606 {