workspaces: Change handling of window-drag signals
Delegate the emission of the window-drag-begin/window-drag-end signals to overview functions, as done already for other items. This will enable objects to react to those signals without having access to the workspace objects / the workspaces view. https://bugzilla.gnome.org/show_bug.cgi?id=634948
This commit is contained in:
parent
dfa3be59dc
commit
868d4756e4
@ -247,6 +247,14 @@ Overview.prototype = {
|
|||||||
this.emit('item-drag-end');
|
this.emit('item-drag-end');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beginWindowDrag: function(source) {
|
||||||
|
this.emit('window-drag-begin');
|
||||||
|
},
|
||||||
|
|
||||||
|
endWindowDrag: function(source) {
|
||||||
|
this.emit('window-drag-end');
|
||||||
|
},
|
||||||
|
|
||||||
// Returns the scale the Overview has when we just start zooming out
|
// Returns the scale the Overview has when we just start zooming out
|
||||||
// to overview mode. That is, when just the active workspace is showing.
|
// to overview mode. That is, when just the active workspace is showing.
|
||||||
getZoomedInScale : function() {
|
getZoomedInScale : function() {
|
||||||
|
@ -1303,12 +1303,12 @@ Workspace.prototype = {
|
|||||||
Lang.bind(this, this._onCloneSelected));
|
Lang.bind(this, this._onCloneSelected));
|
||||||
clone.connect('drag-begin',
|
clone.connect('drag-begin',
|
||||||
Lang.bind(this, function(clone) {
|
Lang.bind(this, function(clone) {
|
||||||
this.emit('window-drag-begin', clone.actor);
|
Main.overview.beginWindowDrag();
|
||||||
overlay.hide();
|
overlay.hide();
|
||||||
}));
|
}));
|
||||||
clone.connect('drag-end',
|
clone.connect('drag-end',
|
||||||
Lang.bind(this, function(clone) {
|
Lang.bind(this, function(clone) {
|
||||||
this.emit('window-drag-end', clone.actor);
|
Main.overview.endWindowDrag();
|
||||||
overlay.show();
|
overlay.show();
|
||||||
}));
|
}));
|
||||||
clone.connect('zoom-start',
|
clone.connect('zoom-start',
|
||||||
|
@ -62,15 +62,8 @@ WorkspacesView.prototype = {
|
|||||||
this._workspaces = workspaces;
|
this._workspaces = workspaces;
|
||||||
|
|
||||||
// Add workspace actors
|
// Add workspace actors
|
||||||
for (let w = 0; w < global.screen.n_workspaces; w++) {
|
for (let w = 0; w < global.screen.n_workspaces; w++)
|
||||||
this._workspaces[w].actor.reparent(this.actor);
|
this._workspaces[w].actor.reparent(this.actor);
|
||||||
this._workspaces[w]._windowDragBeginId =
|
|
||||||
this._workspaces[w].connect('window-drag-begin',
|
|
||||||
Lang.bind(this, this._dragBegin));
|
|
||||||
this._workspaces[w]._windowDragEndId =
|
|
||||||
this._workspaces[w].connect('window-drag-end',
|
|
||||||
Lang.bind(this, this._dragEnd));
|
|
||||||
}
|
|
||||||
this._workspaces[activeWorkspaceIndex].actor.raise_top();
|
this._workspaces[activeWorkspaceIndex].actor.raise_top();
|
||||||
|
|
||||||
// Position/scale the desktop windows and their children after the
|
// Position/scale the desktop windows and their children after the
|
||||||
@ -114,6 +107,10 @@ WorkspacesView.prototype = {
|
|||||||
Lang.bind(this, this._dragBegin));
|
Lang.bind(this, this._dragBegin));
|
||||||
this._itemDragEndId = Main.overview.connect('item-drag-end',
|
this._itemDragEndId = Main.overview.connect('item-drag-end',
|
||||||
Lang.bind(this, this._dragEnd));
|
Lang.bind(this, this._dragEnd));
|
||||||
|
this._windowDragBeginId = Main.overview.connect('window-drag-begin',
|
||||||
|
Lang.bind(this, this._dragBegin));
|
||||||
|
this._windowDragEndId = Main.overview.connect('window-drag-end',
|
||||||
|
Lang.bind(this, this._dragEnd));
|
||||||
},
|
},
|
||||||
|
|
||||||
_lookupWorkspaceForMetaWindow: function (metaWindow) {
|
_lookupWorkspaceForMetaWindow: function (metaWindow) {
|
||||||
@ -583,13 +580,8 @@ WorkspacesView.prototype = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (newNumWorkspaces > oldNumWorkspaces) {
|
if (newNumWorkspaces > oldNumWorkspaces) {
|
||||||
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++)
|
||||||
this.actor.add_actor(this._workspaces[w].actor);
|
this.actor.add_actor(this._workspaces[w].actor);
|
||||||
this._workspaces[w]._windowDragBeginId = this._workspaces[w].connect('window-drag-begin',
|
|
||||||
Lang.bind(this, this._dragBegin));
|
|
||||||
this._workspaces[w]._windowDragEndId = this._workspaces[w].connect('window-drag-end',
|
|
||||||
Lang.bind(this, this._dragEnd));
|
|
||||||
}
|
|
||||||
|
|
||||||
this._computeWorkspacePositions();
|
this._computeWorkspacePositions();
|
||||||
this._updateWorkspaceActors(false);
|
this._updateWorkspaceActors(false);
|
||||||
@ -625,15 +617,13 @@ WorkspacesView.prototype = {
|
|||||||
Main.overview.disconnect(this._itemDragEndId);
|
Main.overview.disconnect(this._itemDragEndId);
|
||||||
this._itemDragEndId = 0;
|
this._itemDragEndId = 0;
|
||||||
}
|
}
|
||||||
for (let w = 0; w < this._workspaces.length; w++) {
|
if (this._windowDragBeginId > 0) {
|
||||||
if (this._workspaces[w]._windowDragBeginId) {
|
Main.overview.disconnect(this._windowDragBeginId);
|
||||||
this._workspaces[w].disconnect(this._workspaces[w]._windowDragBeginId);
|
this._windowDragBeginId = 0;
|
||||||
this._workspaces[w]._windowDragBeginId = 0;
|
}
|
||||||
}
|
if (this._windowDragEndId > 0) {
|
||||||
if (this._workspaces[w]._windowDragEndId) {
|
Main.overview.disconnect(this._windowDragEndId);
|
||||||
this._workspaces[w].disconnect(this._workspaces[w]._windowDragEndId);
|
this._windowDragEndId = 0;
|
||||||
this._workspaces[w]._windowDragEndId = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -649,8 +639,6 @@ WorkspacesView.prototype = {
|
|||||||
dragMotion: Lang.bind(this, this._onDragMotion)
|
dragMotion: Lang.bind(this, this._onDragMotion)
|
||||||
};
|
};
|
||||||
DND.addDragMonitor(this._dragMonitor);
|
DND.addDragMonitor(this._dragMonitor);
|
||||||
|
|
||||||
this.emit('window-drag-begin');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragMotion: function(dragEvent) {
|
_onDragMotion: function(dragEvent) {
|
||||||
@ -741,8 +729,6 @@ WorkspacesView.prototype = {
|
|||||||
|
|
||||||
for (let i = 0; i < this._workspaces.length; i++)
|
for (let i = 0; i < this._workspaces.length; i++)
|
||||||
this._workspaces[i].setReservedSlot(null);
|
this._workspaces[i].setReservedSlot(null);
|
||||||
|
|
||||||
this.emit('window-drag-end');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// sync the workspaces' positions to the value of the scroll adjustment
|
// sync the workspaces' positions to the value of the scroll adjustment
|
||||||
@ -944,6 +930,10 @@ WorkspaceControlsContainer.prototype = {
|
|||||||
Lang.bind(this, this.popOut));
|
Lang.bind(this, this.popOut));
|
||||||
Main.overview.connect('item-drag-end',
|
Main.overview.connect('item-drag-end',
|
||||||
Lang.bind(this, this.popIn));
|
Lang.bind(this, this.popIn));
|
||||||
|
Main.overview.connect('window-drag-begin',
|
||||||
|
Lang.bind(this, this.popOut));
|
||||||
|
Main.overview.connect('window-drag-end',
|
||||||
|
Lang.bind(this, this.popIn));
|
||||||
this._controls.x = this._poppedInX();
|
this._controls.x = this._poppedInX();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
@ -1088,15 +1078,6 @@ WorkspacesDisplay.prototype = {
|
|||||||
this.workspacesView.destroy();
|
this.workspacesView.destroy();
|
||||||
this.workspacesView = newView;
|
this.workspacesView = newView;
|
||||||
|
|
||||||
this.workspacesView.connect('window-drag-begin', Lang.bind(this,
|
|
||||||
function() {
|
|
||||||
this._controlsContainer.popOut();
|
|
||||||
}));
|
|
||||||
this.workspacesView.connect('window-drag-end', Lang.bind(this,
|
|
||||||
function() {
|
|
||||||
this._controlsContainer.popIn();
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._workspaceIndicatorPanel.updateWorkspaces(this._workspaces);
|
this._workspaceIndicatorPanel.updateWorkspaces(this._workspaces);
|
||||||
|
|
||||||
this._nWorkspacesNotifyId =
|
this._nWorkspacesNotifyId =
|
||||||
|
Loading…
Reference in New Issue
Block a user