mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-06-28 21:20:06 +00:00
clickoverlays: show a preview on hover
This commit is contained in:
@@ -110,8 +110,8 @@ class ClickOverlay {
|
||||
destroy() {
|
||||
for (let overlay of [this.left, this.right]) {
|
||||
let actor = overlay.overlay;
|
||||
actor.disconnect(overlay.pressId);
|
||||
actor.disconnect(overlay.releaseId);
|
||||
[overlay.pressId, overlay.releaseId, overlay.enterId,
|
||||
overlay.leaveId].forEach(id => actor.disconnect(id));
|
||||
actor.destroy();
|
||||
}
|
||||
this.enterMonitor.disconnect(this.enterSignal);
|
||||
@@ -144,6 +144,8 @@ var StackOverlay = new Lang.Class({
|
||||
|
||||
this.pressId = overlay.connect('button-press-event', () => {
|
||||
Main.activateWindow(this.target);
|
||||
if (this.clone)
|
||||
this.clone.destroy();
|
||||
return true;
|
||||
});
|
||||
this.releaseId = overlay.connect('button-release-event', () => {
|
||||
@@ -151,6 +153,27 @@ var StackOverlay = new Lang.Class({
|
||||
return true;
|
||||
});
|
||||
|
||||
this.enterId = overlay.connect('enter-event', () => {
|
||||
if (this.clone)
|
||||
this.clone.destroy();
|
||||
|
||||
let [x, y, mask] = global.get_pointer();
|
||||
let clone = new Clutter.Clone({
|
||||
source: this.target.get_compositor_private()});
|
||||
this.clone = clone;
|
||||
clone.set_scale(0.15, 0.15);
|
||||
Main.uiGroup.add_actor(clone);
|
||||
|
||||
if (this._direction === Meta.MotionDirection.RIGHT)
|
||||
x = monitor.x + monitor.width - clone.get_transformed_size()[0];
|
||||
else
|
||||
x = monitor.x;
|
||||
clone.set_position(x, y);
|
||||
});
|
||||
this.leaveId = overlay.connect('leave-event', () => {
|
||||
this.clone.destroy();
|
||||
});
|
||||
|
||||
global.window_group.add_child(overlay);
|
||||
Main.layoutManager.trackChrome(overlay);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user