@zakim24/electron-liquid-glass 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/src/glass_effect.mm
CHANGED
|
@@ -123,21 +123,30 @@ extern "C" int AddGlassEffectView(unsigned char *buffer, bool opaque) {
|
|
|
123
123
|
// Ensure autoresize if we created a private glass view too
|
|
124
124
|
glass.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
125
125
|
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (backgroundView && [backgroundView respondsToSelector:@selector(setIgnoresMouseEvents:)]) {
|
|
133
|
-
[(id)backgroundView setIgnoresMouseEvents:YES];
|
|
134
|
-
}
|
|
126
|
+
// Make the glass view click-through by setting it to not accept any mouse events
|
|
127
|
+
// NSView doesn't have setIgnoresMouseEvents, so we use layer properties
|
|
128
|
+
glass.wantsLayer = YES;
|
|
129
|
+
|
|
130
|
+
// Get the first existing subview to position our glass behind it
|
|
131
|
+
NSView *firstSubview = container.subviews.firstObject;
|
|
135
132
|
|
|
136
|
-
// Add the glass view (positioned
|
|
133
|
+
// Add the glass view (positioned BELOW all existing content to not block events)
|
|
137
134
|
if (opaque && backgroundView) {
|
|
138
|
-
|
|
135
|
+
// Background at very bottom, glass above it, content on top
|
|
136
|
+
if (firstSubview) {
|
|
137
|
+
[container addSubview:backgroundView positioned:NSWindowBelow relativeTo:firstSubview];
|
|
138
|
+
[container addSubview:glass positioned:NSWindowAbove relativeTo:backgroundView];
|
|
139
|
+
} else {
|
|
140
|
+
[container addSubview:backgroundView positioned:NSWindowBelow relativeTo:nil];
|
|
141
|
+
[container addSubview:glass positioned:NSWindowAbove relativeTo:backgroundView];
|
|
142
|
+
}
|
|
139
143
|
} else {
|
|
140
|
-
|
|
144
|
+
// Glass at very bottom, content on top
|
|
145
|
+
if (firstSubview) {
|
|
146
|
+
[container addSubview:glass positioned:NSWindowBelow relativeTo:firstSubview];
|
|
147
|
+
} else {
|
|
148
|
+
[container addSubview:glass positioned:NSWindowBelow relativeTo:nil];
|
|
149
|
+
}
|
|
141
150
|
}
|
|
142
151
|
|
|
143
152
|
// Associate views with the container for cleanup
|