[lg] Close inspector on Esc
https://bugzilla.gnome.org/show_bug.cgi?id=624940
This commit is contained in:
parent
09edf4ba59
commit
083b1c9d8b
@ -382,10 +382,12 @@ Inspector.prototype = {
|
|||||||
this._borderPaintTarget = null;
|
this._borderPaintTarget = null;
|
||||||
this._borderPaintId = null;
|
this._borderPaintId = null;
|
||||||
eventHandler.connect('destroy', Lang.bind(this, this._onDestroy));
|
eventHandler.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
|
eventHandler.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
||||||
eventHandler.connect('button-press-event', Lang.bind(this, this._onButtonPressEvent));
|
eventHandler.connect('button-press-event', Lang.bind(this, this._onButtonPressEvent));
|
||||||
eventHandler.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
eventHandler.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
||||||
eventHandler.connect('motion-event', Lang.bind(this, this._onMotionEvent));
|
eventHandler.connect('motion-event', Lang.bind(this, this._onMotionEvent));
|
||||||
Clutter.grab_pointer(eventHandler);
|
Clutter.grab_pointer(eventHandler);
|
||||||
|
Clutter.grab_keyboard(eventHandler);
|
||||||
|
|
||||||
// this._target is the actor currently shown by the inspector.
|
// this._target is the actor currently shown by the inspector.
|
||||||
// this._pointerTarget is the actor directly under the pointer.
|
// this._pointerTarget is the actor directly under the pointer.
|
||||||
@ -398,6 +400,7 @@ Inspector.prototype = {
|
|||||||
|
|
||||||
_close: function() {
|
_close: function() {
|
||||||
Clutter.ungrab_pointer(this._eventHandler);
|
Clutter.ungrab_pointer(this._eventHandler);
|
||||||
|
Clutter.ungrab_keyboard(this._eventHandler);
|
||||||
this._eventHandler.destroy();
|
this._eventHandler.destroy();
|
||||||
this.emit('closed');
|
this.emit('closed');
|
||||||
},
|
},
|
||||||
@ -407,6 +410,12 @@ Inspector.prototype = {
|
|||||||
this._borderPaintTarget.disconnect(this._borderPaintId);
|
this._borderPaintTarget.disconnect(this._borderPaintId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onKeyPressEvent: function (actor, event) {
|
||||||
|
if (event.get_key_symbol() == Clutter.Escape)
|
||||||
|
this._close();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
_onButtonPressEvent: function (actor, event) {
|
_onButtonPressEvent: function (actor, event) {
|
||||||
if (this._target) {
|
if (this._target) {
|
||||||
let [stageX, stageY] = event.get_coords();
|
let [stageX, stageY] = event.get_coords();
|
||||||
|
Loading…
Reference in New Issue
Block a user