|
@@ -274,6 +274,28 @@ struct Converter<electron::NativeWindowMac::TitleBarStyle> {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+template <>
|
|
|
+struct Converter<electron::NativeWindowMac::VisualEffectState> {
|
|
|
+ static bool FromV8(v8::Isolate* isolate,
|
|
|
+ v8::Handle<v8::Value> val,
|
|
|
+ electron::NativeWindowMac::VisualEffectState* out) {
|
|
|
+ using VisualEffectState = electron::NativeWindowMac::VisualEffectState;
|
|
|
+ std::string visual_effect_state;
|
|
|
+ if (!ConvertFromV8(isolate, val, &visual_effect_state))
|
|
|
+ return false;
|
|
|
+ if (visual_effect_state == "followWindow") {
|
|
|
+ *out = VisualEffectState::FOLLOW_WINDOW;
|
|
|
+ } else if (visual_effect_state == "active") {
|
|
|
+ *out = VisualEffectState::ACTIVE;
|
|
|
+ } else if (visual_effect_state == "inactive") {
|
|
|
+ *out = VisualEffectState::INACTIVE;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
} // namespace gin
|
|
|
|
|
|
namespace electron {
|
|
@@ -344,6 +366,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
|
|
|
options.Get(options::kFullscreenWindowTitle, &fullscreen_window_title_);
|
|
|
options.Get(options::kSimpleFullScreen, &always_simple_fullscreen_);
|
|
|
options.Get(options::kTrafficLightPosition, &traffic_light_position_);
|
|
|
+ options.Get(options::kVisualEffectState, &visual_effect_state_);
|
|
|
|
|
|
bool minimizable = true;
|
|
|
options.Get(options::kMinimizable, &minimizable);
|
|
@@ -1451,7 +1474,14 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
|
|
|
|
|
[effect_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
|
|
[effect_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
|
|
|
- [effect_view setState:NSVisualEffectStateFollowsWindowActiveState];
|
|
|
+
|
|
|
+ if (visual_effect_state_ == VisualEffectState::ACTIVE) {
|
|
|
+ [effect_view setState:NSVisualEffectStateActive];
|
|
|
+ } else if (visual_effect_state_ == VisualEffectState::INACTIVE) {
|
|
|
+ [effect_view setState:NSVisualEffectStateInactive];
|
|
|
+ } else {
|
|
|
+ [effect_view setState:NSVisualEffectStateFollowsWindowActiveState];
|
|
|
+ }
|
|
|
|
|
|
// Make frameless Vibrant windows have rounded corners.
|
|
|
if (!has_frame() && !is_modal()) {
|