summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-02-14 16:43:40 +0100
committerGitHub <noreply@github.com>2018-02-14 16:43:40 +0100
commite0f43e06785ea1b05a5d7c4be32b74a9995be8fe (patch)
treeed1ed82993d60083bf51384311fea8831035a4b8 /platform/osx
parent2eb7a321ba321065c135f799701efaf735142593 (diff)
parent2e8c7824c0f2946f6bf33fe0a20eabb779a91763 (diff)
Merge pull request #15564 from RandomShaper/adpod-topmost
Add new window setting: always on top
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm14
2 files changed, 16 insertions, 0 deletions
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index e5f43f9433..aa8db8f300 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -222,6 +222,8 @@ public:
virtual bool is_window_minimized() const;
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
+ virtual void set_window_always_on_top(bool p_enabled);
+ virtual bool is_window_always_on_top() const;
virtual void request_attention();
virtual String get_joy_guid(int p_device) const;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 65a168285d..4c459772aa 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1966,6 +1966,20 @@ void OS_OSX::move_window_to_foreground() {
[window_object orderFrontRegardless];
}
+void OS_OSX::set_window_always_on_top(bool p_enabled) {
+ if (is_window_always_on_top() == p_enabled)
+ return;
+
+ if (p_enabled)
+ [window_object setLevel:NSFloatingWindowLevel];
+ else
+ [window_object setLevel:NSNormalWindowLevel];
+}
+
+bool OS_OSX::is_window_always_on_top() const {
+ return [window_object level] == NSFloatingWindowLevel;
+}
+
void OS_OSX::request_attention() {
[NSApp requestUserAttention:NSCriticalRequest];