Skip to content

Commit

Permalink
feat: Use updated minimal NSColorWell style for Groups. (#5016)
Browse files Browse the repository at this point in the history
* feat: Use updated minimal NSColorWell style for Groups.

Only on macOS Ventura (13.0+), as AppKit changes were introduced here.

Somewhat fixes #5011

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
  • Loading branch information
nevack committed Feb 27, 2023
1 parent dcc1d14 commit 4430f72
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions macosx/CocoaCompatibility.h
Expand Up @@ -37,4 +37,17 @@ typedef NS_ENUM(NSInteger, NSTableViewStyle) {

#endif

// Compatibility declarations to build `@available(macOS 13.0, *)` code with older Xcode 11.3.1 (the last 32-bit OS compatible Xcode)
#ifndef __MAC_13_0

typedef NS_ENUM(NSInteger, NSColorWellStyle) {
NSColorWellStyleMinimal = 1,
} API_AVAILABLE(macos(13.0));

@interface NSColorWell ()
@property(assign) NSColorWellStyle colorWellStyle API_AVAILABLE(macos(13.0));
@end

#endif

NS_ASSUME_NONNULL_END
7 changes: 7 additions & 0 deletions macosx/GroupsPrefsController.mm
Expand Up @@ -2,6 +2,8 @@
// It may be used under the MIT (SPDX: MIT) license.
// License text can be found in the licenses/ folder.

#import "CocoaCompatibility.h"

#import "GroupsPrefsController.h"
#import "GroupsController.h"
#import "ExpandedPathToPathTransformer.h"
Expand Down Expand Up @@ -41,6 +43,11 @@ - (void)awakeFromNib

[self.fSelectedColorView addObserver:self forKeyPath:@"color" options:0 context:NULL];

if (@available(macOS 13.0, *))
{
self.fSelectedColorView.colorWellStyle = NSColorWellStyleMinimal;
}

[self updateSelectedGroup];
}

Expand Down

0 comments on commit 4430f72

Please sign in to comment.