Always reserve space in all workspaces on a drag

We used to do this only on automatic workspace switch, but that
doesn't work for the multiple monitors case where we want to reserve
space on the extra monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=609258
This commit is contained in:
Alexander Larsson 2011-03-04 15:49:13 +01:00
parent e5f05bc9d8
commit 05736ba0a1

View File

@ -385,6 +385,7 @@ WorkspacesView.prototype = {
return; return;
this._inDrag = true; this._inDrag = true;
this._firstDragMotion = true;
this._dragMonitor = { this._dragMonitor = {
dragMotion: Lang.bind(this, this._onDragMotion) dragMotion: Lang.bind(this, this._onDragMotion)
@ -396,6 +397,14 @@ WorkspacesView.prototype = {
if (Main.overview.animationInProgress) if (Main.overview.animationInProgress)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
if (this._firstDragMotion) {
this._firstDragMotion = false;
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setReservedSlot(dragEvent.dragActor._delegate);
for (let i = 0; i < this._extraWorkspaces.length; i++)
this._extraWorkspaces[i].setReservedSlot(dragEvent.dragActor._delegate);
}
let primary = global.get_primary_monitor(); let primary = global.get_primary_monitor();
let activeWorkspaceIndex = global.screen.get_active_workspace_index(); let activeWorkspaceIndex = global.screen.get_active_workspace_index();
@ -409,7 +418,6 @@ WorkspacesView.prototype = {
let switchTop = (dragEvent.y <= topEdge && topWorkspace); let switchTop = (dragEvent.y <= topEdge && topWorkspace);
if (switchTop && this._dragOverLastY != topEdge) { if (switchTop && this._dragOverLastY != topEdge) {
topWorkspace.metaWorkspace.activate(global.get_current_time()); topWorkspace.metaWorkspace.activate(global.get_current_time());
topWorkspace.setReservedSlot(dragEvent.dragActor._delegate);
this._dragOverLastY = topEdge; this._dragOverLastY = topEdge;
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
@ -418,7 +426,6 @@ WorkspacesView.prototype = {
let switchBottom = (dragEvent.y >= bottomEdge && bottomWorkspace); let switchBottom = (dragEvent.y >= bottomEdge && bottomWorkspace);
if (switchBottom && this._dragOverLastY != bottomEdge) { if (switchBottom && this._dragOverLastY != bottomEdge) {
bottomWorkspace.metaWorkspace.activate(global.get_current_time()); bottomWorkspace.metaWorkspace.activate(global.get_current_time());
bottomWorkspace.setReservedSlot(dragEvent.dragActor._delegate);
this._dragOverLastY = bottomEdge; this._dragOverLastY = bottomEdge;
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
@ -453,7 +460,6 @@ WorkspacesView.prototype = {
this._timeoutId = Mainloop.timeout_add_seconds(1, this._timeoutId = Mainloop.timeout_add_seconds(1,
Lang.bind(this, function() { Lang.bind(this, function() {
hoverWorkspace.metaWorkspace.activate(global.get_current_time()); hoverWorkspace.metaWorkspace.activate(global.get_current_time());
hoverWorkspace.setReservedSlot(dragEvent.dragActor._delegate);
return false; return false;
})); }));
} else { } else {
@ -476,6 +482,8 @@ 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);
for (let i = 0; i < this._extraWorkspaces.length; i++)
this._extraWorkspaces[i].setReservedSlot(null);
}, },
_swipeScrollBegin: function() { _swipeScrollBegin: function() {