After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 731353 - stop putting shadows on menus
stop putting shadows on menus
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2014-06-07 02:24 UTC by Matthias Clasen
Modified: 2014-06-10 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
shadow-factor: Make sure to never use a negative spread (1.01 KB, patch)
2014-06-07 10:28 UTC, Florian Müllner
reviewed Details | Review
shadow-factory: Remove shadows from menus (1.18 KB, patch)
2014-06-07 10:28 UTC, Florian Müllner
needs-work Details | Review
meta-window-actor: Don't add shadows to popups if the toolkit already does (1.14 KB, patch)
2014-06-09 20:34 UTC, Florian Müllner
committed Details | Review
shadow-factory: Make sure to never use a negative spread (1.05 KB, patch)
2014-06-09 21:33 UTC, Florian Müllner
committed Details | Review

Description Matthias Clasen 2014-06-07 02:24:09 UTC
Bug 731187 has patches to make GTK+ use csd shadows for menus (as part of getting rid of the adwaita engine). That works best if mutter doesn't put its own shadows on menus.
Comment 1 Florian Müllner 2014-06-07 10:28:24 UTC
Created attachment 278080 [details] [review]
shadow-factor: Make sure to never use a negative spread

The smallest possible spread corresponds to an unblurred shadow, which
neither grows nor shrinks - thus the spread should be zero not negative
as returned by our current calculation.
Comment 2 Florian Müllner 2014-06-07 10:28:33 UTC
Created attachment 278081 [details] [review]
shadow-factory: Remove shadows from menus

GTK+ will add its own shadows client-side, so we don't need to anymore.
Comment 3 drago01 2014-06-09 10:52:37 UTC
(In reply to comment #2)
> Created an attachment (id=278081) [details] [review]
> shadow-factory: Remove shadows from menus
> 
> GTK+ will add its own shadows client-side, so we don't need to anymore.

What about non gtk applications? Having shadows or not based on which toolkit the application uses sounds wrong ...
Comment 4 Owen Taylor 2014-06-09 14:18:40 UTC
Agree with Adel - this needs to be coordinated with a property.
Comment 5 drago01 2014-06-09 16:15:33 UTC
Review of attachment 278081 [details] [review]:

See comment 3 and 4
Comment 6 Florian Müllner 2014-06-09 20:34:34 UTC
Created attachment 278163 [details] [review]
meta-window-actor: Don't add shadows to popups if the toolkit already does

GTK+ will add its own shadows client-side, so we don't need to anymore.

I haven't tested this at all with the GTK+ patches; I'm assuming that GTK+ will call gdk_window_set_shadow_width() for CSD override-redirect windows here - Matthias, is this asumption correct (or if not - sane enough to make it so)?
Comment 7 Matthias Clasen 2014-06-09 20:41:54 UTC
Yes, my patch treats csd o-r windows just the same as any other csd window.
They should have _GTK_FRAME_EXTENTS set.
Comment 8 Jasper St. Pierre (not reading bugmail) 2014-06-09 20:52:48 UTC
Review of attachment 278080 [details] [review]:

The only possible input that will make the return value negative is 0, right? Can we just explicitly test for 0 at the top?

Also, does this fix anything, or is it just a drive-by you noticed while debugging?
Comment 9 Jasper St. Pierre (not reading bugmail) 2014-06-09 20:54:27 UTC
Review of attachment 278163 [details] [review]:

::: src/compositor/meta-window-actor.c
@@ +751,3 @@
    */
+  if (priv->window->override_redirect &&
+      !priv->window->has_custom_frame_extents)

Can you use meta_window_is_client_decorated() so it works for Wayland clients as well?
Comment 10 Jasper St. Pierre (not reading bugmail) 2014-06-09 20:55:11 UTC
Review of attachment 278163 [details] [review]:

Also, I should point out, this will break shadows on clients that use GTK+ 3.10 or 3.12 with mutter 3.14, but maybe that just isn't that big of an issue to care about.
Comment 11 Florian Müllner 2014-06-09 21:29:19 UTC
(In reply to comment #8)
> Review of attachment 278080 [details] [review]:
> 
> The only possible input that will make the return value negative is 0, right?

Yes.


> Can we just explicitly test for 0 at the top?


Sure.


> Also, does this fix anything, or is it just a drive-by you noticed while
> debugging?

It prevents hitting an assertion failure when using a blur radius of 0, so not just cosmetics.


(In reply to comment #9)
> Can you use meta_window_is_client_decorated() so it works for Wayland clients
> as well?

I'm reluctant to do that - first, popups are not really decorated, so this is very much relying on the actual implementation of the method. Secondly, I'm not sure that the assumption that *all* toolkits will add shadows client-side to menus on wayland is correct, so maybe we need something else here? Also from a quick skimming, override_redirect should never be set for wayland surfaces?


(In reply to comment #10)
> Also, I should point out, this will break shadows on clients that use GTK+ 3.10
> or 3.12 with mutter 3.14

Why? As far as I see, GTK+ has not been setting frame extents for override-redirect windows before, so this should work just fine?
Comment 12 Florian Müllner 2014-06-09 21:33:05 UTC
Created attachment 278165 [details] [review]
shadow-factory: Make sure to never use a negative spread
Comment 13 Jasper St. Pierre (not reading bugmail) 2014-06-09 21:36:20 UTC
Review of attachment 278165 [details] [review]:

I'm a bit curious why we've never hit this before, but OK.
Comment 14 Jasper St. Pierre (not reading bugmail) 2014-06-09 21:42:07 UTC
(In reply to comment #11)
> I'm reluctant to do that - first, popups are not really decorated, so this is
> very much relying on the actual implementation of the method.

Yeah, this is why I'm not too fond of it. I think it would be better if the client explicitly marked it was drawing the shadow (_NET_WM_CLIENT_DRAWS=shadow or similar), but that opens up a whole can of worms about negotiation.

> Secondly, I'm not
> sure that the assumption that *all* toolkits will add shadows client-side to
> menus on wayland is correct, so maybe we need something else here? Also from a
> quick skimming, override_redirect should never be set for wayland surfaces?

Hm, yeah. Really, using override-redirect here is wrong, we should be paying attention to the window type and checking for WINDOW_TYPE_MENU, which meta-wayland-surface.c sets correctly. It's just luck that we're not hitting this on Wayland :)

I think we've decided by that we want all decorations to be done by the client, not by the client, and yes, that includes shadows, even for menus. Wayland surfaces are almost always ARGB32, which means we can't really construct a good shadow shape for them, so the client always has a better idea about what it should draw into its buffer.

Yes, we know it makes Owen angry because it's philosophically incorrect. :)

> (In reply to comment #10)
> Why? As far as I see, GTK+ has not been setting frame extents for
> override-redirect windows before, so this should work just fine?

Oh, I missed that.
Comment 15 Florian Müllner 2014-06-09 22:10:24 UTC
(In reply to comment #13)
> I'm a bit curious why we've never hit this before, but OK.

Apparently nobody tried to set a 0 blur radius before.


(In reply to comment #14)
> Hm, yeah. Really, using override-redirect here is wrong, we should be paying
> attention to the window type and checking for WINDOW_TYPE_MENU

WINDOW_DROPDOWN_MENU and WINDOW_POPUP_MENU. I'm not opposed to that, but note that this *is* a change with regard to the current behavior - we currently do add shadows to other OR windows like tooltips (they just don't have a dedicated shadow class like menus/popups/dropdowns).
Comment 16 Jasper St. Pierre (not reading bugmail) 2014-06-09 22:11:48 UTC
Yeah, I wasn't suggesting changing it, just saying that we shouldn't really ever be reading the "override-redirect" flag for things like this, only for making sure we don't ever raise / focus / move / resize such windows.
Comment 17 Florian Müllner 2014-06-10 11:47:54 UTC
Attachment 278163 [details] pushed as af3aae7 - meta-window-actor: Don't add shadows to popups if the toolkit already does
Attachment 278165 [details] pushed as 98e219d - shadow-factory: Make sure to never use a negative spread

I updated the comment to explicitly mention X11, and pushed - the wayland case already works as expected, as the condition covers a case where we *do* want to show server-side shadows: we never want to hit this in the wayland case, so the FALSE fallthrough at the end of the function is correct.