diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 92e5e5b56280..93bccfabd706 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -486,8 +486,10 @@ bool Window::IsClosable() { return window_->IsClosable(); } -void Window::SetAlwaysOnTop(bool top) { - window_->SetAlwaysOnTop(top); +void Window::SetAlwaysOnTop(bool top, mate::Arguments* args) { + int level = 0; + args->GetNext(&level); + window_->SetAlwaysOnTop(top, level); } bool Window::IsAlwaysOnTop() { diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index d2c41c288165..f923ea3cd929 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -132,7 +132,7 @@ class Window : public mate::TrackableObject, bool IsFullScreenable(); void SetClosable(bool closable); bool IsClosable(); - void SetAlwaysOnTop(bool top); + void SetAlwaysOnTop(bool top, mate::Arguments* args); bool IsAlwaysOnTop(); void Center(); void SetPosition(int x, int y, mate::Arguments* args); diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 734584f8c7d8..ddc90ff63a52 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -118,7 +118,7 @@ class NativeWindow : public base::SupportsUserData, virtual bool IsFullScreenable() = 0; virtual void SetClosable(bool closable) = 0; virtual bool IsClosable() = 0; - virtual void SetAlwaysOnTop(bool top) = 0; + virtual void SetAlwaysOnTop(bool top, int level = 0) = 0; virtual bool IsAlwaysOnTop() = 0; virtual void Center() = 0; virtual void SetTitle(const std::string& title) = 0; diff --git a/atom/browser/native_window_mac.h b/atom/browser/native_window_mac.h index 10b35165977f..9c909894bfce 100644 --- a/atom/browser/native_window_mac.h +++ b/atom/browser/native_window_mac.h @@ -64,7 +64,7 @@ class NativeWindowMac : public NativeWindow, bool IsFullScreenable() override; void SetClosable(bool closable) override; bool IsClosable() override; - void SetAlwaysOnTop(bool top) override; + void SetAlwaysOnTop(bool top, int level) override; bool IsAlwaysOnTop() override; void Center() override; void SetTitle(const std::string& title) override; diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index ef4cf7b4c4f2..c35f66b319c7 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -943,8 +943,11 @@ bool NativeWindowMac::IsClosable() { return [window_ styleMask] & NSClosableWindowMask; } -void NativeWindowMac::SetAlwaysOnTop(bool top) { - [window_ setLevel:(top ? NSFloatingWindowLevel : NSNormalWindowLevel)]; +void NativeWindowMac::SetAlwaysOnTop(bool top, int level) { + if (!level) { + level = NSFloatingWindowLevel; + } + [window_ setLevel:(top ? level : NSNormalWindowLevel)]; } bool NativeWindowMac::IsAlwaysOnTop() { diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index ef5ae30a8405..f01cfcc56eba 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -682,8 +682,8 @@ bool NativeWindowViews::IsClosable() { #endif } -void NativeWindowViews::SetAlwaysOnTop(bool top) { - window_->SetAlwaysOnTop(top); +void NativeWindowViews::SetAlwaysOnTop(bool top, int level) { + window_->SetAlwaysOnTop(top, level); } bool NativeWindowViews::IsAlwaysOnTop() { diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index d0d45fc53594..608050c7ca9a 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -84,7 +84,7 @@ class NativeWindowViews : public NativeWindow, bool IsFullScreenable() override; void SetClosable(bool closable) override; bool IsClosable() override; - void SetAlwaysOnTop(bool top) override; + void SetAlwaysOnTop(bool top, int level) override; bool IsAlwaysOnTop() override; void Center() override; void SetTitle(const std::string& title) override;