From c62301b764b591c99037dfad9a6599d75011d3ee Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 11 Apr 2020 22:16:57 +0200 Subject: [PATCH] fix widget visibility when 'Automatically hide and show the menu bar' turned on --- Stats.xcodeproj/project.pbxproj | 8 ++++---- Stats/Widgets/Widget.swift | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Stats.xcodeproj/project.pbxproj b/Stats.xcodeproj/project.pbxproj index 84d7f353cae..ed7c01858f5 100644 --- a/Stats.xcodeproj/project.pbxproj +++ b/Stats.xcodeproj/project.pbxproj @@ -742,7 +742,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = RP2S87B72W; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -756,7 +756,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 1.6.0; + MARKETING_VERSION = 1.6.1; PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -773,7 +773,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = RP2S87B72W; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -787,7 +787,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 1.6.0; + MARKETING_VERSION = 1.6.1; PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Stats/Widgets/Widget.swift b/Stats/Widgets/Widget.swift index c537a243d15..8a88dfef79d 100644 --- a/Stats/Widgets/Widget.swift +++ b/Stats/Widgets/Widget.swift @@ -44,7 +44,12 @@ struct Widgets { struct WidgetSize { let width: CGFloat = 32 - let height: CGFloat = NSApplication.shared.mainMenu?.menuBarHeight ?? 22 + var height: CGFloat { + get { + let systemHeight = NSApplication.shared.mainMenu?.menuBarHeight + return (systemHeight == 0 ? 22 : systemHeight)! + } + } let margin: CGFloat = 2 } let widgetSize = WidgetSize()