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) add_definitions(-DKDSINGLEAPPLICATION_STATIC_BUILD)
endif() endif()
if(APPLE) # if(APPLE)
find_package(SPMediaKeyTap REQUIRED) # find_package(SPMediaKeyTap REQUIRED)
endif() # endif()
if(WIN32) if(WIN32)
find_package(getopt-win REQUIRED) find_package(getopt-win REQUIRED)
@ -1537,7 +1537,6 @@ if(APPLE)
"-framework DiskArbitration" "-framework DiskArbitration"
"-framework IOKit" "-framework IOKit"
"-framework ScriptingBridge" "-framework ScriptingBridge"
SPMediaKeyTap
) )
endif() endif()

View File

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

View File

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