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 635608 - st-icon: Add support for -st-shadow property
st-icon: Add support for -st-shadow property
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-11-23 13:26 UTC by Florian Müllner
Modified: 2010-11-25 04:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
st-icon: Add support for -st-shadow property (3.68 KB, patch)
2010-11-23 13:26 UTC, Florian Müllner
needs-work Details | Review
st-icon: Add support for -st-shadow property (4.30 KB, patch)
2010-11-24 12:44 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2010-11-23 13:26:06 UTC
See attached patch.
Comment 1 Florian Müllner 2010-11-23 13:26:09 UTC
Created attachment 175105 [details] [review]
st-icon: Add support for -st-shadow property

Add a drop shadow to the icon texture if the -st-shadow property is
specified.
Comment 2 Florian Müllner 2010-11-23 13:27:42 UTC
This will be used by the drop target to remove favorites.
Comment 3 Owen Taylor 2010-11-23 21:54:48 UTC
Review of attachment 175105 [details] [review]:

Isn't this racy? If the icon image has to be loaded asynchronously, then wouldn't it be possible that we create the shadow material before the icon is loaded, and then not update it on load?
Comment 4 Florian Müllner 2010-11-24 12:44:40 UTC
Created attachment 175162 [details] [review]
st-icon: Add support for -st-shadow property

Update shadow when the underlying pixbuf changes.
Comment 5 Owen Taylor 2010-11-25 04:19:37 UTC
Review of attachment 175162 [details] [review]:

Two style points (ok to commit with those fixed), and one discussion of efficiency that isn't a blocker

::: src/st/st-icon.c
@@ +367,3 @@
+
+static void
+update_shadow_material (StIcon *icon)

This matches our normal conventions of not namespacing static functions but doesn't match the surrounding code - st_icon_update_size() vs. update_shadow_material() - which I generally consider more important.

@@ +440,3 @@
   if (priv->icon_texture)
+    {
+      update_shadow_material (icon);

Shadowing the 1x1 empty Cogl texture that the material starts off with is actually pretty of expensive ... the set up we have to do to read a texture is extensive even if we don't read many bytes. You could leave it lazy as it was before and make on_pixbuf_change() only null out the cached shadow material but async load completions usually run *after* we've painted a frame, so doesn't really help. Other than the gross hack of saying that 1x1 images don't have a shadow, this may not be fixable until we git rid of the ClutterTexture actor and have StTextureCache know about StIcon directly.

[ as opposed to lazy at paint time some advantages to computing the shadows before the frame - see the discussion at the end of http://bugzilla.clutter-project.org/show_bug.cgi?id=2414 ]

@@ +442,3 @@
+      update_shadow_material (icon);
+      clutter_actor_set_parent (priv->icon_texture, CLUTTER_ACTOR (icon));
+      g_signal_connect (priv->icon_texture, "pixbuf-change",

Might be a good to add a note here that pixbuf-changed is a misnomer for texture-changed so the reader isn't confused (see comment in clutter-texture.c:

  /* rename signal */
  g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0);

)
Comment 6 Florian Müllner 2010-11-25 04:43:25 UTC
Attachment 175162 [details] pushed as 4f7a288 - st-icon: Add support for -st-shadow property