2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2010-01-22 02:33:48 +00:00
|
|
|
|
|
|
|
const Clutter = imports.gi.Clutter;
|
2011-11-25 14:44:17 +00:00
|
|
|
const Gio = imports.gi.Gio;
|
2012-11-26 04:40:48 +00:00
|
|
|
const GObject = imports.gi.GObject;
|
2010-01-22 02:33:48 +00:00
|
|
|
const Lang = imports.lang;
|
|
|
|
const Mainloop = imports.mainloop;
|
2011-01-30 21:38:13 +00:00
|
|
|
const Meta = imports.gi.Meta;
|
2010-01-22 02:33:48 +00:00
|
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
const Signals = imports.signals;
|
|
|
|
|
|
|
|
const DND = imports.ui.dnd;
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
const Overview = imports.ui.overview;
|
|
|
|
const Tweener = imports.ui.tweener;
|
|
|
|
const Workspace = imports.ui.workspace;
|
2011-01-31 02:18:12 +00:00
|
|
|
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
|
2010-01-22 02:33:48 +00:00
|
|
|
|
|
|
|
const WORKSPACE_SWITCH_TIME = 0.25;
|
|
|
|
// Note that mutter has a compile-time limit of 36
|
|
|
|
const MAX_WORKSPACES = 16;
|
|
|
|
|
2011-11-25 14:44:17 +00:00
|
|
|
const OVERRIDE_SCHEMA = 'org.gnome.shell.overrides';
|
2010-03-16 15:51:24 +00:00
|
|
|
|
2013-09-11 16:12:42 +00:00
|
|
|
const WorkspacesViewBase = new Lang.Class({
|
|
|
|
Name: 'WorkspacesViewBase',
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2013-09-11 14:09:13 +00:00
|
|
|
_init: function(monitorIndex) {
|
2012-10-22 15:39:46 +00:00
|
|
|
this.actor = new St.Widget({ style_class: 'workspaces-view',
|
|
|
|
reactive: true });
|
2013-09-11 16:12:42 +00:00
|
|
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
2013-11-04 22:23:44 +00:00
|
|
|
global.focus_manager.add_group(this.actor);
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2011-01-31 01:35:58 +00:00
|
|
|
// The actor itself isn't a drop target, so we don't want to pick on its area
|
|
|
|
this.actor.set_size(0, 0);
|
|
|
|
|
2013-09-11 16:12:42 +00:00
|
|
|
this._monitorIndex = monitorIndex;
|
2010-02-18 15:43:58 +00:00
|
|
|
|
2013-02-25 23:25:27 +00:00
|
|
|
this._fullGeometry = null;
|
2013-02-25 23:34:17 +00:00
|
|
|
this._actualGeometry = null;
|
2013-02-25 23:25:27 +00:00
|
|
|
|
2013-09-11 16:12:42 +00:00
|
|
|
this._inDrag = false;
|
|
|
|
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));
|
|
|
|
},
|
|
|
|
|
|
|
|
_onDestroy: function() {
|
|
|
|
this._dragEnd();
|
|
|
|
|
|
|
|
if (this._windowDragBeginId > 0) {
|
|
|
|
Main.overview.disconnect(this._windowDragBeginId);
|
|
|
|
this._windowDragBeginId = 0;
|
|
|
|
}
|
|
|
|
if (this._windowDragEndId > 0) {
|
|
|
|
Main.overview.disconnect(this._windowDragEndId);
|
|
|
|
this._windowDragEndId = 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_dragBegin: function(overview, clone) {
|
|
|
|
this._inDrag = true;
|
|
|
|
this._setReservedSlot(clone);
|
|
|
|
},
|
|
|
|
|
|
|
|
_dragEnd: function() {
|
|
|
|
this._inDrag = false;
|
|
|
|
this._setReservedSlot(null);
|
|
|
|
},
|
|
|
|
|
|
|
|
destroy: function() {
|
|
|
|
this.actor.destroy();
|
|
|
|
},
|
|
|
|
|
|
|
|
setFullGeometry: function(geom) {
|
|
|
|
this._fullGeometry = geom;
|
|
|
|
this._syncGeometry();
|
|
|
|
},
|
|
|
|
|
|
|
|
setActualGeometry: function(geom) {
|
|
|
|
this._actualGeometry = geom;
|
|
|
|
this._syncGeometry();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const WorkspacesView = new Lang.Class({
|
|
|
|
Name: 'WorkspacesView',
|
|
|
|
Extends: WorkspacesViewBase,
|
|
|
|
|
|
|
|
_init: function(monitorIndex) {
|
|
|
|
this.parent(monitorIndex);
|
2013-09-11 14:09:13 +00:00
|
|
|
|
2010-11-12 09:28:28 +00:00
|
|
|
this._animating = false; // tweening
|
2011-01-21 18:47:54 +00:00
|
|
|
this._scrolling = false; // swipe-scrolling
|
2010-11-12 09:28:28 +00:00
|
|
|
this._animatingScroll = false; // programatically updating the adjustment
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2011-11-25 14:44:17 +00:00
|
|
|
this._settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
|
|
|
|
2010-01-22 02:33:48 +00:00
|
|
|
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
2013-09-11 14:09:13 +00:00
|
|
|
this.scrollAdjustment = new St.Adjustment({ value: activeWorkspaceIndex,
|
|
|
|
lower: 0,
|
|
|
|
page_increment: 1,
|
|
|
|
page_size: 1,
|
|
|
|
step_increment: 0,
|
|
|
|
upper: 0 });
|
|
|
|
this.scrollAdjustment.connect('notify::value',
|
|
|
|
Lang.bind(this, this._onScroll));
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2013-09-11 14:09:13 +00:00
|
|
|
this._workspaces = [];
|
|
|
|
this._updateWorkspaces();
|
|
|
|
this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', Lang.bind(this, this._updateWorkspaces));
|
2010-01-22 02:33:48 +00:00
|
|
|
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
this._overviewShownId =
|
|
|
|
Main.overview.connect('shown',
|
|
|
|
Lang.bind(this, function() {
|
2013-02-25 23:25:27 +00:00
|
|
|
this.actor.set_clip(this._fullGeometry.x, this._fullGeometry.y,
|
|
|
|
this._fullGeometry.width, this._fullGeometry.height);
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
}));
|
2010-01-22 02:33:48 +00:00
|
|
|
|
|
|
|
this._switchWorkspaceNotifyId =
|
|
|
|
global.window_manager.connect('switch-workspace',
|
|
|
|
Lang.bind(this, this._activeWorkspaceChanged));
|
2011-11-25 14:44:17 +00:00
|
|
|
},
|
|
|
|
|
2013-09-11 16:12:42 +00:00
|
|
|
_setReservedSlot: function(clone) {
|
|
|
|
for (let i = 0; i < this._workspaces.length; i++)
|
|
|
|
this._workspaces[i].setReservedSlot(clone);
|
2011-11-25 14:44:17 +00:00
|
|
|
},
|
|
|
|
|
2013-09-11 14:09:13 +00:00
|
|
|
_syncGeometry: function() {
|
|
|
|
for (let i = 0; i < this._workspaces.length; i++)
|
|
|
|
this._workspaces[i].setFullGeometry(this._fullGeometry);
|
|
|
|
for (let i = 0; i < this._workspaces.length; i++)
|
|
|
|
this._workspaces[i].setActualGeometry(this._actualGeometry);
|
|
|
|
},
|
|
|
|
|
2010-07-15 14:21:32 +00:00
|
|
|
getActiveWorkspace: function() {
|
|
|
|
let active = global.screen.get_active_workspace_index();
|
|
|
|
return this._workspaces[active];
|
|
|
|
},
|
|
|
|
|
2013-09-11 19:30:13 +00:00
|
|
|
zoomToOverview: function() {
|
|
|
|
for (let w = 0; w < this._workspaces.length; w++)
|
|
|
|
this._workspaces[w].zoomToOverview();
|
2013-10-30 22:19:18 +00:00
|
|
|
this._updateWorkspaceActors(false);
|
2013-09-11 19:30:13 +00:00
|
|
|
},
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2013-09-11 19:30:13 +00:00
|
|
|
zoomFromOverview: function() {
|
2012-07-19 00:21:58 +00:00
|
|
|
this.actor.remove_clip();
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
|
2010-01-22 02:33:48 +00:00
|
|
|
for (let w = 0; w < this._workspaces.length; w++)
|
|
|
|
this._workspaces[w].zoomFromOverview();
|
2010-02-18 15:43:58 +00:00
|
|
|
},
|
|
|
|
|
2011-01-31 01:44:05 +00:00
|
|
|
syncStacking: function(stackIndices) {
|
2010-01-22 02:33:48 +00:00
|
|
|
for (let i = 0; i < this._workspaces.length; i++)
|
|
|
|
this._workspaces[i].syncStacking(stackIndices);
|
|
|
|
},
|
|
|
|
|
2012-11-26 04:54:11 +00:00
|
|
|
_scrollToActive: function() {
|
2010-02-10 05:56:36 +00:00
|
|
|
let active = global.screen.get_active_workspace_index();
|
|
|
|
|
2012-11-26 04:54:11 +00:00
|
|
|
this._updateWorkspaceActors(true);
|
|
|
|
this._updateScrollAdjustment(active);
|
2010-02-10 05:56:36 +00:00
|
|
|
},
|
|
|
|
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
// Update workspace actors parameters
|
2010-03-22 23:01:44 +00:00
|
|
|
// @showAnimation: iff %true, transition between states
|
2010-03-16 15:51:24 +00:00
|
|
|
_updateWorkspaceActors: function(showAnimation) {
|
2010-02-10 05:56:36 +00:00
|
|
|
let active = global.screen.get_active_workspace_index();
|
|
|
|
|
2010-03-22 23:01:44 +00:00
|
|
|
this._animating = showAnimation;
|
|
|
|
|
2010-02-10 05:56:36 +00:00
|
|
|
for (let w = 0; w < this._workspaces.length; w++) {
|
|
|
|
let workspace = this._workspaces[w];
|
|
|
|
|
2010-03-22 23:01:44 +00:00
|
|
|
Tweener.removeTweens(workspace.actor);
|
|
|
|
|
2013-09-11 20:21:40 +00:00
|
|
|
let y = (w - active) * this._fullGeometry.height;
|
2010-02-10 05:56:36 +00:00
|
|
|
|
|
|
|
if (showAnimation) {
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
let params = { y: y,
|
2010-10-04 18:04:23 +00:00
|
|
|
time: WORKSPACE_SWITCH_TIME,
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
};
|
|
|
|
// we have to call _updateVisibility() once before the
|
|
|
|
// animation and once afterwards - it does not really
|
|
|
|
// matter which tween we use, so we pick the first one ...
|
|
|
|
if (w == 0) {
|
|
|
|
this._updateVisibility();
|
|
|
|
params.onComplete = Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
this._animating = false;
|
|
|
|
this._updateVisibility();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
Tweener.addTween(workspace.actor, params);
|
2010-01-22 02:33:48 +00:00
|
|
|
} else {
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
workspace.actor.set_position(0, y);
|
2010-10-04 18:04:23 +00:00
|
|
|
if (w == 0)
|
|
|
|
this._updateVisibility();
|
2010-01-22 02:33:48 +00:00
|
|
|
}
|
2010-03-16 15:51:24 +00:00
|
|
|
}
|
2010-03-22 23:01:44 +00:00
|
|
|
},
|
2010-02-11 14:52:49 +00:00
|
|
|
|
2010-03-22 23:01:44 +00:00
|
|
|
_updateVisibility: function() {
|
|
|
|
let active = global.screen.get_active_workspace_index();
|
2010-02-11 14:52:49 +00:00
|
|
|
|
2010-03-22 23:01:44 +00:00
|
|
|
for (let w = 0; w < this._workspaces.length; w++) {
|
|
|
|
let workspace = this._workspaces[w];
|
|
|
|
if (this._animating || this._scrolling) {
|
|
|
|
workspace.actor.show();
|
2010-02-11 14:52:49 +00:00
|
|
|
} else {
|
2010-03-22 23:01:44 +00:00
|
|
|
if (this._inDrag)
|
|
|
|
workspace.actor.visible = (Math.abs(w - active) <= 1);
|
|
|
|
else
|
|
|
|
workspace.actor.visible = (w == active);
|
2010-02-11 14:52:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-11-26 04:54:11 +00:00
|
|
|
_updateScrollAdjustment: function(index) {
|
2010-07-11 12:41:17 +00:00
|
|
|
if (this._scrolling)
|
2010-02-10 05:56:36 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
this._animatingScroll = true;
|
|
|
|
|
2012-11-26 04:54:11 +00:00
|
|
|
Tweener.addTween(this.scrollAdjustment, {
|
|
|
|
value: index,
|
|
|
|
time: WORKSPACE_SWITCH_TIME,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
onComplete: Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
this._animatingScroll = false;
|
|
|
|
})
|
|
|
|
});
|
2010-02-10 05:56:36 +00:00
|
|
|
},
|
|
|
|
|
2013-09-11 14:09:13 +00:00
|
|
|
_updateWorkspaces: function() {
|
|
|
|
let newNumWorkspaces = global.screen.n_workspaces;
|
|
|
|
|
2013-09-11 15:47:56 +00:00
|
|
|
this.scrollAdjustment.upper = newNumWorkspaces;
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2014-01-03 18:04:06 +00:00
|
|
|
let needsUpdate = false;
|
|
|
|
for (let j = 0; j < newNumWorkspaces; j++) {
|
|
|
|
let metaWorkspace = global.screen.get_workspace_by_index(j);
|
|
|
|
let workspace;
|
|
|
|
|
|
|
|
if (j >= this._workspaces.length) { /* added */
|
|
|
|
workspace = new Workspace.Workspace(metaWorkspace, this._monitorIndex);
|
2013-09-11 14:09:13 +00:00
|
|
|
this.actor.add_actor(workspace.actor);
|
2014-01-03 18:04:06 +00:00
|
|
|
this._workspaces[j] = workspace;
|
|
|
|
} else {
|
|
|
|
workspace = this._workspaces[j];
|
|
|
|
|
|
|
|
if (workspace.metaWorkspace != metaWorkspace) { /* removed */
|
|
|
|
workspace.destroy();
|
|
|
|
this._workspaces.splice(j, 1);
|
|
|
|
} /* else kept */
|
2011-06-01 12:47:51 +00:00
|
|
|
}
|
2010-01-22 02:33:48 +00:00
|
|
|
}
|
2013-09-11 14:09:13 +00:00
|
|
|
|
2014-01-03 18:04:06 +00:00
|
|
|
if (this._fullGeometry)
|
|
|
|
this._updateWorkspaceActors(false);
|
|
|
|
|
2013-09-11 14:09:13 +00:00
|
|
|
this._syncGeometry();
|
2010-01-22 02:33:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_activeWorkspaceChanged: function(wm, from, to, direction) {
|
2010-02-10 05:56:36 +00:00
|
|
|
if (this._scrolling)
|
|
|
|
return;
|
|
|
|
|
2012-11-26 04:54:11 +00:00
|
|
|
this._scrollToActive();
|
2010-01-22 02:33:48 +00:00
|
|
|
},
|
|
|
|
|
2010-03-16 15:51:24 +00:00
|
|
|
_onDestroy: function() {
|
2013-09-11 16:12:42 +00:00
|
|
|
this.parent();
|
|
|
|
|
2011-11-28 16:51:53 +00:00
|
|
|
this.scrollAdjustment.run_dispose();
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
Main.overview.disconnect(this._overviewShownId);
|
2010-11-12 09:28:28 +00:00
|
|
|
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
|
2013-09-11 14:09:13 +00:00
|
|
|
global.screen.disconnect(this._updateWorkspacesId);
|
2010-03-16 15:51:24 +00:00
|
|
|
},
|
|
|
|
|
2011-11-28 16:51:53 +00:00
|
|
|
startSwipeScroll: function() {
|
2011-01-21 18:47:54 +00:00
|
|
|
this._scrolling = true;
|
|
|
|
},
|
|
|
|
|
2012-11-26 04:40:48 +00:00
|
|
|
endSwipeScroll: function() {
|
2011-01-21 18:47:54 +00:00
|
|
|
this._scrolling = false;
|
|
|
|
|
|
|
|
// Make sure title captions etc are shown as necessary
|
2012-11-26 04:40:48 +00:00
|
|
|
this._scrollToActive();
|
2011-01-21 18:47:54 +00:00
|
|
|
this._updateVisibility();
|
|
|
|
},
|
|
|
|
|
2010-07-11 12:41:17 +00:00
|
|
|
// sync the workspaces' positions to the value of the scroll adjustment
|
2010-02-10 05:56:36 +00:00
|
|
|
// and change the active workspace if appropriate
|
|
|
|
_onScroll: function(adj) {
|
|
|
|
if (this._animatingScroll)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let active = global.screen.get_active_workspace_index();
|
|
|
|
let current = Math.round(adj.value);
|
|
|
|
|
|
|
|
if (active != current) {
|
2013-01-19 01:26:44 +00:00
|
|
|
if (!this._workspaces[current]) {
|
|
|
|
// The current workspace was destroyed. This could happen
|
|
|
|
// when you are on the last empty workspace, and consolidate
|
|
|
|
// windows using the thumbnail bar.
|
|
|
|
// In that case, the intended behavior is to stay on the empty
|
|
|
|
// workspace, which is the last one, so pick it.
|
|
|
|
current = this._workspaces.length - 1;
|
|
|
|
}
|
|
|
|
|
2010-02-14 23:32:57 +00:00
|
|
|
let metaWorkspace = this._workspaces[current].metaWorkspace;
|
2010-07-11 12:41:17 +00:00
|
|
|
metaWorkspace.activate(global.get_current_time());
|
2010-02-10 05:56:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let last = this._workspaces.length - 1;
|
2011-01-30 23:21:31 +00:00
|
|
|
let firstWorkspaceY = this._workspaces[0].actor.y;
|
|
|
|
let lastWorkspaceY = this._workspaces[last].actor.y;
|
|
|
|
let workspacesHeight = lastWorkspaceY - firstWorkspaceY;
|
2010-02-10 05:56:36 +00:00
|
|
|
|
|
|
|
if (adj.upper == 1)
|
|
|
|
return;
|
|
|
|
|
2011-01-30 23:21:31 +00:00
|
|
|
let currentY = firstWorkspaceY;
|
Restructure the way we handle positioning zooming in Workspace
We currently show the workspace in the overview in a rectangle
with the same aspect ratio as the screen. Originally this was
probably done since it showed the desktop, but we don't do this
anymore, and the positioning of the windows in the overview is
strictly a grid, so its not in any way related to monitor geometry.
Additionally, in the multihead case the screen aspect ratio is
very different from the overview monitor geometry, so a lot of
space is lost.
So, instead we just fill the entire inner rectangle of the overview
with the workspace. However, the way the zoom into and out of the
workspace right now is by scaling the workspace so that it covers
the entire monitor. This cannot really work anymore when the workspace
is a different aspect ratio. Furthermore the coordinates of the
window clone actors are of two very different types in the "original
window" case and the "window in a slot case". One is screen relative,
the other is workspace relative. This makes it very hard to compute
the cost of window motion distance in computeWindowMotion.
In order to handle this we change the way workspace actor positioning
and scaling work. All workspace window clone actors are stored in
true screen coordingates, both the original window positions and the
in-a-slot ones. Global scaling of the workspace is never done, we
just reposition everything in both the initial zoom and when the
controls appear from the side.
There is one issue in the initial and final animations, which is that
the clip region we normally have for the workspacesView will limit the
animation of the clones to/from the original positions, so we disable
the clip region during these animations.
https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-02 16:04:03 +00:00
|
|
|
let newY = - adj.value / (adj.upper - 1) * workspacesHeight;
|
2010-02-10 05:56:36 +00:00
|
|
|
|
2011-01-30 23:21:31 +00:00
|
|
|
let dy = newY - currentY;
|
2010-02-10 05:56:36 +00:00
|
|
|
|
|
|
|
for (let i = 0; i < this._workspaces.length; i++) {
|
2010-03-16 15:51:24 +00:00
|
|
|
this._workspaces[i].actor.visible = Math.abs(i - adj.value) <= 1;
|
2011-01-30 23:21:31 +00:00
|
|
|
this._workspaces[i].actor.y += dy;
|
2010-02-10 05:56:36 +00:00
|
|
|
}
|
|
|
|
},
|
2011-11-20 17:56:27 +00:00
|
|
|
});
|
2010-10-04 14:42:11 +00:00
|
|
|
Signals.addSignalMethods(WorkspacesView.prototype);
|
|
|
|
|
2013-09-11 16:12:42 +00:00
|
|
|
const ExtraWorkspaceView = new Lang.Class({
|
|
|
|
Name: 'ExtraWorkspaceView',
|
|
|
|
Extends: WorkspacesViewBase,
|
|
|
|
|
|
|
|
_init: function(monitorIndex) {
|
|
|
|
this.parent(monitorIndex);
|
|
|
|
this._workspace = new Workspace.Workspace(null, monitorIndex);
|
|
|
|
this.actor.add_actor(this._workspace.actor);
|
|
|
|
},
|
|
|
|
|
|
|
|
_setReservedSlot: function(clone) {
|
|
|
|
this._workspace.setReservedSlot(clone);
|
|
|
|
},
|
|
|
|
|
|
|
|
_syncGeometry: function() {
|
|
|
|
this._workspace.setFullGeometry(this._fullGeometry);
|
|
|
|
this._workspace.setActualGeometry(this._actualGeometry);
|
|
|
|
},
|
|
|
|
|
|
|
|
zoomToOverview: function() {
|
|
|
|
this._workspace.zoomToOverview();
|
|
|
|
},
|
|
|
|
|
|
|
|
zoomFromOverview: function() {
|
|
|
|
this._workspace.zoomFromOverview();
|
|
|
|
},
|
|
|
|
|
|
|
|
syncStacking: function(stackIndices) {
|
|
|
|
this._workspace.syncStacking(stackIndices);
|
|
|
|
},
|
|
|
|
|
|
|
|
startSwipeScroll: function() {
|
|
|
|
},
|
|
|
|
endSwipeScroll: function() {
|
|
|
|
},
|
|
|
|
});
|
2010-10-04 14:42:11 +00:00
|
|
|
|
2013-11-04 22:23:44 +00:00
|
|
|
const DelegateFocusNavigator = new Lang.Class({
|
|
|
|
Name: 'DelegateFocusNavigator',
|
|
|
|
Extends: St.Widget,
|
|
|
|
|
|
|
|
vfunc_navigate_focus: function(from, direction) {
|
|
|
|
return this._delegate.navigateFocus(from, direction);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2011-11-20 17:56:27 +00:00
|
|
|
const WorkspacesDisplay = new Lang.Class({
|
|
|
|
Name: 'WorkspacesDisplay',
|
2010-02-14 23:32:57 +00:00
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
_init: function() {
|
2013-11-04 22:23:44 +00:00
|
|
|
this.actor = new DelegateFocusNavigator({ clip_to_allocation: true });
|
|
|
|
this.actor._delegate = this;
|
2013-06-26 09:12:35 +00:00
|
|
|
this.actor.connect('notify::allocation', Lang.bind(this, this._updateWorkspacesActualGeometry));
|
2011-11-25 23:02:13 +00:00
|
|
|
this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
|
2012-12-13 19:19:44 +00:00
|
|
|
|
2012-12-01 00:37:28 +00:00
|
|
|
let clickAction = new Clutter.ClickAction()
|
|
|
|
clickAction.connect('clicked', Lang.bind(this, function(action) {
|
|
|
|
// Only switch to the workspace when there's no application
|
|
|
|
// windows open. The problem is that it's too easy to miss
|
|
|
|
// an app window and get the wrong one focused.
|
|
|
|
if (action.get_button() == 1 &&
|
|
|
|
this._getPrimaryView().getActiveWorkspace().isEmpty())
|
|
|
|
Main.overview.hide();
|
|
|
|
}));
|
|
|
|
Main.overview.addAction(clickAction);
|
|
|
|
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
|
|
|
|
2014-01-17 13:25:49 +00:00
|
|
|
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
|
2012-12-01 00:37:28 +00:00
|
|
|
panAction.connect('pan', Lang.bind(this, this._onPan));
|
|
|
|
panAction.connect('gesture-begin', Lang.bind(this, function() {
|
2012-11-26 04:40:48 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].startSwipeScroll();
|
|
|
|
return true;
|
|
|
|
}));
|
2013-02-20 07:23:51 +00:00
|
|
|
panAction.connect('gesture-cancel', Lang.bind(this, function() {
|
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].endSwipeScroll();
|
|
|
|
}));
|
2012-12-01 00:37:28 +00:00
|
|
|
panAction.connect('gesture-end', Lang.bind(this, function() {
|
|
|
|
clickAction.release();
|
2012-11-26 04:40:48 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].endSwipeScroll();
|
|
|
|
}));
|
2012-12-01 00:37:28 +00:00
|
|
|
Main.overview.addAction(panAction);
|
|
|
|
this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
2010-10-04 14:42:11 +00:00
|
|
|
|
2011-11-25 17:25:31 +00:00
|
|
|
this._primaryIndex = Main.layoutManager.primaryIndex;
|
2010-10-04 14:42:11 +00:00
|
|
|
|
2012-12-16 23:46:34 +00:00
|
|
|
this._workspacesViews = [];
|
2011-11-28 16:51:53 +00:00
|
|
|
this._primaryScrollAdjustment = null;
|
2011-11-25 17:25:31 +00:00
|
|
|
|
|
|
|
this._settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
|
|
|
this._settings.connect('changed::workspaces-only-on-primary',
|
|
|
|
Lang.bind(this,
|
|
|
|
this._workspacesOnlyOnPrimaryChanged));
|
|
|
|
this._workspacesOnlyOnPrimaryChanged();
|
2011-01-31 01:35:58 +00:00
|
|
|
|
|
|
|
this._switchWorkspaceNotifyId = 0;
|
|
|
|
|
2011-11-25 23:02:13 +00:00
|
|
|
this._notifyOpacityId = 0;
|
2012-10-22 15:39:46 +00:00
|
|
|
this._scrollEventId = 0;
|
2013-02-25 23:25:27 +00:00
|
|
|
|
|
|
|
this._fullGeometry = null;
|
2012-10-19 11:55:18 +00:00
|
|
|
},
|
|
|
|
|
2012-11-26 04:40:48 +00:00
|
|
|
_onPan: function(action) {
|
|
|
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
|
|
|
let adjustment = this._scrollAdjustment;
|
|
|
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2013-11-04 22:23:44 +00:00
|
|
|
navigateFocus: function(from, direction) {
|
|
|
|
return this._getPrimaryView().actor.navigate_focus(from, direction, false);
|
|
|
|
},
|
|
|
|
|
2011-09-01 20:09:46 +00:00
|
|
|
show: function() {
|
2011-11-25 17:25:31 +00:00
|
|
|
this._updateWorkspacesViews();
|
2013-09-11 19:30:13 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].zoomToOverview();
|
2010-02-14 23:32:57 +00:00
|
|
|
|
2011-01-31 01:44:05 +00:00
|
|
|
this._restackedNotifyId =
|
2012-12-13 16:00:30 +00:00
|
|
|
Main.overview.connect('windows-restacked',
|
2011-01-31 01:44:05 +00:00
|
|
|
Lang.bind(this, this._onRestacked));
|
2012-10-22 15:39:46 +00:00
|
|
|
if (this._scrollEventId == 0)
|
|
|
|
this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
2010-10-04 14:42:11 +00:00
|
|
|
},
|
|
|
|
|
2011-11-25 23:02:13 +00:00
|
|
|
zoomFromOverview: function() {
|
2013-09-11 19:30:13 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].zoomFromOverview();
|
2011-11-25 23:02:13 +00:00
|
|
|
},
|
|
|
|
|
2010-10-04 14:42:11 +00:00
|
|
|
hide: function() {
|
2011-01-31 01:44:05 +00:00
|
|
|
if (this._restackedNotifyId > 0){
|
2012-12-13 16:00:30 +00:00
|
|
|
Main.overview.disconnect(this._restackedNotifyId);
|
2011-01-31 01:44:05 +00:00
|
|
|
this._restackedNotifyId = 0;
|
|
|
|
}
|
2012-10-22 15:39:46 +00:00
|
|
|
if (this._scrollEventId > 0) {
|
|
|
|
Main.overview.disconnect(this._scrollEventId);
|
|
|
|
this._scrollEventId = 0;
|
|
|
|
}
|
2011-01-31 01:35:58 +00:00
|
|
|
|
2011-11-25 17:25:31 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].destroy();
|
2012-12-16 23:46:34 +00:00
|
|
|
this._workspacesViews = [];
|
2011-11-25 17:25:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_workspacesOnlyOnPrimaryChanged: function() {
|
|
|
|
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
|
|
|
|
|
|
|
|
if (!Main.overview.visible)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._updateWorkspacesViews();
|
|
|
|
},
|
|
|
|
|
|
|
|
_updateWorkspacesViews: function() {
|
2012-12-16 23:46:34 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].destroy();
|
2011-11-25 17:25:31 +00:00
|
|
|
|
|
|
|
this._workspacesViews = [];
|
|
|
|
let monitors = Main.layoutManager.monitors;
|
|
|
|
for (let i = 0; i < monitors.length; i++) {
|
2013-09-11 16:12:42 +00:00
|
|
|
let view;
|
2011-11-25 17:25:31 +00:00
|
|
|
if (this._workspacesOnlyOnPrimary && i != this._primaryIndex)
|
2013-09-11 16:12:42 +00:00
|
|
|
view = new ExtraWorkspaceView(i);
|
|
|
|
else
|
|
|
|
view = new WorkspacesView(i);
|
2011-11-25 17:25:31 +00:00
|
|
|
|
2012-10-22 15:39:46 +00:00
|
|
|
view.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
2013-09-11 16:12:42 +00:00
|
|
|
if (i == this._primaryIndex) {
|
2011-11-28 16:51:53 +00:00
|
|
|
this._scrollAdjustment = view.scrollAdjustment;
|
|
|
|
this._scrollAdjustment.connect('notify::value',
|
|
|
|
Lang.bind(this, this._scrollValueChanged));
|
|
|
|
}
|
2013-09-11 16:12:42 +00:00
|
|
|
|
2011-11-28 16:51:53 +00:00
|
|
|
this._workspacesViews.push(view);
|
2013-09-11 16:12:42 +00:00
|
|
|
Main.layoutManager.overviewGroup.add_actor(view.actor);
|
2010-10-04 14:42:11 +00:00
|
|
|
}
|
2011-11-25 17:25:31 +00:00
|
|
|
|
2013-02-25 23:25:27 +00:00
|
|
|
this._updateWorkspacesFullGeometry();
|
2013-02-25 23:34:17 +00:00
|
|
|
this._updateWorkspacesActualGeometry();
|
2011-11-25 17:25:31 +00:00
|
|
|
},
|
|
|
|
|
2011-11-28 16:51:53 +00:00
|
|
|
_scrollValueChanged: function() {
|
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++) {
|
|
|
|
if (i == this._primaryIndex)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
let adjustment = this._workspacesViews[i].scrollAdjustment;
|
2013-09-11 16:12:42 +00:00
|
|
|
if (!adjustment)
|
|
|
|
continue;
|
|
|
|
|
2011-11-28 16:51:53 +00:00
|
|
|
// the adjustments work in terms of workspaces, so the
|
|
|
|
// values map directly
|
|
|
|
adjustment.value = this._scrollAdjustment.value;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2011-11-25 17:25:31 +00:00
|
|
|
_getPrimaryView: function() {
|
2012-12-16 23:46:34 +00:00
|
|
|
if (!this._workspacesViews.length)
|
2011-11-25 17:25:31 +00:00
|
|
|
return null;
|
2013-09-11 16:12:42 +00:00
|
|
|
return this._workspacesViews[this._primaryIndex];
|
2010-02-14 23:32:57 +00:00
|
|
|
},
|
|
|
|
|
2011-11-25 23:02:13 +00:00
|
|
|
activeWorkspaceHasMaximizedWindows: function() {
|
2011-11-25 17:25:31 +00:00
|
|
|
return this._getPrimaryView().getActiveWorkspace().hasMaximizedWindows();
|
2011-11-25 23:02:13 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_parentSet: function(actor, oldParent) {
|
|
|
|
if (oldParent && this._notifyOpacityId)
|
|
|
|
oldParent.disconnect(this._notifyOpacityId);
|
|
|
|
this._notifyOpacityId = 0;
|
|
|
|
|
|
|
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
let newParent = this.actor.get_parent();
|
|
|
|
if (!newParent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// This is kinda hackish - we want the primary view to
|
|
|
|
// appear as parent of this.actor, though in reality it
|
2013-05-21 20:15:01 +00:00
|
|
|
// is added directly to Main.layoutManager.overviewGroup
|
2011-11-25 23:02:13 +00:00
|
|
|
this._notifyOpacityId = newParent.connect('notify::opacity',
|
|
|
|
Lang.bind(this, function() {
|
|
|
|
let opacity = this.actor.get_parent().opacity;
|
2011-11-25 17:25:31 +00:00
|
|
|
let primaryView = this._getPrimaryView();
|
|
|
|
if (!primaryView)
|
|
|
|
return;
|
|
|
|
primaryView.actor.opacity = opacity;
|
2012-03-16 22:53:14 +00:00
|
|
|
primaryView.actor.visible = opacity != 0;
|
2011-11-25 23:02:13 +00:00
|
|
|
}));
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
2013-02-25 23:11:59 +00:00
|
|
|
// This geometry should always be the fullest geometry
|
|
|
|
// the workspaces switcher can ever be allocated, as if
|
|
|
|
// the sliding controls were never slid in at all.
|
2013-02-25 23:25:27 +00:00
|
|
|
setWorkspacesFullGeometry: function(geom) {
|
|
|
|
this._fullGeometry = geom;
|
|
|
|
this._updateWorkspacesFullGeometry();
|
2013-02-25 23:11:59 +00:00
|
|
|
},
|
|
|
|
|
2013-02-25 23:25:27 +00:00
|
|
|
_updateWorkspacesFullGeometry: function() {
|
2012-12-16 23:46:34 +00:00
|
|
|
if (!this._workspacesViews.length)
|
2011-02-10 22:15:36 +00:00
|
|
|
return;
|
|
|
|
|
2011-11-25 17:25:31 +00:00
|
|
|
let monitors = Main.layoutManager.monitors;
|
|
|
|
for (let i = 0; i < monitors.length; i++) {
|
2013-09-11 16:12:42 +00:00
|
|
|
let geometry = (i == this._primaryIndex) ? this._fullGeometry : monitors[i];
|
|
|
|
this._workspacesViews[i].setFullGeometry(geometry);
|
2011-11-25 17:25:31 +00:00
|
|
|
}
|
2011-01-31 03:54:05 +00:00
|
|
|
},
|
|
|
|
|
2013-02-25 23:34:17 +00:00
|
|
|
_updateWorkspacesActualGeometry: function() {
|
|
|
|
if (!this._workspacesViews.length)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let [x, y] = this.actor.get_transformed_position();
|
|
|
|
let width = this.actor.allocation.x2 - this.actor.allocation.x1;
|
|
|
|
let height = this.actor.allocation.y2 - this.actor.allocation.y1;
|
2013-09-11 16:12:42 +00:00
|
|
|
let primaryGeometry = { x: x, y: y, width: width, height: height };
|
2013-02-25 23:34:17 +00:00
|
|
|
|
|
|
|
let monitors = Main.layoutManager.monitors;
|
|
|
|
for (let i = 0; i < monitors.length; i++) {
|
2013-09-11 16:12:42 +00:00
|
|
|
let geometry = (i == this._primaryIndex) ? primaryGeometry : monitors[i];
|
|
|
|
this._workspacesViews[i].setActualGeometry(geometry);
|
2013-02-25 23:34:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-12-13 16:00:30 +00:00
|
|
|
_onRestacked: function(overview, stackIndices) {
|
2011-11-25 17:25:31 +00:00
|
|
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
|
|
this._workspacesViews[i].syncStacking(stackIndices);
|
2011-01-31 01:44:05 +00:00
|
|
|
},
|
|
|
|
|
2012-10-22 15:39:46 +00:00
|
|
|
_onScrollEvent: function(actor, event) {
|
|
|
|
if (!this.actor.mapped)
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2013-05-18 18:53:49 +00:00
|
|
|
let activeWs = global.screen.get_active_workspace();
|
|
|
|
let ws;
|
2012-10-22 15:39:46 +00:00
|
|
|
switch (event.get_scroll_direction()) {
|
|
|
|
case Clutter.ScrollDirection.UP:
|
2013-05-18 18:53:49 +00:00
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
|
|
|
|
break;
|
2012-10-22 15:39:46 +00:00
|
|
|
case Clutter.ScrollDirection.DOWN:
|
2013-05-18 18:53:49 +00:00
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
|
|
|
|
break;
|
|
|
|
default:
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2012-10-22 15:39:46 +00:00
|
|
|
}
|
2013-05-18 18:53:49 +00:00
|
|
|
Main.wm.actionMoveWorkspace(ws);
|
2013-11-29 18:17:34 +00:00
|
|
|
return Clutter.EVENT_STOP;
|
2010-02-14 23:32:57 +00:00
|
|
|
}
|
2011-11-20 17:56:27 +00:00
|
|
|
});
|
2010-10-04 14:42:11 +00:00
|
|
|
Signals.addSignalMethods(WorkspacesDisplay.prototype);
|