Revision: 14152
          http://sourceforge.net/p/skim-app/code/14152
Author:   hofman
Date:     2024-03-27 17:08:19 +0000 (Wed, 27 Mar 2024)
Log Message:
-----------
Side window in presentation should have dark appearance. Make side window 
flatter on 11.0+.

Modified Paths:
--------------
    trunk/SKSideWindow.m

Modified: trunk/SKSideWindow.m
===================================================================
--- trunk/SKSideWindow.m        2024-03-27 16:45:39 UTC (rev 14151)
+++ trunk/SKSideWindow.m        2024-03-27 17:08:19 UTC (rev 14152)
@@ -95,7 +95,7 @@
             [contentView addSubview:backgroundView];
             [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(contentViewFrameChanged:) 
name:NSViewFrameDidChangeNotification object:contentView];
             [self contentViewFrameChanged:nil];
-            [self setAppearance:[NSAppearance 
appearanceNamed:NSAppearanceNameAqua]];
+            [self setAppearance:[NSAppearance 
appearanceNamed:NSAppearanceNameDarkAqua]];
         } else {
             [self setContentView:backgroundView];
         }
@@ -227,12 +227,9 @@
     NSRect topRect = SKSliceRect(rect, CORNER_RADIUS, NSMaxYEdge);
     NSRect bottomRect = SKSliceRect(rect, CORNER_RADIUS, NSMinYEdge);
     NSSize offset = NSZeroSize;
-    NSPoint startPoint, endPoint;
     NSBezierPath *path = [NSBezierPath bezierPathWithRect:rect];
     NSColor *backgroundColor = [NSColor windowBackgroundColor];
     CGFloat gray = [[[NSColor secondarySelectedControlColor] 
colorUsingColorSpaceName:NSDeviceWhiteColorSpace] whiteComponent];
-    NSColor *topShadeColor = [NSColor colorWithDeviceWhite:1.0 alpha:0.5];
-    NSColor *bottomShadeColor = [NSColor colorWithDeviceWhite:0.0 alpha:0.5];
     NSColor *handleColor = [NSColor colorWithDeviceWhite:fmax(0.0, gray - 0.3) 
alpha:1.0];
     NSColor *handleShadeColor = [NSColor colorWithDeviceWhite:fmin(1.0, gray + 
0.1) alpha:1.0];
 
@@ -246,27 +243,32 @@
         [path fill];
     }
     
-    offset.width = NSWidth(rect) + 6.0;
-    rect.origin.x -= offset.width;
-    path = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, -2.0, 
0.0) xRadius:CORNER_RADIUS + 2.0 yRadius:CORNER_RADIUS];
-    [path appendBezierPathWithRect:NSInsetRect(rect, -4.0 , -2.0)];
-    [path setWindingRule:NSEvenOddWindingRule];
+    if (@available(macOS 11.0, *)) {
+        NSColor *topShadeColor = [NSColor colorWithDeviceWhite:1.0 alpha:0.5];
+        NSColor *bottomShadeColor = [NSColor colorWithDeviceWhite:0.0 
alpha:0.5];
+        
+        offset.width = NSWidth(rect) + 6.0;
+        rect.origin.x -= offset.width;
+        path = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, -2.0, 
0.0) xRadius:CORNER_RADIUS + 2.0 yRadius:CORNER_RADIUS];
+        [path appendBezierPathWithRect:NSInsetRect(rect, -4.0 , -2.0)];
+        [path setWindingRule:NSEvenOddWindingRule];
+        
+        [NSGraphicsContext saveGraphicsState];
+        [[NSBezierPath bezierPathWithRect:topRect] addClip];
+        [NSShadow setShadowWithColor:topShadeColor  blurRadius:2.0 
offset:offset];
+        [path fill];
+        [NSGraphicsContext restoreGraphicsState];
+        
+        [NSGraphicsContext saveGraphicsState];
+        [[NSBezierPath bezierPathWithRect:bottomRect] addClip];
+        [NSShadow setShadowWithColor:bottomShadeColor blurRadius:2.0 
offset:offset];
+        [path fill];
+        [NSGraphicsContext restoreGraphicsState];
+    }
     
-    [NSGraphicsContext saveGraphicsState];
-    [[NSBezierPath bezierPathWithRect:topRect] addClip];
-    [NSShadow setShadowWithColor:topShadeColor  blurRadius:2.0 offset:offset];
-    [path fill];
-    [NSGraphicsContext restoreGraphicsState];
-    
-    [NSGraphicsContext saveGraphicsState];
-    [[NSBezierPath bezierPathWithRect:bottomRect] addClip];
-    [NSShadow setShadowWithColor:bottomShadeColor blurRadius:2.0 
offset:offset];
-    [path fill];
-    [NSGraphicsContext restoreGraphicsState];
-    
     rect = [self resizeHandleRect];
-    startPoint = NSMakePoint(NSMidX(rect) - 1.5, NSMidY(rect) - 10.0);
-    endPoint = NSMakePoint(startPoint.x, startPoint.y + 20.0);
+    NSPoint startPoint = NSMakePoint(NSMidX(rect) - 1.5, NSMidY(rect) - 10.0);
+    NSPoint endPoint = NSMakePoint(startPoint.x, startPoint.y + 20.0);
     offset.width = 1.0;
     [NSBezierPath setDefaultLineWidth:1.0];
     [handleColor set];

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