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 621668 - add st_describe_actor, for debugging
add st_describe_actor, for debugging
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Florian Müllner
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-06-15 16:45 UTC by Dan Winship
Modified: 2010-06-17 18:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[St] add st_describe_actor, for debugging (3.88 KB, patch)
2010-06-15 16:45 UTC, Dan Winship
accepted-commit_now Details | Review
[St] add st_describe_actor, for debugging (5.32 KB, patch)
2010-06-17 15:31 UTC, Dan Winship
committed Details | Review
[environment] use St.describe_actor for Clutter.Actor.prototype.toString (1.58 KB, patch)
2010-06-17 17:20 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2010-06-15 16:45:45 UTC
I wrote this while working on the focus chain stuff, but I've cut and
pasted similar (but much smaller) code before...

Basically, you pass it a ClutterActor, and it returns a string like

  [0xa78c090 StClickable.dash-search-result:focus ("Add/Remove Software")]

which in this case tells us that 0xa78c090 is an StClickable with
style_class "dash-search-result" and pseudo class "focus", and it
contains somewhere near the top of its child hierarchy a label with the
text "Add/Remove Software".

So then you throw that into a debug printf (and don't even worry about
the fact that you're leaking memory, because it's just a debug printf),
and it helps you figure out, eg, why the keyboard focus has suddenly
ended up on the wrong widget, etc.


I put it into libst rather than libgnome-shell because I wanted to be able
to call it from within st. I picked st-widget.c as a home for it sort of
at random because there was no obviously better place (yet?); I didn't
want to make it an StWidget "method", because sometimes you want to pass
a non-StWidget actor to it (and it supports that).

Anyway, dumping this into bugzilla. discuss.
Comment 1 Dan Winship 2010-06-15 16:45:47 UTC
Created attachment 163694 [details] [review]
[St] add st_describe_actor, for debugging

This can be used when adding debug printfs, to get clear descriptions of
actors.
Comment 2 Florian Müllner 2010-06-16 16:25:21 UTC
Review of attachment 163694 [details] [review]:

Looks good - I would suggest using it in LookingGlass.Inspector to set displayText.
Comment 3 Dan Winship 2010-06-17 15:31:49 UTC
Created attachment 163928 [details] [review]
[St] add st_describe_actor, for debugging

updated lg to use it. In the process I noticed that it only showed the
label text if you looked at an ancestor of the label, not if you looked
at the label itself, so I fixed that.
Comment 4 Florian Müllner 2010-06-17 16:17:52 UTC
Review of attachment 163928 [details] [review]:

Looks good except for one small bug - if you agree with the proposed fix, go ahead and push.

::: js/ui/lookingGlass.js
@@ +405,3 @@
+            displayText.text = position + ' ' + description;
+            let description = St.describe_actor(target);
+            let position = '[inspect x: ' + stageX + ' y: ' + stageY + ']';

There is a funny recursion when target == displayText :)

Probably the easiest workaround would be to set displayText.text = '' before the call to describe_actor.
Comment 5 Dan Winship 2010-06-17 16:48:51 UTC
fixed and pushed

Attachment 163928 [details] pushed as 792dc48 - [St] add st_describe_actor, for debugging
Comment 6 Dan Winship 2010-06-17 17:20:26 UTC
Created attachment 163942 [details] [review]
[environment] use St.describe_actor for Clutter.Actor.prototype.toString

depends on bug 621911
Comment 7 Florian Müllner 2010-06-17 17:42:16 UTC
Review of attachment 163942 [details] [review]:

Looks good.
Comment 8 Dan Winship 2010-06-17 18:05:51 UTC
Attachment 163942 [details] pushed as ab61017 - [environment] use St.describe_actor for Clutter.Actor.prototype.toString