GNOME Bugzilla – Bug 621668
add st_describe_actor, for debugging
Last modified: 2010-06-17 18:05:54 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.
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.
Review of attachment 163694 [details] [review]: Looks good - I would suggest using it in LookingGlass.Inspector to set displayText.
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.
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.
fixed and pushed Attachment 163928 [details] pushed as 792dc48 - [St] add st_describe_actor, for debugging
Created attachment 163942 [details] [review] [environment] use St.describe_actor for Clutter.Actor.prototype.toString depends on bug 621911
Review of attachment 163942 [details] [review]: Looks good.
Attachment 163942 [details] pushed as ab61017 - [environment] use St.describe_actor for Clutter.Actor.prototype.toString