mac: Implement window state events

This commit is contained in:
Cheng Zhao 2014-11-25 13:16:51 +08:00
parent 588cc3c7ab
commit 3c7e5e47b8

View file

@ -81,11 +81,36 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
shell_->ClipWebView(); shell_->ClipWebView();
} }
- (void)windowDidMiniaturize:(NSNotification*)notification {
shell_->NotifyWindowMinimize();
}
- (void)windowDidDeminiaturize:(NSNotification*)notification {
shell_->NotifyWindowRestore();
}
- (BOOL)windowShouldZoom:(NSWindow*)window toFrame:(NSRect)newFrame {
// Cocoa doen't have concept of maximize/unmaximize, so wee need to emulate
// them by calculating size change when zooming.
if (newFrame.size.width < [window frame].size.width ||
newFrame.size.height < [window frame].size.height)
shell_->NotifyWindowUnmaximize();
else
shell_->NotifyWindowMaximize();
return YES;
}
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
shell_->NotifyWindowEnterFullScreen();
}
- (void)windowDidExitFullScreen:(NSNotification*)notification { - (void)windowDidExitFullScreen:(NSNotification*)notification {
if (!shell_->has_frame()) { if (!shell_->has_frame()) {
NSWindow* window = shell_->GetNativeWindow(); NSWindow* window = shell_->GetNativeWindow();
[[window standardWindowButton:NSWindowFullScreenButton] setHidden:YES]; [[window standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
} }
shell_->NotifyWindowLeaveFullScreen();
} }
- (void)windowWillClose:(NSNotification*)notification { - (void)windowWillClose:(NSNotification*)notification {