diff options
author | Claudio Cambra <claudio.cambra@gmail.com> | 2022-02-03 18:37:17 +0300 |
---|---|---|
committer | Claudio Cambra <claudio.cambra@gmail.com> | 2022-03-02 15:22:55 +0300 |
commit | 655a2e1c3936d4bced3bb7a87b5bbd7ab2ee7a86 (patch) | |
tree | 7386851fcb740d8e5d02609cafc2e05a2baaf033 /src/gui | |
parent | be21f036ff147aa24cabc766ae5c23ea16646fa4 (diff) |
No longer assume status bar height, calculate, fixing notch borking
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/systray.cpp | 5 | ||||
-rw-r--r-- | src/gui/systray.h | 1 | ||||
-rw-r--r-- | src/gui/systray.mm | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 707609612..263a91972 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -389,8 +389,9 @@ QRect Systray::taskbarGeometry() const return tbRect; #elif defined(Q_OS_MACOS) // Finder bar is always 22px height on macOS (when treating as effective pixels) - auto screenWidth = currentScreenRect().width(); - return {0, 0, screenWidth, 22}; + const auto screenWidth = currentScreenRect().width(); + const auto statusBarHeight = static_cast<int>(OCC::statusBarThickness()); + return {0, 0, screenWidth, statusBarHeight}; #else if (taskbarOrientation() == TaskBarPosition::Bottom || taskbarOrientation() == TaskBarPosition::Top) { auto screenWidth = currentScreenRect().width(); diff --git a/src/gui/systray.h b/src/gui/systray.h index 31251d01e..6b63d6797 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -42,6 +42,7 @@ public: bool canOsXSendUserNotification(); void sendOsXUserNotification(const QString &title, const QString &message); void setTrayWindowLevelAndVisibleOnAllSpaces(QWindow *window); +double statusBarThickness(); #endif /** diff --git a/src/gui/systray.mm b/src/gui/systray.mm index a4d35eb23..544455c16 100644 --- a/src/gui/systray.mm +++ b/src/gui/systray.mm @@ -17,6 +17,11 @@ namespace OCC { +double statusBarThickness() +{ + return [NSStatusBar systemStatusBar].thickness; +} + bool canOsXSendUserNotification() { return NSClassFromString(@"NSUserNotificationCenter") != nil; |