[gnome-shell] [lookingGlass] Paint border around current result if instanceof Clutter.Actor



commit 1b75ae018471b5cfe9e07d4d93f67daceb3c62c1
Author: Colin Walters <walters verbum org>
Date:   Wed Nov 11 13:12:55 2009 -0500

    [lookingGlass] Paint border around current result if instanceof Clutter.Actor
    
    It's very convenient to drill down through object properties and
    be able to see exactly which portion of the screen those actors
    correspond to, without trying to guess with the inspector tool.

 js/ui/lookingGlass.js |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 35431f0..afe99b8 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -320,6 +320,10 @@ LookingGlass.prototype = {
         this._savedText = null;
         this._historyNavIndex = -1;
         this._history = [];
+        this._borderPaintTarget = null;
+        this._borderPaintId = 0;
+        this._borderDestroyId = 0;
+
         this._readHistory();
 
         this._open = false;
@@ -487,6 +491,18 @@ LookingGlass.prototype = {
         this._results.push(result);
         this._resultsArea.append(result.actor, Big.BoxPackFlags.NONE);
         this._propInspector.setTarget(obj);
+        if (this._borderPaintTarget != null) {
+            this._borderPaintTarget.disconnect(this._borderPaintId);
+            this._borderPaintTarget = null;
+        }
+        if (obj instanceof Clutter.Actor) {
+            this._borderPaintTarget = obj;
+            this._borderPaintId = Shell.add_hook_paint_red_border(obj);
+            this._borderDestroyId = obj.connect('destroy', Lang.bind(this, function () {
+                this._borderDestroyId = 0;
+                this._borderPaintTarget = null;
+            }));
+        }
         let children = this._resultsArea.get_children();
         if (children.length > this._maxItems) {
             this._results.shift();
@@ -582,6 +598,12 @@ LookingGlass.prototype = {
         this._open = false;
         Tweener.removeTweens(this.actor);
 
+        if (this._borderPaintTarget != null) {
+            this._borderPaintTarget.disconnect(this._borderPaintId);
+            this._borderPaintTarget.disconnect(this._borderDestroyId);
+            this._borderPaintTarget = null;
+        }
+
         Main.popModal(this.actor);
 
         Tweener.addTween(this.actor, { time: 0.5,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]