Revision: 14383
          http://sourceforge.net/p/skim-app/code/14383
Author:   hofman
Date:     2024-07-17 16:14:20 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
use NSAppearance method when available

Modified Paths:
--------------
    trunk/NSGraphics_SKExtensions.m
    trunk/SKCompatibility.h

Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m     2024-07-17 09:31:08 UTC (rev 14382)
+++ trunk/NSGraphics_SKExtensions.m     2024-07-17 16:14:20 UTC (rev 14383)
@@ -62,7 +62,12 @@
 }
 
 void SKRunWithAppearance(id object, void (^code)(void)) {
-    if (@available(macOS 10.14, *)) {
+    if (@available(macOS 11.0, *)) {
+        if ([object respondsToSelector:@selector(effectiveAppearance)])
+            [[(id<NSAppearanceCustomization>)object effectiveAppearance] 
performAsCurrentDrawingAppearance:code];
+        else
+            code();
+    } else if (@available(macOS 10.14, *)) {
         NSAppearance *appearance = nil;
         if ([object respondsToSelector:@selector(effectiveAppearance)]) {
             appearance = [NSAppearance currentAppearance];

Modified: trunk/SKCompatibility.h
===================================================================
--- trunk/SKCompatibility.h     2024-07-17 09:31:08 UTC (rev 14382)
+++ trunk/SKCompatibility.h     2024-07-17 16:14:20 UTC (rev 14383)
@@ -96,4 +96,8 @@
 @property NSTableViewStyle style;
 @end
 
+@interface NSAppearance (SKBigSurDeclarations)
+- (void)performAsCurrentDrawingAppearance:(void (^)(void))block;
+@end
+
 #endif

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

Reply via email to