diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-12-31 00:29:51 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2022-01-01 12:19:30 +0100 |
commit | 80fc5fb46c306b23ef9fb4ffc3cf201133092b9d (patch) | |
tree | 709bd275d56cd6b70714d98fee7101a37e011d2f /src/video/cocoa/cocoa_wnd.h | |
parent | 4844268d1cdae0d0f50ac7d9a9d0bab57e8215da (diff) | |
download | openttd-80fc5fb46c306b23ef9fb4ffc3cf201133092b9d.tar.xz |
Change: [OSX] Allow touchbar usage on all supported OS versions.
Touchbar support was introduced in 10.12.2. There's no need to limit
support to 10.15+, as the convenience class NSButtonTouchBarItem is
easily replicated.
Diffstat (limited to 'src/video/cocoa/cocoa_wnd.h')
-rw-r--r-- | src/video/cocoa/cocoa_wnd.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/video/cocoa/cocoa_wnd.h b/src/video/cocoa/cocoa_wnd.h index 0b5c51b99..d0c946067 100644 --- a/src/video/cocoa/cocoa_wnd.h +++ b/src/video/cocoa/cocoa_wnd.h @@ -14,6 +14,10 @@ #include "toolbar_gui.h" #include "table/sprites.h" +#ifdef MAC_OS_X_VERSION_10_12_2 +# define HAVE_TOUCHBAR_SUPPORT +#endif + class VideoDriver_Cocoa; /* Right Mouse Button Emulation enum */ @@ -30,7 +34,7 @@ extern NSString *OTTDMainLaunchGameEngine; + (NSCursor *) clearCocoaCursor; @end -#ifdef HAVE_OSX_1015_SDK +#ifdef HAVE_TOUCHBAR_SUPPORT /* 9 items can be displayed on the touch bar when using default buttons. */ static NSArray *touchBarButtonIdentifiers = @[ @"openttd.pause", @@ -83,12 +87,11 @@ static NSDictionary *touchBarFallbackText = @{ #endif /** Subclass of NSWindow to cater our special needs */ -#ifdef HAVE_OSX_1015_SDK -@interface OTTD_CocoaWindow : NSWindow <NSTouchBarDelegate> -@property (strong) NSSet *touchbarItems; -- (NSImage*)generateImage:(int)spriteId; -#else @interface OTTD_CocoaWindow : NSWindow +#ifdef HAVE_TOUCHBAR_SUPPORT + <NSTouchBarDelegate> + +- (NSImage *)generateImage:(int)spriteId; #endif - (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag driver:(VideoDriver_Cocoa *)drv; |