0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

osx: fix Touch Bar access on systems without Touch Bar support

when building with a deployment target older than an SDK with Touch Bar
support we still tried to access the TouchBar, since the compile time
checks are positive. to prevent this we add two runtime checks.
This commit is contained in:
Akemi 2017-04-02 21:02:00 +02:00
parent d4c1ddd6b1
commit 13160530f2

View File

@ -135,7 +135,8 @@ static void terminate_cocoa_application(void)
- (void)processEvent:(struct mpv_event *)event
{
#if HAVE_MACOS_TOUCHBAR
[(TouchBar *)self.touchBar processEvent:event];
if ([self respondsToSelector:@selector(touchBar)])
[(TouchBar *)self.touchBar processEvent:event];
#endif
}
@ -179,9 +180,11 @@ static void terminate_cocoa_application(void)
_R(menu, @"Zoom", @"z", MPM_ZOOM)
#if HAVE_MACOS_TOUCHBAR
[menu addItem:[NSMenuItem separatorItem]];
[self menuItemWithParent:menu title:@"Customize Touch Bar…"
action:@selector(toggleTouchBarMenu) keyEquivalent: @""];
if ([self respondsToSelector:@selector(touchBar)]) {
[menu addItem:[NSMenuItem separatorItem]];
[self menuItemWithParent:menu title:@"Customize Touch Bar…"
action:@selector(toggleTouchBarMenu) keyEquivalent: @""];
}
#endif
return [menu autorelease];