Closed Bug 1170312 Opened 8 years ago Closed 5 years ago

Menus on Yosemite Seem to Sample the Desktop Background and the Firefox Window

Categories

(Core :: Widget: Cocoa, defect, P3)

All
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: shorlander, Assigned: mstange)

Details

Attachments

(4 files)

On Yosemite I have noticed that the background blur on context menus seems to be pulling from the desktop background image and from Firefox window and combining them.

It should sample whatever is directly underneath it.

I also noticed this when right-clicking on items in the Finder, but not anywhere else.

Attaching a screenshot but it's hard to illustrate the problem because the blur effect is so severe.
Attached image More Examples
More examples, my desktop background is magenta in those screenshots.
Summary: Menus on Yosemite Seem to be Sample the Desktop Background and the Firefox Window → Menus on Yosemite Seem to Sample the Desktop Background and the Firefox Window
Flags: needinfo?(mstange)
Oh dear. It looks like NSVisualEffectMaterialTitlebar isn't a good choice for menus after all. I think NSVisualEffectMaterialLight doesn't sample from the background, so we could use that instead, but its vibrancy is much more subtle than the one regular menus use.

See also https://dxr.mozilla.org/mozilla-central/source/widget/cocoa/VibrancyManager.mm#266-272
Flags: needinfo?(mstange)
We can fix this on 10.11 (Apple exposed the correct vibrancy material). There's a patch in bug 1187680 that does it.
(In reply to Markus Stange [:mstange] from comment #4)
> We can fix this on 10.11 (Apple exposed the correct vibrancy material).
> There's a patch in bug 1187680 that does it.

That's awesome, thank you!
Hmm, I would have expected bug 1187680 to fix it, but it really is still happening.
I spent all day trying to figure this out, and finally found the secret.

It's -[NSWindow _backdropBleedAmount]. We need to override it to return 0.
That's what _NSPopoverWindow does, for example.

For the longest time I was looking through CGSWindowBackdrop and friends, trying to find out whether the difference was something in the backdrop properties (which also have something called a backdropBleedFraction, but that's something different!). It turns out the window's backdrop bleed amount is communicated to the window server separately from the backdrop properties, through a call to  _NSSetWindowBackdropBackgroundBleed, for example from -[NSWindow _registerBackdropView:] or from -[NSPopoverFrame shapeWindow], and that's what determines how much the desktop wallpaper contributes to the backdrop appearance.
Assignee: nobody → mstange
Status: NEW → ASSIGNED
Component: XP Toolkit/Widgets: Menus → Widget: Cocoa
Priority: -- → P3
Comment on attachment 8953339 [details]
Bug 1170312 - Don't let the desktop background influence the vibrancy effect's backdrop for context menus.

https://reviewboard.mozilla.org/r/222620/#review228752

Should we request a public API from Apple for this?
Attachment #8953339 - Flags: review?(spohl.mozilla.bugs) → review+
The public API would be to use native context menus, native tooltips and native popovers.
Which we should really do at some point...
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/bb3669ec7191
Don't let the desktop background influence the vibrancy effect's backdrop for context menus. r=spohl
https://hg.mozilla.org/mozilla-central/rev/bb3669ec7191
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.