Handle changes in window position for workspace thumbnails
Connect to the 'position-set' signal of MetaWindowActor and move actors when the source windows move.
This commit is contained in:
parent
1ab526dc64
commit
87ce301faa
@ -22,14 +22,16 @@ WindowClone.prototype = {
|
|||||||
_init : function(realWindow) {
|
_init : function(realWindow) {
|
||||||
this.actor = new Clutter.Clone({ source: realWindow.get_texture(),
|
this.actor = new Clutter.Clone({ source: realWindow.get_texture(),
|
||||||
clip_to_allocation: true,
|
clip_to_allocation: true,
|
||||||
reactive: true,
|
reactive: true });
|
||||||
x: realWindow.x,
|
|
||||||
y: realWindow.y });
|
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
this.realWindow = realWindow;
|
this.realWindow = realWindow;
|
||||||
this.metaWindow = realWindow.meta_window;
|
this.metaWindow = realWindow.meta_window;
|
||||||
this.metaWindow._delegate = this;
|
this.metaWindow._delegate = this;
|
||||||
|
|
||||||
|
this._positionChangedId = this.realWindow.connect('position-changed',
|
||||||
|
Lang.bind(this, this._onPositionChanged));
|
||||||
|
this._onPositionChanged();
|
||||||
|
|
||||||
this.actor.connect('button-release-event',
|
this.actor.connect('button-release-event',
|
||||||
Lang.bind(this, this._onButtonRelease));
|
Lang.bind(this, this._onButtonRelease));
|
||||||
|
|
||||||
@ -58,10 +60,20 @@ WindowClone.prototype = {
|
|||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onPositionChanged: function() {
|
||||||
|
let rect = this.metaWindow.get_outer_rect();
|
||||||
|
this.actor.set_position(this.realWindow.x, this.realWindow.y);
|
||||||
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy: function() {
|
||||||
this.metaWindow._delegate = null;
|
this.metaWindow._delegate = null;
|
||||||
this.actor._delegate = null;
|
this.actor._delegate = null;
|
||||||
|
|
||||||
|
if (this._positionChangedId != 0) {
|
||||||
|
this.realWindow.disconnect(this._positionChangedId);
|
||||||
|
this._positionChangedId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.inDrag) {
|
if (this.inDrag) {
|
||||||
this.emit('drag-end');
|
this.emit('drag-end');
|
||||||
this.inDrag = false;
|
this.inDrag = false;
|
||||||
@ -286,8 +298,8 @@ WorkspaceThumbnail.prototype = {
|
|||||||
time);
|
time);
|
||||||
return true;
|
return true;
|
||||||
} else if (source.shellWorkspaceLaunch) {
|
} else if (source.shellWorkspaceLaunch) {
|
||||||
this.metaWorkspace.activate(time);
|
source.shellWorkspaceLaunch({ workspace: this.metaWorkspace,
|
||||||
source.shellWorkspaceLaunch();
|
timestamp: time });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user