Disable SPMediaKeyTap

Workaround issue #1606
This commit is contained in:
Jonas Kvinge 2024-11-20 18:12:20 +01:00
parent 7b23118475
commit 01aaa0ba0b
3 changed files with 23 additions and 24 deletions

View File

@ -271,9 +271,9 @@ else()
add_definitions(-DKDSINGLEAPPLICATION_STATIC_BUILD)
endif()
if(APPLE)
find_package(SPMediaKeyTap REQUIRED)
endif()
# if(APPLE)
# find_package(SPMediaKeyTap REQUIRED)
# endif()
if(WIN32)
find_package(getopt-win REQUIRED)
@ -1537,7 +1537,6 @@ if(APPLE)
"-framework DiskArbitration"
"-framework IOKit"
"-framework ScriptingBridge"
SPMediaKeyTap
)
endif()

View File

@ -41,7 +41,7 @@
#import <QuartzCore/CALayer.h>
#import <SPMediaKeyTap.h>
//#import <SPMediaKeyTap.h>
#include "config.h"
@ -145,18 +145,18 @@ QDebug operator<<(QDebug dbg, NSObject *object) {
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
key_tap_ = [[SPMediaKeyTap alloc] initWithDelegate:self];
if ([SPMediaKeyTap usesGlobalMediaKeyTap]) {
if ([key_tap_ startWatchingMediaKeys]) {
qLog(Debug) << "Media key monitoring started";
}
else {
qLog(Warning) << "Failed to start media key monitoring";
}
}
else {
qLog(Warning) << "Media key monitoring disabled";
}
// key_tap_ = [[SPMediaKeyTap alloc] initWithDelegate:self];
// if ([SPMediaKeyTap usesGlobalMediaKeyTap]) {
// if ([key_tap_ startWatchingMediaKeys]) {
// qLog(Debug) << "Media key monitoring started";
// }
// else {
// qLog(Warning) << "Failed to start media key monitoring";
// }
// }
// else {
// qLog(Warning) << "Media key monitoring disabled";
// }
}
@ -192,10 +192,10 @@ QDebug operator<<(QDebug dbg, NSObject *object) {
}
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event {
#pragma unused(keyTap)
[self handleMediaEvent:event];
}
// - (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event {
// #pragma unused(keyTap)
// [self handleMediaEvent:event];
// }
- (BOOL) handleMediaEvent:(NSEvent*)event {
// if it is not a media key event, then ignore

View File

@ -4,13 +4,13 @@
#include "globalshortcuts/globalshortcutsbackend-macos.h"
class PlatformInterface;
@class SPMediaKeyTap;
//@class SPMediaKeyTap;
@interface AppDelegate : NSObject<NSApplicationDelegate, NSUserNotificationCenterDelegate> {
PlatformInterface *application_handler_;
NSMenu *dock_menu_;
GlobalShortcutsBackendMacOS *shortcut_handler_;
SPMediaKeyTap *key_tap_;
//SPMediaKeyTap *key_tap_;
}
@ -29,5 +29,5 @@ class PlatformInterface;
- (void) setDockMenu: (NSMenu*)menu;
- (GlobalShortcutsBackendMacOS*) shortcut_handler;
- (void) setShortcutHandler: (GlobalShortcutsBackendMacOS*)backend;
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
//- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
@end