From 048af42780af7177bc57cc1d83cf48ef09ca1e1e Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 25 Sep 2024 12:11:01 +0200 Subject: [PATCH] Remove manual menu bar mangling on macos This is causing probably more issues nowadays than it fixes. Qt should be adding those menus for us now, so let's remove it and see, what breaks! --- CMakeLists.txt | 4 ++-- src/emoji/MacHelper.h | 14 -------------- src/emoji/MacHelper.mm | 26 -------------------------- src/main.cpp | 5 ----- 4 files changed, 2 insertions(+), 47 deletions(-) delete mode 100644 src/emoji/MacHelper.h delete mode 100644 src/emoji/MacHelper.mm diff --git a/CMakeLists.txt b/CMakeLists.txt index 7468d989..1832968e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -648,9 +648,9 @@ qt_add_resources(QRC resources/res.qrc) if(APPLE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications") - set(SRC_FILES ${SRC_FILES} src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp src/emoji/MacHelper.mm src/emoji/MacHelper.h) + set(SRC_FILES ${SRC_FILES} src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") - set_source_files_properties( src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/emoji/MacHelper.mm src/emoji/MacHelper.h PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + set_source_files_properties( src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON) endif() elseif(WIN32) file(DOWNLOAD diff --git a/src/emoji/MacHelper.h b/src/emoji/MacHelper.h deleted file mode 100644 index 38175364..00000000 --- a/src/emoji/MacHelper.h +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-FileCopyrightText: Nheko Contributors -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -class MacHelper -{ -public: - static void showEmojiWindow(); - static void initializeMenus(); -}; diff --git a/src/emoji/MacHelper.mm b/src/emoji/MacHelper.mm deleted file mode 100644 index 11dbd7f4..00000000 --- a/src/emoji/MacHelper.mm +++ /dev/null @@ -1,26 +0,0 @@ -#include "MacHelper.h" - -#include -#include -#include -#include - -void -MacHelper::showEmojiWindow() -{ - NSApplication *theNSApplication = [NSApplication sharedApplication]; - [theNSApplication orderFrontCharacterPalette:nil]; -} - -void -MacHelper::initializeMenus() -{ - NSApplication *theNSApplication = [NSApplication sharedApplication]; - - NSArray *menus = [theNSApplication mainMenu].itemArray; - NSUInteger size = menus.count; - for (NSUInteger i = 0; i < size; i++) { - NSMenuItem *item = [menus objectAtIndex:i]; - [item setTitle:@"Edit"]; - } -} diff --git a/src/main.cpp b/src/main.cpp index 0dad400b..8ce6fe5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,6 @@ #include "config/nheko.h" #if defined(Q_OS_MACOS) -#include "emoji/MacHelper.h" #include "notifications/Manager.h" #endif @@ -466,10 +465,6 @@ main(int argc, char *argv[]) QStringLiteral("matrix"), ChatPage::instance(), "handleMatrixUri"); #if defined(Q_OS_MACOS) - // Temporary solution for the emoji picker until - // nheko has a proper menu bar with more functionality. - MacHelper::initializeMenus(); - // Need to set up notification delegate so users can respond to messages from within the // notification itself. NotificationsManager::attachToMacNotifCenter();