Revision: 13754
http://sourceforge.net/p/skim-app/code/13754
Author: hofman
Date: 2023-11-12 18:15:46 +0000 (Sun, 12 Nov 2023)
Log Message:
-----------
run with light appearance in place
Modified Paths:
--------------
trunk/NSColor_SKExtensions.m
trunk/NSGraphics_SKExtensions.h
trunk/NSGraphics_SKExtensions.m
Modified: trunk/NSColor_SKExtensions.m
===================================================================
--- trunk/NSColor_SKExtensions.m 2023-11-12 18:03:24 UTC (rev 13753)
+++ trunk/NSColor_SKExtensions.m 2023-11-12 18:15:46 UTC (rev 13754)
@@ -52,19 +52,26 @@
static NSColor *inactiveSelectionHighlightInteriorColor = nil;
+ (void)handleSystemColorsDidChange:(NSNotification *)notification {
- __block NSColor *activeOut = nil;
- __block NSColor *inactiveOut = nil;
- __block NSColor *activeIn = nil;
- __block NSColor *inactiveIn = nil;
- NSColorSpace *colorSpace = [NSColorSpace genericRGBColorSpace];
- if (@available(macOS 10.14, *))
- colorSpace = [NSColorSpace sRGBColorSpace];
- SKRunWithLightAppearance(^{
+ NSColor *activeOut = nil;
+ NSColor *inactiveOut = nil;
+ NSColor *activeIn = nil;
+ NSColor *inactiveIn = nil;
+ if (@available(macOS 10.14, *)) {
+ NSColorSpace *colorSpace = [NSColorSpace sRGBColorSpace];
+ NSAppearance *appearance = [[[NSAppearance currentAppearance] retain]
autorelease];
+ [NSAppearance setCurrentAppearance:[NSAppearance
appearanceNamed:NSAppearanceNameAqua]];
activeOut = [[NSColor alternateSelectedControlColor]
colorUsingColorSpace:colorSpace];
inactiveOut = [[NSColor grayColor] colorUsingColorSpace:colorSpace];
activeIn = [[[[NSColor alternateSelectedControlColor]
colorUsingColorSpace:colorSpace] highlightWithLevel:0.66667]
colorWithAlphaComponent:0.8];
inactiveIn = [[[NSColor secondarySelectedControlColor]
colorUsingColorSpace:colorSpace] colorWithAlphaComponent:0.8];
- });
+ [NSAppearance setCurrentAppearance:appearance];
+ } else {
+ NSColorSpace *colorSpace = [NSColorSpace genericRGBColorSpace];
+ activeOut = [[NSColor alternateSelectedControlColor]
colorUsingColorSpace:colorSpace];
+ inactiveOut = [[NSColor grayColor] colorUsingColorSpace:colorSpace];
+ activeIn = [[[[NSColor alternateSelectedControlColor]
colorUsingColorSpace:colorSpace] highlightWithLevel:0.66667]
colorWithAlphaComponent:0.8];
+ inactiveIn = [[[NSColor secondarySelectedControlColor]
colorUsingColorSpace:colorSpace] colorWithAlphaComponent:0.8];
+ }
@synchronized (self) {
[activeSelectionHighlightColor release];
activeSelectionHighlightColor = [activeOut retain];
Modified: trunk/NSGraphics_SKExtensions.h
===================================================================
--- trunk/NSGraphics_SKExtensions.h 2023-11-12 18:03:24 UTC (rev 13753)
+++ trunk/NSGraphics_SKExtensions.h 2023-11-12 18:15:46 UTC (rev 13754)
@@ -41,7 +41,6 @@
extern BOOL SKHasDarkAppearance(void);
extern void SKRunWithAppearance(id object, void (^code)(void));
-extern void SKRunWithLightAppearance(void (^code)(void));
#pragma mark -
Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m 2023-11-12 18:03:24 UTC (rev 13753)
+++ trunk/NSGraphics_SKExtensions.m 2023-11-12 18:15:46 UTC (rev 13754)
@@ -64,23 +64,20 @@
}
void SKRunWithAppearance(id object, void (^code)(void)) {
- NSAppearance *appearance = nil;
- if ([object respondsToSelector:@selector(effectiveAppearance)]) {
- appearance = [[[NSAppearance currentAppearance] retain] autorelease];
- [NSAppearance
setCurrentAppearance:[(id<NSAppearanceCustomization>)object
effectiveAppearance]];
+ if (@available(macOS 10.14, *)) {
+ NSAppearance *appearance = nil;
+ if ([object respondsToSelector:@selector(effectiveAppearance)]) {
+ appearance = [[[NSAppearance currentAppearance] retain]
autorelease];
+ [NSAppearance
setCurrentAppearance:[(id<NSAppearanceCustomization>)object
effectiveAppearance]];
+ }
+ code();
+ if ([object respondsToSelector:@selector(effectiveAppearance)])
+ [NSAppearance setCurrentAppearance:appearance];
+ } else {
+ code();
}
- code();
- if ([object respondsToSelector:@selector(effectiveAppearance)])
- [NSAppearance setCurrentAppearance:appearance];
}
-void SKRunWithLightAppearance(void (^code)(void)) {
- NSAppearance *appearance = [[[NSAppearance currentAppearance] retain]
autorelease];
- [NSAppearance setCurrentAppearance:[NSAppearance
appearanceNamed:NSAppearanceNameAqua]];
- code();
- [NSAppearance setCurrentAppearance:appearance];
-}
-
#pragma mark -
void SKSetColorsForResizeHandle(CGContextRef context, BOOL active)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit