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!
pull/1825/head
Nicolas Werner 2 months ago
parent cc4ace3c12
commit 048af42780
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 4
      CMakeLists.txt
  2. 14
      src/emoji/MacHelper.h
  3. 26
      src/emoji/MacHelper.mm
  4. 5
      src/main.cpp

@ -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

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QMenuBar>
class MacHelper
{
public:
static void showEmojiWindow();
static void initializeMenus();
};

@ -1,26 +0,0 @@
#include "MacHelper.h"
#include <Cocoa/Cocoa.h>
#include <Foundation/Foundation.h>
#include <Foundation/NSString.h>
#include <QCoreApplication>
void
MacHelper::showEmojiWindow()
{
NSApplication *theNSApplication = [NSApplication sharedApplication];
[theNSApplication orderFrontCharacterPalette:nil];
}
void
MacHelper::initializeMenus()
{
NSApplication *theNSApplication = [NSApplication sharedApplication];
NSArray<NSMenuItem *> *menus = [theNSApplication mainMenu].itemArray;
NSUInteger size = menus.count;
for (NSUInteger i = 0; i < size; i++) {
NSMenuItem *item = [menus objectAtIndex:i];
[item setTitle:@"Edit"];
}
}

@ -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();

Loading…
Cancel
Save