[gnome-shell] lookingGlass: Move to an inspect() function
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] lookingGlass: Move to an inspect() function
- Date: Fri, 28 Dec 2012 08:21:03 +0000 (UTC)
commit fa1420b3847f996a838b8aca740c38eee2698bf1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Dec 25 22:16:39 2012 -0500
lookingGlass: Move to an inspect() function
Rather than add invalid results to the place where you enter JavaScript
commands when you use the eyedropped, add an inspect() function and add
a fake call to it.
https://bugzilla.gnome.org/show_bug.cgi?id=690726
js/ui/lookingGlass.js | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index f5e47f4..097b15c 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -39,6 +39,7 @@ var commandHeader = 'const Clutter = imports.gi.Clutter; ' +
* in the shell core code too. */
'const stage = global.stage; ' +
/* Special lookingGlass functions */
+ 'const inspect = Lang.bind(Main.lookingGlass, Main.lookingGlass.inspect); ' +
'const it = Main.lookingGlass.getIt(); ' +
'const r = Lang.bind(Main.lookingGlass, Main.lookingGlass.getResult); ';
@@ -871,8 +872,7 @@ const LookingGlass = new Lang.Class({
inspectIcon.connect('button-press-event', Lang.bind(this, function () {
let inspector = new Inspector(this);
inspector.connect('target', Lang.bind(this, function(i, target, stageX, stageY) {
- this._pushResult('<inspect x:' + stageX + ' y:' + stageY + '>',
- target);
+ this._pushResult('inspect(' + Math.round(stageX) + ', ' + Math.round(stageY) + ')', target);
}));
inspector.connect('closed', Lang.bind(this, function() {
this.actor.show();
@@ -1057,6 +1057,10 @@ const LookingGlass = new Lang.Class({
this._entry.text = '';
},
+ inspect: function(x, y) {
+ return global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
+ },
+
getIt: function () {
return this._it;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]