]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: Restore presentation options when leaving kiosk mode, fixes #272.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 9 Jun 2014 05:04:59 +0000 (13:04 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 9 Jun 2014 05:04:59 +0000 (13:04 +0800)
atom/browser/native_window_mac.h
atom/browser/native_window_mac.mm

index 5dc8aa6b8f693df456b59876b6282dd1e2084fc8..3739517e78e19c2b0455a695c64ac78894ba99f4 100644 (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_;
index 634b052cb015988ac3710e92ed5abe36a80d1868..891764a8ad77f2675ab567d9fc64b06e87844846 100644 (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_];
   }
 }