Revision: 29165
http://sourceforge.net/p/bibdesk/svn/29165
Author: hofman
Date: 2025-04-22 09:34:57 +0000 (Tue, 22 Apr 2025)
Log Message:
-----------
Draw unbordered dynamic selection highlight only for system background colors
on 10.10+
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2025-04-21
15:53:35 UTC (rev 29164)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2025-04-22
09:34:57 UTC (rev 29165)
@@ -232,6 +232,7 @@
unsigned int scheduledEndFastScroling:1;
unsigned int updatingFromSlider:1;
unsigned int needsReload:1;
+ unsigned int unborderedHighlight:1;
unsigned int controllingSharedPreviewer:1;
unsigned int controllingQLPreviewPanel:1;
} _fvFlags;
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-21
15:53:35 UTC (rev 29164)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-22
09:34:57 UTC (rev 29165)
@@ -363,6 +363,7 @@
_rubberBandView = nil;
_fvFlags.isMouseDown = NO;
_fvFlags.isEditable = NO;
+ _fvFlags.unborderedHighlight = floor(NSAppKitVersionNumber) >
NSAppKitVersionNumber10_9;
[self setBackgroundColor:[[self class] defaultBackgroundColor]];
_selectionOverlay = NULL;
_numberOfColumns = 1;
@@ -494,6 +495,16 @@
#pragma mark API
+static inline BOOL _allowsUnborderedHighlight(NSColor *color) {
+ if (color == nil)
+ return YES;
+ if ([[color colorSpaceName] isEqualToString:NSNamedColorSpace] == NO ||
[[color catalogNameComponent] isEqualToString:@"System"] == NO)
+ return NO;
+ if ([[color colorNameComponent] hasSuffix:@"BackgroundColor"] || [[color
colorNameComponent] hasSuffix:@"RowColor"])
+ return YES;
+ return NO;
+}
+
- (void)setBackgroundColor:(NSColor *)aColor;
{
if (_backgroundColor != aColor) {
@@ -505,6 +516,11 @@
}
_backgroundColor = [aColor copy];
[_backgroundView setBackgroundColor:_backgroundColor];
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_9) {
+ _fvFlags.unborderedHighlight =
_allowsUnborderedHighlight(_backgroundColor);
+ CGLayerRelease(_selectionOverlay);
+ _selectionOverlay = NULL;
+ }
}
}
@@ -2176,9 +2192,9 @@
[nsContext saveGraphicsState];
// @@ Dark mode
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_9) {
+ if (_fvFlags.unborderedHighlight) {
// [NSAppearance currentAppearance] should alwaye be [self
effectiveAppearance] here
- NSColor *fillColor = [[NSColor controlTextColor]
colorWithAlphaComponent:0.15];
+ NSColor *fillColor = [[NSColor textColor]
colorWithAlphaComponent:32.0 / 255.0];
NSBezierPath *p = [NSBezierPath
bezierPathWithRoundedRect:imageRect xRadius:6.0 yRadius:6.0];
[fillColor setFill];
[p fill];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit