mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187680 - Use NSVisualEffectMaterialMenu for menus if it's available. r=smichaud
This commit is contained in:
parent
896db90d77
commit
ab3367af7c
@ -211,6 +211,12 @@ enum {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_11) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11
|
||||
enum {
|
||||
NSVisualEffectMaterialMenu = 5
|
||||
};
|
||||
#endif
|
||||
|
||||
static NSUInteger
|
||||
VisualEffectStateForVibrancyType(VibrancyType aType)
|
||||
{
|
||||
@ -263,13 +269,14 @@ VibrancyManager::CreateEffectView(VibrancyType aType, NSRect aRect)
|
||||
[effectView setState:VisualEffectStateForVibrancyType(aType)];
|
||||
|
||||
if (aType == VibrancyType::MENU) {
|
||||
// NSVisualEffectMaterialTitlebar doesn't match the native menu look
|
||||
// perfectly but comes pretty close. Ideally we'd use a material with
|
||||
// materialTypeName "MacLight", since that's what menus use, but there's
|
||||
// no entry with that material in the internalMaterialType-to-
|
||||
// CGSWindowBackdropViewSpec table which NSVisualEffectView consults when
|
||||
// setting up the effect.
|
||||
[effectView setMaterial:NSVisualEffectMaterialTitlebar];
|
||||
if (nsCocoaFeatures::OnElCapitanOrLater()) {
|
||||
[effectView setMaterial:NSVisualEffectMaterialMenu];
|
||||
} else {
|
||||
// Before 10.11 there is no material that perfectly matches the menu
|
||||
// look. Of all available material types, NSVisualEffectMaterialTitlebar
|
||||
// is the one that comes closest.
|
||||
[effectView setMaterial:NSVisualEffectMaterialTitlebar];
|
||||
}
|
||||
} else if (aType == VibrancyType::HIGHLIGHTED_MENUITEM) {
|
||||
[effectView setMaterial:NSVisualEffectMaterialMenuItem];
|
||||
if ([effectView respondsToSelector:@selector(setEmphasized:)]) {
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
static bool OnMountainLionOrLater();
|
||||
static bool OnMavericksOrLater();
|
||||
static bool OnYosemiteOrLater();
|
||||
static bool OnElCapitanOrLater();
|
||||
static bool AccelerateByDefault();
|
||||
|
||||
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define MAC_OS_X_VERSION_10_8_HEX 0x00001080
|
||||
#define MAC_OS_X_VERSION_10_9_HEX 0x00001090
|
||||
#define MAC_OS_X_VERSION_10_10_HEX 0x000010A0
|
||||
#define MAC_OS_X_VERSION_10_11_HEX 0x000010B0
|
||||
|
||||
#include "nsCocoaFeatures.h"
|
||||
#include "nsCocoaUtils.h"
|
||||
@ -172,6 +173,12 @@ nsCocoaFeatures::OnYosemiteOrLater()
|
||||
return (OSXVersion() >= MAC_OS_X_VERSION_10_10_HEX);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsCocoaFeatures::OnElCapitanOrLater()
|
||||
{
|
||||
return (OSXVersion() >= MAC_OS_X_VERSION_10_11_HEX);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsCocoaFeatures::AccelerateByDefault()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user