diff options
| author | Teddy Wing | 2018-10-27 06:08:38 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2018-10-27 06:08:38 +0200 | 
| commit | 7d6c546b435634b71de337c1e65b58c22404099d (patch) | |
| tree | 59e301666825632c7ccf70759fada4f944800a7e | |
| parent | 57294b01c615541b4651b2ca3076843e45a2add6 (diff) | |
| download | DomeKey-7d6c546b435634b71de337c1e65b58c22404099d.tar.bz2 | |
HeadphoneKey: Delete `startMonitoringBluetoothEvents` method
From what I could tell, this didn't work for handling Bluetooth button
press events. Delete it since it's not being used. We'll have to come
back to Bluetooth again later.
| -rw-r--r-- | DomeKey/AppDelegate.m | 1 | ||||
| -rw-r--r-- | DomeKey/HeadphoneKey.h | 1 | ||||
| -rw-r--r-- | DomeKey/HeadphoneKey.m | 41 | 
3 files changed, 0 insertions, 43 deletions
| diff --git a/DomeKey/AppDelegate.m b/DomeKey/AppDelegate.m index a1e6563..bcd4dd0 100644 --- a/DomeKey/AppDelegate.m +++ b/DomeKey/AppDelegate.m @@ -22,7 +22,6 @@  - (void)applicationDidFinishLaunching:(NSNotification *)notification  {      _headphone_key = [[HeadphoneKey alloc] initWithTimeout:_config->timeout]; -    [_headphone_key startMonitoringBluetoothEvents];  }  @end diff --git a/DomeKey/HeadphoneKey.h b/DomeKey/HeadphoneKey.h index ad6f8dd..be0e62c 100644 --- a/DomeKey/HeadphoneKey.h +++ b/DomeKey/HeadphoneKey.h @@ -30,6 +30,5 @@ static const Milliseconds TIMEOUT_DEFAULT = 500;  - (instancetype)initWithTimeout:(Milliseconds)timeout;  - (void)handleDeadKey:(HeadphoneButton)button;  - (void)runAction; -- (void)startMonitoringBluetoothEvents;  @end diff --git a/DomeKey/HeadphoneKey.m b/DomeKey/HeadphoneKey.m index 5a83ad0..5cf0806 100644 --- a/DomeKey/HeadphoneKey.m +++ b/DomeKey/HeadphoneKey.m @@ -71,47 +71,6 @@      }  } -- (void)startMonitoringBluetoothEvents -{ -    // https://github.com/jguice/mac-bt-headset-fix/blob/master/Spotify%20Bluetooth%20Headset%20Listener/KDMAppDelegate.m -    [NSEvent -        addGlobalMonitorForEventsMatchingMask:(NSKeyDownMask | NSSystemDefinedMask) -        handler:^(NSEvent *theEvent) { -            int key_code = (([theEvent data1] & 0xFFFF0000) >> 16); -            int key_flags = ([theEvent data1] & 0x0000FFFF); -            int key_state = (((key_flags & 0xFF00) >> 8)) == 0xA; - -            NSLog(@"Key from global monitor pressed"); - -            // TODO: Fix magic numbers -            if (key_code == 10 && key_flags == 6972) { -                switch ([theEvent data2]) { -                case 786608: -                case 786637: -                    NSLog(@"Play"); - -                    break; -                case 786611: -                    NSLog(@"Next"); - -                    break; -                case 786612: -                    NSLog(@"Previous"); - -                    break; -                case 786613: -                    NSLog(@"Fast-forward"); - -                    break; -                case 786614: -                    NSLog(@"Rewind"); - -                    break; -                } -            } -        }]; -} -  - (void)handleDeadKey:(HeadphoneButton)button  {      NSNumber *storable_button = [NSNumber numberWithUnsignedInteger:button]; | 
