forked from mirrors/gecko-dev
Bug 1888781 - Allow using behind-window titlebar transparency behind a pref. r=mstange,mac-reviewers
UX initially pointed to https://github.com/zvuc/firefox-macos-native-tabbar/ which uses this kind of effect. That's not the correct material but seems trivial to provide it for experimentation purposes. Differential Revision: https://phabricator.services.mozilla.com/D206186
This commit is contained in:
parent
b030490379
commit
57f0f6ee6d
2 changed files with 20 additions and 3 deletions
|
|
@ -16000,6 +16000,11 @@
|
|||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
- name: widget.macos.titlebar-blend-mode.behind-window
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
#endif
|
||||
|
||||
# Whether native GTK global menubar support is enabled.
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#import <objc/message.h>
|
||||
|
||||
#include "nsChildView.h"
|
||||
#include "mozilla/StaticPrefs_widget.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
@ -48,6 +49,19 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
|
|||
}
|
||||
}
|
||||
|
||||
static NSVisualEffectBlendingMode VisualEffectBlendingModeForVibrancyType(
|
||||
VibrancyType aType) {
|
||||
switch (aType) {
|
||||
case VibrancyType::TOOLTIP:
|
||||
case VibrancyType::MENU:
|
||||
return NSVisualEffectBlendingModeBehindWindow;
|
||||
case VibrancyType::TITLEBAR:
|
||||
return StaticPrefs::widget_macos_titlebar_blend_mode_behind_window()
|
||||
? NSVisualEffectBlendingModeBehindWindow
|
||||
: NSVisualEffectBlendingModeWithinWindow;
|
||||
}
|
||||
}
|
||||
|
||||
@implementation MOZVibrantView
|
||||
|
||||
- (instancetype)initWithFrame:(NSRect)aRect vibrancyType:(VibrancyType)aType {
|
||||
|
|
@ -57,10 +71,8 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
|
|||
self.appearance = nil;
|
||||
self.state = VisualEffectStateForVibrancyType(mType);
|
||||
self.material = VisualEffectMaterialForVibrancyType(mType);
|
||||
self.blendingMode = VisualEffectBlendingModeForVibrancyType(mType);
|
||||
self.emphasized = NO;
|
||||
self.blendingMode = aType == VibrancyType::TITLEBAR
|
||||
? NSVisualEffectBlendingModeWithinWindow
|
||||
: NSVisualEffectBlendingModeBehindWindow;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue