From 13160530f2ef05b24dc9331fe42b00def1e4d071 Mon Sep 17 00:00:00 2001 From: Akemi Date: Sun, 2 Apr 2017 21:02:00 +0200 Subject: 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. --- osdep/macosx_application.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'osdep') diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index fb3d742ed8..52dacb098a 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -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]; -- cgit v1.2.3