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 632818 - style-changed not always emitted when widget is first styled
style-changed not always emitted when widget is first styled
Status: RESOLVED OBSOLETE
Product: gnome-shell
Classification: Core
Component: st
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-10-21 18:59 UTC by Dan Winship
Modified: 2021-07-05 14:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
demonstrate the bug (1.29 KB, text/plain)
2010-10-21 18:59 UTC, Dan Winship
  Details
StIcon: force icon_size to be updated before computing size (1.62 KB, patch)
2011-03-31 20:04 UTC, Owen Taylor
none Details | Review

Description Dan Winship 2010-10-21 18:59:07 UTC
Applying the attached patch shows that the appwell icongrid gets
allocated without emitting style-changed, which is bad for code
that assumes it can read CSS values at style-changed time, and then
use those cached values for size request/allocation.
Comment 1 Dan Winship 2010-10-21 18:59:10 UTC
Created attachment 172952 [details]
demonstrate the bug
Comment 2 Owen Taylor 2010-10-21 19:04:12 UTC
The patch in https://bugzilla.gnome.org/show_bug.cgi?id=627083#c9 makes that *never* the case (for a big performance win) and has a set of fixes for at least some of the problems.
Comment 3 Owen Taylor 2010-10-21 19:07:23 UTC
Comment on attachment 172952 [details]
demonstrate the bug

Not a real patch
Comment 4 Dan Winship 2010-12-15 10:20:18 UTC
Comment on attachment 172952 [details]
demonstrate the bug

(clear patch flag)
Comment 5 Owen Taylor 2011-03-31 20:01:30 UTC
A little more detail here about emission of ::style-changed - not sure if it's the same issue or not - but things are particularly troublesome if we request the size of an unmapped widget.

We have two separate states in StWidget:

 priv->theme_node == NULL
 widget->priv->is_style_dirty = TRUE

If you have an unmapped widget with a dirty style, then calling st_widget_get_theme_node() on it causes priv->theme_node to be set, but:

 ::style-changed is not emitted
 widget->priv->is_style_dirty is left TRUE

When the widget is mapped, then we emit ::style-changed at that point and clear the is_style_dirty flag. This may actually be about as good as we can do, but it causes some bugs.

In particular, for StIcon, if you get call clutter_actor_get_preferred_size() on an unmapped widget, the icon_size field which is computed in style_changed is not updated so we don't request the correct size.
Comment 6 Owen Taylor 2011-03-31 20:04:13 UTC
Created attachment 184817 [details] [review]
StIcon: force icon_size to be updated before computing size

Here's a workaround for StIcon. Not immediately needed (was easier
to just map stuff first), but attaching it here for future reference.

===

::style-changed isn't normally emitted for unmapped widgets;
calling st_widget_ensure_style() forces this so that
priv->icon_size is correct before we compute the size.
Comment 7 Dan Winship 2011-04-01 11:40:34 UTC
Comment on attachment 184817 [details] [review]
StIcon: force icon_size to be updated before computing size

Well... I'm glad you have a simpler patch in bug 645949, because I don't like this one. :-)

A better version of the same idea might be to call ensure_style() from st_widget_queue_relayout()? That would also fix the original IconGrid bug.

It definitely seems weird that sometimes we update priv->theme_node without emitting style-changed.
Comment 8 Jasper St. Pierre (not reading bugmail) 2011-10-20 19:36:06 UTC
Is this still an issue?
Comment 9 Dan Winship 2015-01-27 14:01:52 UTC
(In reply to comment #8)
> Is this still an issue?

no idea.

(un-NEEDINFO-ing to (a) get it off my bugzilla user info page, and (b) get it back into queries where someone who knows the answer might actually end up seeing at it)
Comment 10 GNOME Infrastructure Team 2021-07-05 14:14:12 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of  gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/

Thank you for your understanding and your help.