Browse Source

Fix compiler errors

Kevin Sawicki 8 years ago
parent
commit
bce62622bb
2 changed files with 23 additions and 22 deletions
  1. 2 1
      atom/browser/native_window.h
  2. 21 21
      atom/browser/native_window_mac.mm

+ 2 - 1
atom/browser/native_window.h

@@ -118,7 +118,8 @@ class NativeWindow : public base::SupportsUserData,
   virtual bool IsFullScreenable() = 0;
   virtual void SetClosable(bool closable) = 0;
   virtual bool IsClosable() = 0;
-  virtual void SetAlwaysOnTop(bool top, const std::string& level) = 0;
+  virtual void SetAlwaysOnTop(bool top,
+                              const std::string& level = "floating") = 0;
   virtual bool IsAlwaysOnTop() = 0;
   virtual void Center() = 0;
   virtual void SetTitle(const std::string& title) = 0;

+ 21 - 21
atom/browser/native_window_mac.mm

@@ -943,28 +943,28 @@ bool NativeWindowMac::IsClosable() {
   return [window_ styleMask] & NSClosableWindowMask;
 }
 
-void NativeWindowMac::SetAlwaysOnTop(bool top, std::string level) {
-  int intLevel;
-  if (level == "normal") {
-    intLevel = NSNormalWindowLevel;
-  } else if (level == "floating") {
-    intLevel = NSFloatingWindowLevel;
-  } else if (level == "torn-off-menu") {
-    intLevel = NSTornOffMenuWindowLevel;
-  } else if (level == "modal-panel") {
-    intLevel = NSModalPanelWindowLevel;
-  } else if (level == "main-menu") {
-    intLevel = NSMainMenuWindowLevel;
-  } else if (level == "status") {
-    intLevel = NSStatusWindowLevel;
-  } else if (level == "pop-up-menu") {
-    intLevel = NSPopUpMenuWindowLevel;
-  } else if (level == "screen-saver") {
-    intLevel = NSScreenSaverWindowLevel;
-  } else if (level == "dock") {
-    intLevel = NSDockWindowLevel;
+void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
+  int windowLevel = NSNormalWindowLevel;
+  if (top) {
+    if (level == "floating") {
+      windowLevel = NSFloatingWindowLevel;
+    } else if (level == "torn-off-menu") {
+      windowLevel = NSTornOffMenuWindowLevel;
+    } else if (level == "modal-panel") {
+      windowLevel = NSModalPanelWindowLevel;
+    } else if (level == "main-menu") {
+      windowLevel = NSMainMenuWindowLevel;
+    } else if (level == "status") {
+      windowLevel = NSStatusWindowLevel;
+    } else if (level == "pop-up-menu") {
+      windowLevel = NSPopUpMenuWindowLevel;
+    } else if (level == "screen-saver") {
+      windowLevel = NSScreenSaverWindowLevel;
+    } else if (level == "dock") {
+      windowLevel = NSDockWindowLevel;
+    }
   }
-  [window_ setLevel:(top ? intLevel : NSNormalWindowLevel)];
+  [window_ setLevel:windowLevel];
 }
 
 bool NativeWindowMac::IsAlwaysOnTop() {