mac: Restore presentation options when leaving kiosk mode, fixes #272.

This commit is contained in:
Cheng Zhao 2014-06-09 13:04:59 +08:00
parent 7d38fe61d2
commit 1d6b02f304
2 changed files with 8 additions and 4 deletions

View file

@ -95,6 +95,9 @@ class NativeWindowMac : public NativeWindow {
NSInteger attention_request_id_; // identifier from requestUserAttention
// The presentation options before entering kiosk mode.
NSApplicationPresentationOptions kiosk_options_;
// For system drag, the whole window is draggable and the non-draggable areas
// have to been explicitly excluded.
std::vector<gfx::Rect> system_drag_exclude_areas_;

View file

@ -409,7 +409,8 @@ void NativeWindowMac::FlashFrame(bool flash) {
}
void NativeWindowMac::SetKiosk(bool kiosk) {
if (kiosk) {
if (kiosk && !is_kiosk_) {
kiosk_options_ = [NSApp currentSystemPresentationOptions];
NSApplicationPresentationOptions options =
NSApplicationPresentationHideDock +
NSApplicationPresentationHideMenuBar +
@ -421,10 +422,10 @@ void NativeWindowMac::SetKiosk(bool kiosk) {
[NSApp setPresentationOptions:options];
is_kiosk_ = true;
SetFullscreen(true);
} else {
[NSApp setPresentationOptions:[NSApp currentSystemPresentationOptions]];
is_kiosk_ = false;
} else if (!kiosk && is_kiosk_) {
is_kiosk_ = false;
SetFullscreen(false);
[NSApp setPresentationOptions:kiosk_options_];
}
}