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 622450 - Add full CSS to StTooltip
Add full CSS to StTooltip
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Dan Winship
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-06-22 21:35 UTC by Giovanni Campagna
Modified: 2010-11-16 18:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to StTooltip (3.92 KB, patch)
2010-06-22 21:35 UTC, Giovanni Campagna
needs-work Details | Review
Rework to use StLabel instead of ClutterText (12.50 KB, patch)
2010-11-12 17:38 UTC, Giovanni Campagna
committed Details | Review
StTooltip: turn into an StBin (21.85 KB, patch)
2010-11-15 20:42 UTC, Giovanni Campagna
none Details | Review

Description Giovanni Campagna 2010-06-22 21:35:05 UTC
Created attachment 164357 [details] [review]
Patch to StTooltip

Currently StTooltip uses ClutterText directly internally, thus only a small subset of implemented CSS properties are recognized. In particular, tooltips get no background or border, which makes them impossible to read.
My patch corrects this by rewriting StTooltip as a simple container and sort-of-layout-manager for a StLabel.

(I also dropped that horrible bouncing from tooltips, but I suppose all that code should be rewritten to use the new St animation features)
Comment 1 Dan Winship 2010-07-13 16:58:16 UTC
Comment on attachment 164357 [details] [review]
Patch to StTooltip

This seems like a good plan, although looking at the patch, there is still plenty more oddness in StTooltip. Eg, it is a subclass of StBin, but its child label is not actually the StBin's child, and so StTooltip needs to reimplement all of the container-y methods itself.

It seems like maybe StTooltip should just be made a subclass of StLabel? (Unless we want to allow for the possibility of non-textual tooltips, in which case it should stay as an StBin, but have an StLabel child by default, with the label as a proper child of the bin.)

The current animation is just awful, yes. I'm not sure what the right default is, or how to make that stylable.
Comment 2 Dan Winship 2010-11-04 15:21:32 UTC
Comment on attachment 164357 [details] [review]
Patch to StTooltip

>+/*
> static void
> st_tooltip_style_changed (StWidget *self)

of course all the commented-out stuff should just be removed if it's no longer needed

>-  clutter_actor_animate (self, CLUTTER_EASE_OUT_ELASTIC,
>+  clutter_actor_animate (self, CLUTTER_EASE_OUT_SINE,

I think the right fix at this point is to just throw out the old animation code; we can use the new StThemeNode transition stuff if we want an animation now.


Also, as mentioned before, it should just make the label be its child, and then get_preferred_width, get_preferred_height, allocate, paint, map, unmap, and dispose can all go away.
Comment 3 Giovanni Campagna 2010-11-12 17:38:29 UTC
Created attachment 174341 [details] [review]
Rework to use StLabel instead of ClutterText

Replaces ClutterText with StLabel inside StTooltip, so full CSS
styling is supported.
Comment 4 Dan Winship 2010-11-15 16:39:34 UTC
Comment on attachment 174341 [details] [review]
Rework to use StLabel instead of ClutterText

(In reply to comment #2)
> Also, as mentioned before, it should just make the label be its child, and then
> get_preferred_width, get_preferred_height, allocate, paint, map, unmap, and
> dispose can all go away.

still not addressed.
Comment 5 Giovanni Campagna 2010-11-15 18:18:14 UTC
(In reply to comment #4)
> (From update of attachment 174341 [details] [review])
> (In reply to comment #2)
> > Also, as mentioned before, it should just make the label be its child, and then
> > get_preferred_width, get_preferred_height, allocate, paint, map, unmap, and
> > dispose can all go away.
> 
> still not addressed.

This was actually intended: a tooltip is not a generic container, it does not make sense to clutter_container_add to a tooltip, when it can handle only text labels.
Thinking twice, it may make sense instead (with some modifications to StWidget to handle the most common cases).
Comment 6 Giovanni Campagna 2010-11-15 20:42:25 UTC
Created attachment 174540 [details] [review]
StTooltip: turn into an StBin

Updated patch
Comment 7 Dan Winship 2010-11-16 15:01:09 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > still not addressed.
> 
> This was actually intended

So you should explain that when attaching the updated patch

> a tooltip is not a generic container, it does not
> make sense to clutter_container_add to a tooltip, when it can handle only text
> labels.

Yeah... it would be nice if we could have a way to reuse the StBin/StContainer machinery without actually exposing the container interface.

At any rate, StTooltip was already an StBin, and just not using the StBin machinery, which was just weird. So it definitely needed to be fixed in one direction or the other (either making it a real StBin, or making it a subclass of StWidget or StLabel rather than StBin).
Comment 8 Dan Winship 2010-11-16 15:03:49 UTC
(In reply to comment #7)
> At any rate, StTooltip was already an StBin

ugh... or rather, struct StTooltip and StTooltipClass were built on top of StBin and StBinClass, but the type was derived from G_TYPE_OBJECT...
Comment 9 Dan Winship 2010-11-16 15:21:47 UTC
Comment on attachment 174540 [details] [review]
StTooltip: turn into an StBin

ok, started reviewing this and found some minor things, but then I got to:

>+    clutter_actor_set_parent (CLUTTER_ACTOR (tooltip), clutter_actor_get_stage (CLUTTER_ACTOR (widget)));

which won't work if @widget isn't on the stage yet. So you'd need to add some additional complexity for that case, to wait until @widget has been realized, and then parent its tooltip at that point.

Anyway, this combined with the fact that I'd been confused before about StTooltip already being an StBin, and the fact that it would be nice to minimize divergence from Mx since we've started trying to work towards re-merging, makes me think you should just commit your previous patch (attachment 174341 [details] [review]) (probably also fixing the struct definitions in st-tooltip.h to reference StWidget rather than StBin).
Comment 10 Giovanni Campagna 2010-11-16 18:27:15 UTC
Comment on attachment 174341 [details] [review]
Rework to use StLabel instead of ClutterText

Pushed with the struct fixes