[vlc-commits] macosx: SPMediaKeyTap: Codestyle adjustments
Marvin Scholz
git at videolan.org
Fri Apr 23 21:27:41 UTC 2021
vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri Apr 23 01:20:16 2021 +0200| [98629054ac4d6d8beb90439702d2f7d65ee90b3e] | committer: Marvin Scholz
macosx: SPMediaKeyTap: Codestyle adjustments
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=98629054ac4d6d8beb90439702d2f7d65ee90b3e
---
modules/gui/macosx/SPMediaKeyTap.m | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/modules/gui/macosx/SPMediaKeyTap.m b/modules/gui/macosx/SPMediaKeyTap.m
index 315af6ef5c..4e046214d8 100644
--- a/modules/gui/macosx/SPMediaKeyTap.m
+++ b/modules/gui/macosx/SPMediaKeyTap.m
@@ -130,19 +130,19 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
@"stopWatchingMediaKeys must be called on the main thread!");
// Remove runloop source
- if(_eventPortSource){
+ if (_eventPortSource) {
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), _eventPortSource, kCFRunLoopCommonModes);
}
// Remove tap port
- if(_eventPort){
+ if (_eventPort) {
CFMachPortInvalidate(_eventPort);
CFRelease(_eventPort);
_eventPort = nil;
}
// Remove tap source
- if(_eventPortSource){
+ if (_eventPortSource) {
CFRelease(_eventPortSource);
_eventPortSource = nil;
}
@@ -212,17 +212,18 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
@autoreleasepool {
SPMediaKeyTap *self = (__bridge SPMediaKeyTap *)refcon;
- if(type == kCGEventTapDisabledByTimeout) {
+ if (type == kCGEventTapDisabledByTimeout) {
NSLog(@"VLC SPMediaKeyTap: Media key event tap was disabled by timeout");
CGEventTapEnable(self->_eventPort, TRUE);
return event;
- } else if(type == kCGEventTapDisabledByUserInput) {
+ } else if (type == kCGEventTapDisabledByUserInput) {
// Was disabled manually by -setShouldInterceptMediaKeyEvents:
return event;
- } else if(type != NX_SYSDEFINED) {
+ } else if (type != NX_SYSDEFINED) {
// If not a system defined event, do nothing.
return event;
}
+
NSEvent *nsEvent = nil;
@try {
nsEvent = [NSEvent eventWithCGEvent:event];
@@ -237,7 +238,11 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
return event;
int keyCode = (([nsEvent data1] & 0xFFFF0000) >> 16);
- if (keyCode != NX_KEYTYPE_PLAY && keyCode != NX_KEYTYPE_FAST && keyCode != NX_KEYTYPE_REWIND && keyCode != NX_KEYTYPE_PREVIOUS && keyCode != NX_KEYTYPE_NEXT)
+ if (keyCode != NX_KEYTYPE_PLAY &&
+ keyCode != NX_KEYTYPE_FAST &&
+ keyCode != NX_KEYTYPE_REWIND &&
+ keyCode != NX_KEYTYPE_PREVIOUS &&
+ keyCode != NX_KEYTYPE_NEXT)
return event;
[self performSelectorOnMainThread:@selector(handleAndReleaseMediaKeyEvent:) withObject:nsEvent waitUntilDone:NO];
@@ -264,7 +269,7 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
[self debugPrintAppList];
#endif
- if([_mediaKeyAppList count] == 0)
+ if ([_mediaKeyAppList count] == 0)
return;
NSRunningApplication *thisApp = [NSRunningApplication currentApplication];
More information about the vlc-commits
mailing list