Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 33 additions & 24 deletions js/ui/lookingGlass.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,31 @@ function addBorderPaintHook(actor) {
return signalId;
}

class Inspector {
constructor() {
let container = new Cinnamon.GenericContainer({ width: 0,
height: 0 });
container.connect('allocate', (...args) => { this._allocate(...args) });
Main.uiGroup.add_actor(container);

let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
vertical: true,
reactive: true });
var Inspector = GObject.registerClass({
Signals: {
'closed': {},
'target': { param_types: [Clutter.Actor.$gtype, GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE]},
},
}, class Inspector extends Clutter.Actor {
_init() {
super._init({
width: 0,
height: 0,
});

Main.uiGroup.add_actor(this);

let eventHandler = new St.BoxLayout({
name: 'LookingGlassDialog',
vertical: true,
reactive: true,
});
this._eventHandler = eventHandler;
Main.pushModal(this._eventHandler);
container.add_actor(eventHandler);
this._displayText = new St.Label({style: 'text-align: center;'});
this.add_child(eventHandler);
this._displayText = new St.Label({ style: 'text-align: center;' });
eventHandler.add(this._displayText, { expand: true });
this._passThroughText = new St.Label({style: 'text-align: center;'});
this._passThroughText = new St.Label({ style: 'text-align: center;' });
eventHandler.add(this._passThroughText, { expand: true });

this._borderPaintTarget = null;
Expand Down Expand Up @@ -312,11 +321,11 @@ class Inspector {
event.get_key_symbol() === Clutter.KEY_Pause)) {
this.passThroughEvents = !this.passThroughEvents;
this._updatePassthroughText();
return true;
return Clutter.EVENT_STOP;
}

if (this.passThroughEvents)
return false;
return Clutter.EVENT_PROPAGATE;

switch (event.type()) {
case Clutter.EventType.KEY_PRESS:
Expand All @@ -328,14 +337,16 @@ class Inspector {
case Clutter.EventType.MOTION:
return this._onMotionEvent(actor, event);
default:
return true;
return Clutter.EVENT_STOP;
}
}

_allocate(actor, box, flags) {
vfunc_allocate(box, flags) {
if (!this._eventHandler)
return;

this.set_allocation(box, flags);

let primary = Main.layoutManager.primaryMonitor;

let [minWidth, minHeight, natWidth, natHeight] =
Expand Down Expand Up @@ -366,7 +377,7 @@ class Inspector {
_onKeyPressEvent(actor, event) {
if (event.get_key_symbol() === Clutter.KEY_Escape)
this._close();
return true;
return Clutter.EVENT_STOP;
}

_onButtonPressEvent(actor, event) {
Expand All @@ -375,7 +386,7 @@ class Inspector {
this.emit('target', this._target, stageX, stageY);
}
this._close();
return true;
return Clutter.EVENT_STOP;
}

_onScrollEvent(actor, event) {
Expand Down Expand Up @@ -409,12 +420,12 @@ class Inspector {
default:
break;
}
return true;
return Clutter.EVENT_STOP;
}

_onMotionEvent(actor, event) {
this._update(event);
return true;
return Clutter.EVENT_STOP;
}

_update(event) {
Expand All @@ -438,9 +449,7 @@ class Inspector {
this._borderPaintId = addBorderPaintHook(this._target);
}
}
};
Signals.addSignalMethods(Inspector.prototype);

});

const melangeIFace =
'<node> \
Expand Down
Loading