[vlc-commits] macosx: SPMediaKeyTap: Check earlier for event type
Marvin Scholz
git at videolan.org
Fri Apr 23 21:27:39 UTC 2021
vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri Apr 23 01:05:08 2021 +0200| [07af25206f9e0662e3462c27ff9e5966695d70dd] | committer: Marvin Scholz
macosx: SPMediaKeyTap: Check earlier for event type
Do not create the NSEvent before checking if the event is actually a
NX_SYSDEFINED. It should never happen, but just in case, there is no
point in creating the NSEvent first.
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=07af25206f9e0662e3462c27ff9e5966695d70dd
---
modules/gui/macosx/SPMediaKeyTap.m | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/gui/macosx/SPMediaKeyTap.m b/modules/gui/macosx/SPMediaKeyTap.m
index 4ffb01087a..bd32d5017e 100644
--- a/modules/gui/macosx/SPMediaKeyTap.m
+++ b/modules/gui/macosx/SPMediaKeyTap.m
@@ -225,6 +225,9 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
} else if(type == kCGEventTapDisabledByUserInput) {
// Was disabled manually by -setShouldInterceptMediaKeyEvents:
return event;
+ } else if(type != NX_SYSDEFINED) {
+ // If not a system defined event, do nothing.
+ return event;
}
NSEvent *nsEvent = nil;
@try {
@@ -236,7 +239,7 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
return event;
}
- if (type != NX_SYSDEFINED || [nsEvent subtype] != SPSystemDefinedEventMediaKeys)
+ if ([nsEvent subtype] != SPSystemDefinedEventMediaKeys)
return event;
int keyCode = (([nsEvent data1] & 0xFFFF0000) >> 16);
More information about the vlc-commits
mailing list