Revision: 12448
          http://sourceforge.net/p/skim-app/code/12448
Author:   hofman
Date:     2021-10-04 08:57:42 +0000 (Mon, 04 Oct 2021)
Log Message:
-----------
Just always use visual effect content view in image tooltip, it will be covered 
by the image when opaque, and changing the contentview removes the shadow from 
the window

Modified Paths:
--------------
    trunk/SKImageToolTipWindow.h
    trunk/SKImageToolTipWindow.m

Modified: trunk/SKImageToolTipWindow.h
===================================================================
--- trunk/SKImageToolTipWindow.h        2021-10-03 16:55:28 UTC (rev 12447)
+++ trunk/SKImageToolTipWindow.h        2021-10-04 08:57:42 UTC (rev 12448)
@@ -45,7 +45,6 @@
     id <SKImageToolTipContext> context;
     NSPoint point;
     CGFloat scale;
-    NSVisualEffectView *backgroundView;
 }
 
 + (id)sharedToolTipWindow;

Modified: trunk/SKImageToolTipWindow.m
===================================================================
--- trunk/SKImageToolTipWindow.m        2021-10-03 16:55:28 UTC (rev 12447)
+++ trunk/SKImageToolTipWindow.m        2021-10-04 08:57:42 UTC (rev 12448)
@@ -75,8 +75,8 @@
     if (self) {
         [self setHidesOnDeactivate:NO];
         [self setIgnoresMouseEvents:YES];
+        [self setBackgroundColor:[NSColor whiteColor]];
         [self setOpaque:YES];
-        [self setBackgroundColor:[NSColor whiteColor]];
         [self setHasShadow:YES];
         [self setLevel:WINDOW_LEVEL];
         [self setDefaultAlphaValue:ALPHA_VALUE];
@@ -86,6 +86,17 @@
         
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(orderOut:) 
                                                      
name:NSApplicationWillResignActiveNotification object:NSApp];
+        if (RUNNING_AFTER(10_13)) {
+            NSVisualEffectView *backgroundView = [[[NSVisualEffectView alloc] 
init] autorelease];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpartial-availability"
+            [backgroundView setMaterial:NSVisualEffectMaterialToolTip];
+#pragma clang diagnostic push
+            [backgroundView setState:NSVisualEffectStateActive];
+            [backgroundView setAutoresizingMask:NSViewWidthSizable | 
NSViewHeightSizable];
+            [self setContentView:backgroundView];
+        }
+
     }
     return self;
 }
@@ -113,28 +124,10 @@
         [self setBackgroundImage:image];
         
         if (RUNNING_AFTER(10_13)) {
-            if (isOpaque) {
-                if ([backgroundView window])
-                    [self setContentView:[[[NSView alloc] init] autorelease]];
-                if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKInvertColorsInDarkModeKey])
-                    [[self contentView] 
setContentFilters:SKColorInvertFilters()];
-                else
-                    [[self contentView] setContentFilters:[NSArray array]];
-            } else {
-                if ([backgroundView window] == nil) {
-                    if (backgroundView == nil) {
-                        backgroundView = [[NSVisualEffectView alloc] init];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
-                        [backgroundView 
setMaterial:NSVisualEffectMaterialToolTip];
-#pragma clang diagnostic push
-                        [backgroundView setState:NSVisualEffectStateActive];
-                        [backgroundView setAutoresizingMask:NSViewWidthSizable 
| NSViewHeightSizable];
-                        [self setOpaque:NO];
-                    }
-                    [self setContentView:backgroundView];
-                }
-            }
+            if (isOpaque && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKInvertColorsInDarkModeKey])
+                [[self contentView] setContentFilters:SKColorInvertFilters()];
+            else
+                [[self contentView] setContentFilters:[NSArray array]];
         } else if (isOpaque) {
             [self setBackgroundColor:[NSColor whiteColor]];
         } else {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to