2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2008-10-31 23:09:46 +00:00
|
|
|
|
2008-11-21 00:53:11 +00:00
|
|
|
const Clutter = imports.gi.Clutter;
|
2011-01-21 13:08:42 +00:00
|
|
|
const Gtk = imports.gi.Gtk;
|
2010-07-15 14:21:32 +00:00
|
|
|
const Meta = imports.gi.Meta;
|
2009-02-02 23:02:16 +00:00
|
|
|
const Mainloop = imports.mainloop;
|
|
|
|
const Signals = imports.signals;
|
2009-04-13 18:45:58 +00:00
|
|
|
const Lang = imports.lang;
|
2010-01-22 02:33:48 +00:00
|
|
|
const St = imports.gi.St;
|
2011-01-05 14:39:36 +00:00
|
|
|
const Shell = imports.gi.Shell;
|
2011-01-05 14:47:27 +00:00
|
|
|
const Gdk = imports.gi.Gdk;
|
2009-02-02 23:02:16 +00:00
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
const AppDisplay = imports.ui.appDisplay;
|
2011-08-26 14:15:38 +00:00
|
|
|
const ContactDisplay = imports.ui.contactDisplay;
|
2010-07-29 07:55:08 +00:00
|
|
|
const Dash = imports.ui.dash;
|
2011-01-05 14:47:27 +00:00
|
|
|
const DND = imports.ui.dnd;
|
2010-01-10 05:09:18 +00:00
|
|
|
const Lightbox = imports.ui.lightbox;
|
2009-02-02 23:02:16 +00:00
|
|
|
const Main = imports.ui.main;
|
2010-07-22 15:49:43 +00:00
|
|
|
const MessageTray = imports.ui.messageTray;
|
2009-02-02 23:02:16 +00:00
|
|
|
const Panel = imports.ui.panel;
|
2011-08-28 14:24:48 +00:00
|
|
|
const Params = imports.misc.params;
|
2010-07-29 07:55:08 +00:00
|
|
|
const PlaceDisplay = imports.ui.placeDisplay;
|
2011-12-15 13:46:12 +00:00
|
|
|
const RemoteSearch = imports.ui.remoteSearch;
|
2009-02-10 16:12:58 +00:00
|
|
|
const Tweener = imports.ui.tweener;
|
2010-07-29 07:55:08 +00:00
|
|
|
const ViewSelector = imports.ui.viewSelector;
|
2011-12-20 17:41:23 +00:00
|
|
|
const Wanda = imports.ui.wanda;
|
2010-01-22 02:33:48 +00:00
|
|
|
const WorkspacesView = imports.ui.workspacesView;
|
2011-03-21 22:20:36 +00:00
|
|
|
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
|
2008-10-31 23:09:46 +00:00
|
|
|
|
2009-08-11 11:46:10 +00:00
|
|
|
// Time for initial animation going into Overview mode
|
2009-06-02 17:43:34 +00:00
|
|
|
const ANIMATION_TIME = 0.25;
|
2008-11-06 14:00:14 +00:00
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
// We split the screen vertically between the dash and the view selector.
|
|
|
|
const DASH_SPLIT_FRACTION = 0.1;
|
2009-06-24 22:24:48 +00:00
|
|
|
|
2011-01-05 14:47:27 +00:00
|
|
|
const DND_WINDOW_SWITCH_TIMEOUT = 1250;
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
const SwipeScrollDirection = {
|
|
|
|
NONE: 0,
|
|
|
|
HORIZONTAL: 1,
|
|
|
|
VERTICAL: 2
|
|
|
|
};
|
|
|
|
|
|
|
|
const SwipeScrollResult = {
|
|
|
|
CANCEL: 0,
|
|
|
|
SWIPE: 1,
|
|
|
|
CLICK: 2
|
|
|
|
};
|
|
|
|
|
2011-11-20 17:56:27 +00:00
|
|
|
const ShellInfo = new Lang.Class({
|
|
|
|
Name: 'ShellInfo',
|
2010-07-22 15:49:43 +00:00
|
|
|
|
|
|
|
_init: function() {
|
|
|
|
this._source = null;
|
2010-02-08 22:50:50 +00:00
|
|
|
this._undoCallback = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
_onUndoClicked: function() {
|
|
|
|
if (this._undoCallback)
|
|
|
|
this._undoCallback();
|
|
|
|
this._undoCallback = null;
|
|
|
|
|
2010-07-22 15:49:43 +00:00
|
|
|
if (this._source)
|
|
|
|
this._source.destroy();
|
2010-02-08 22:50:50 +00:00
|
|
|
},
|
|
|
|
|
2010-03-10 14:14:56 +00:00
|
|
|
setMessage: function(text, undoCallback, undoLabel) {
|
2010-07-22 15:49:43 +00:00
|
|
|
if (this._source == null) {
|
2010-11-30 15:47:28 +00:00
|
|
|
this._source = new MessageTray.SystemNotificationSource();
|
2010-07-22 15:49:43 +00:00
|
|
|
this._source.connect('destroy', Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
this._source = null;
|
|
|
|
}));
|
|
|
|
Main.messageTray.add(this._source);
|
|
|
|
}
|
2010-02-08 22:50:50 +00:00
|
|
|
|
2011-03-21 21:43:34 +00:00
|
|
|
let notification = null;
|
|
|
|
if (this._source.notifications.length == 0) {
|
2010-07-22 15:49:43 +00:00
|
|
|
notification = new MessageTray.Notification(this._source, text, null);
|
2011-03-21 21:43:34 +00:00
|
|
|
} else {
|
|
|
|
notification = this._source.notifications[0];
|
2010-07-22 15:49:43 +00:00
|
|
|
notification.update(text, null, { clear: true });
|
2011-03-21 21:43:34 +00:00
|
|
|
}
|
2010-03-10 14:14:56 +00:00
|
|
|
|
2010-12-16 21:34:39 +00:00
|
|
|
notification.setTransient(true);
|
|
|
|
|
2010-02-08 22:50:50 +00:00
|
|
|
this._undoCallback = undoCallback;
|
2010-07-22 15:49:43 +00:00
|
|
|
if (undoCallback) {
|
|
|
|
notification.addButton('system-undo',
|
|
|
|
undoLabel ? undoLabel : _("Undo"));
|
|
|
|
notification.connect('action-invoked',
|
|
|
|
Lang.bind(this, this._onUndoClicked));
|
|
|
|
}
|
|
|
|
|
|
|
|
this._source.notify(notification);
|
2010-02-08 22:50:50 +00:00
|
|
|
}
|
2011-11-20 17:56:27 +00:00
|
|
|
});
|
2010-02-08 22:50:50 +00:00
|
|
|
|
2011-11-20 17:56:27 +00:00
|
|
|
const Overview = new Lang.Class({
|
|
|
|
Name: 'Overview',
|
2008-11-21 00:53:11 +00:00
|
|
|
|
2011-08-28 14:24:48 +00:00
|
|
|
_init : function(params) {
|
|
|
|
params = Params.parse(params, { isDummy: false });
|
|
|
|
|
|
|
|
this.isDummy = params.isDummy;
|
|
|
|
|
|
|
|
// We only have an overview in user sessions, so
|
|
|
|
// create a dummy overview in other cases
|
|
|
|
if (this.isDummy) {
|
|
|
|
this.animationInProgress = false;
|
|
|
|
this.visible = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-08-29 01:37:41 +00:00
|
|
|
// The main BackgroundActor is inside global.window_group which is
|
|
|
|
// hidden when displaying the overview, so we create a new
|
|
|
|
// one. Instances of this class share a single CoglTexture behind the
|
|
|
|
// scenes which allows us to show the background with different
|
|
|
|
// rendering options without duplicating the texture data.
|
|
|
|
this._background = Meta.BackgroundActor.new_for_screen(global.screen);
|
2010-07-15 14:21:32 +00:00
|
|
|
this._background.hide();
|
|
|
|
global.overlay_group.add_actor(this._background);
|
|
|
|
|
|
|
|
this._desktopFade = new St.Bin();
|
|
|
|
global.overlay_group.add_actor(this._desktopFade);
|
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
this._spacing = 0;
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
this._group = new St.Group({ name: 'overview',
|
|
|
|
reactive: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-08-01 02:12:01 +00:00
|
|
|
this._group._delegate = this;
|
2010-07-29 07:55:08 +00:00
|
|
|
this._group.connect('style-changed',
|
|
|
|
Lang.bind(this, function() {
|
|
|
|
let node = this._group.get_theme_node();
|
|
|
|
let spacing = node.get_length('spacing');
|
|
|
|
if (spacing != this._spacing) {
|
|
|
|
this._spacing = spacing;
|
2011-06-13 13:54:05 +00:00
|
|
|
this._relayout();
|
2010-07-29 07:55:08 +00:00
|
|
|
}
|
|
|
|
}));
|
2009-06-24 22:24:48 +00:00
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
this._scrollDirection = SwipeScrollDirection.NONE;
|
|
|
|
this._scrollAdjustment = null;
|
|
|
|
this._capturedEventId = 0;
|
|
|
|
this._buttonPressId = 0;
|
|
|
|
|
2010-10-04 14:42:11 +00:00
|
|
|
this._workspacesDisplay = null;
|
2010-01-22 02:33:48 +00:00
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
this.visible = false; // animating to overview, in overview, animating out
|
|
|
|
this._shown = false; // show() and not hide()
|
|
|
|
this._shownTemporarily = false; // showTemporarily() and not hideTemporarily()
|
|
|
|
this._modal = false; // have a modal grab
|
2009-08-07 22:22:05 +00:00
|
|
|
this.animationInProgress = false;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-08-01 02:12:01 +00:00
|
|
|
this._hideInProgress = false;
|
2009-06-24 22:24:48 +00:00
|
|
|
|
2009-09-13 18:54:56 +00:00
|
|
|
// During transitions, we raise this to the top to avoid having the overview
|
|
|
|
// area be reactive; it causes too many issues such as double clicks on
|
|
|
|
// Dash elements, or mouseover handlers in the workspaces.
|
|
|
|
this._coverPane = new Clutter.Rectangle({ opacity: 0,
|
|
|
|
reactive: true });
|
|
|
|
this._group.add_actor(this._coverPane);
|
|
|
|
this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return true; }));
|
|
|
|
|
2009-06-24 22:24:48 +00:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-08-01 02:12:01 +00:00
|
|
|
this._group.hide();
|
|
|
|
global.overlay_group.add_actor(this._group);
|
2009-06-24 22:24:48 +00:00
|
|
|
|
2011-02-11 22:53:27 +00:00
|
|
|
this._coverPane.hide();
|
|
|
|
|
|
|
|
// XDND
|
|
|
|
this._dragMonitor = {
|
|
|
|
dragMotion: Lang.bind(this, this._onDragMotion)
|
|
|
|
};
|
|
|
|
|
|
|
|
Main.xdndHandler.connect('drag-begin', Lang.bind(this, this._onDragBegin));
|
|
|
|
Main.xdndHandler.connect('drag-end', Lang.bind(this, this._onDragEnd));
|
|
|
|
|
|
|
|
this._windowSwitchTimeoutId = 0;
|
|
|
|
this._windowSwitchTimestamp = 0;
|
|
|
|
this._lastActiveWorkspaceIndex = -1;
|
|
|
|
this._lastHoveredWindow = null;
|
|
|
|
this._needsFakePointerEvent = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
// The members we construct that are implemented in JS might
|
|
|
|
// want to access the overview as Main.overview to connect
|
|
|
|
// signal handlers and so forth. So we create them after
|
|
|
|
// construction in this init() method.
|
|
|
|
init: function() {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-08-28 14:07:44 +00:00
|
|
|
this._shellInfo = new ShellInfo();
|
2011-02-11 22:53:27 +00:00
|
|
|
|
2011-08-28 13:29:51 +00:00
|
|
|
this._viewSelector = new ViewSelector.ViewSelector();
|
|
|
|
this._group.add_actor(this._viewSelector.actor);
|
2010-07-29 07:55:08 +00:00
|
|
|
|
|
|
|
this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay();
|
2011-08-28 13:29:51 +00:00
|
|
|
this._viewSelector.addViewTab('windows', _("Windows"), this._workspacesDisplay.actor, 'text-x-generic');
|
2010-07-29 07:55:08 +00:00
|
|
|
|
|
|
|
let appView = new AppDisplay.AllAppDisplay();
|
2011-08-28 13:29:51 +00:00
|
|
|
this._viewSelector.addViewTab('applications', _("Applications"), appView.actor, 'system-run');
|
2010-07-29 07:55:08 +00:00
|
|
|
|
|
|
|
// Default search providers
|
2011-12-20 17:41:23 +00:00
|
|
|
// Wanda comes obviously first
|
|
|
|
this.addSearchProvider(new Wanda.WandaSearchProvider());
|
2011-09-03 10:01:33 +00:00
|
|
|
this.addSearchProvider(new AppDisplay.AppSearchProvider());
|
|
|
|
this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
|
|
|
|
this.addSearchProvider(new PlaceDisplay.PlaceSearchProvider());
|
|
|
|
this.addSearchProvider(new ContactDisplay.ContactSearchProvider());
|
2010-07-29 07:55:08 +00:00
|
|
|
|
2011-12-15 13:46:12 +00:00
|
|
|
// Load remote search providers provided by applications
|
|
|
|
RemoteSearch.loadRemoteSearchProviders(Lang.bind(this, this.addSearchProvider));
|
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-08-01 02:12:01 +00:00
|
|
|
// TODO - recalculate everything when desktop size changes
|
2011-08-28 13:35:13 +00:00
|
|
|
this._dash = new Dash.Dash();
|
|
|
|
this._group.add_actor(this._dash.actor);
|
|
|
|
this._dash.actor.add_constraint(this._viewSelector.constrainY);
|
|
|
|
this._dash.actor.add_constraint(this._viewSelector.constrainHeight);
|
|
|
|
this.dashIconSize = this._dash.iconSize;
|
|
|
|
this._dash.connect('icon-size-changed',
|
|
|
|
Lang.bind(this, function() {
|
|
|
|
this.dashIconSize = this._dash.iconSize;
|
|
|
|
}));
|
2009-07-04 16:46:35 +00:00
|
|
|
|
2011-02-03 17:38:03 +00:00
|
|
|
// Translators: this is the name of the dock/favorites area on
|
|
|
|
// the left of the overview
|
2011-08-28 13:35:13 +00:00
|
|
|
Main.ctrlAltTabManager.addGroup(this._dash.actor, _("Dash"), 'user-bookmarks');
|
2011-02-03 17:38:03 +00:00
|
|
|
|
2011-06-13 13:54:05 +00:00
|
|
|
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
|
|
|
|
this._relayout();
|
2009-06-24 22:24:48 +00:00
|
|
|
},
|
|
|
|
|
2011-09-03 10:01:33 +00:00
|
|
|
addSearchProvider: function(provider) {
|
|
|
|
this._viewSelector.addSearchProvider(provider);
|
2011-08-28 11:20:37 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
removeSearchProvider: function(provider) {
|
|
|
|
this._viewSelector.removeSearchProvider(provider);
|
2011-09-03 10:01:33 +00:00
|
|
|
},
|
|
|
|
|
2011-08-28 14:07:44 +00:00
|
|
|
setMessage: function(text, undoCallback, undoLabel) {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-08-28 14:07:44 +00:00
|
|
|
this._shellInfo.setMessage(text, undoCallback, undoLabel);
|
|
|
|
},
|
|
|
|
|
2011-01-05 14:47:27 +00:00
|
|
|
_onDragBegin: function() {
|
|
|
|
DND.addDragMonitor(this._dragMonitor);
|
|
|
|
// Remember the workspace we started from
|
|
|
|
this._lastActiveWorkspaceIndex = global.screen.get_active_workspace_index();
|
|
|
|
},
|
|
|
|
|
|
|
|
_onDragEnd: function(time) {
|
|
|
|
// In case the drag was canceled while in the overview
|
|
|
|
// we have to go back to where we started and hide
|
|
|
|
// the overview
|
|
|
|
if (this._shownTemporarily) {
|
|
|
|
global.screen.get_workspace_by_index(this._lastActiveWorkspaceIndex).activate(time);
|
|
|
|
this.hideTemporarily();
|
|
|
|
}
|
2011-02-24 10:30:46 +00:00
|
|
|
this._resetWindowSwitchTimeout();
|
2011-01-07 10:12:00 +00:00
|
|
|
this._lastHoveredWindow = null;
|
2011-06-27 16:59:56 +00:00
|
|
|
DND.removeDragMonitor(this._dragMonitor);
|
2011-03-13 18:34:47 +00:00
|
|
|
this.endItemDrag();
|
2011-01-05 14:47:27 +00:00
|
|
|
},
|
|
|
|
|
2011-02-24 10:30:46 +00:00
|
|
|
_resetWindowSwitchTimeout: function() {
|
|
|
|
if (this._windowSwitchTimeoutId != 0) {
|
|
|
|
Mainloop.source_remove(this._windowSwitchTimeoutId);
|
|
|
|
this._windowSwitchTimeoutId = 0;
|
|
|
|
this._needsFakePointerEvent = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2011-01-05 14:47:27 +00:00
|
|
|
_fakePointerEvent: function() {
|
|
|
|
let display = Gdk.Display.get_default();
|
|
|
|
let deviceManager = display.get_device_manager();
|
|
|
|
let pointer = deviceManager.get_client_pointer();
|
2011-01-05 22:34:27 +00:00
|
|
|
let [screen, pointerX, pointerY] = pointer.get_position();
|
2011-01-05 14:47:27 +00:00
|
|
|
|
2011-01-05 22:34:27 +00:00
|
|
|
pointer.warp(screen, pointerX, pointerY);
|
2011-01-05 14:47:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_onDragMotion: function(dragEvent) {
|
2011-01-07 10:12:00 +00:00
|
|
|
let targetIsWindow = dragEvent.targetActor &&
|
|
|
|
dragEvent.targetActor._delegate &&
|
2011-03-21 22:20:36 +00:00
|
|
|
dragEvent.targetActor._delegate.metaWindow &&
|
|
|
|
!(dragEvent.targetActor._delegate instanceof WorkspaceThumbnail.WindowClone);
|
2011-01-07 10:12:00 +00:00
|
|
|
|
2011-02-24 10:25:29 +00:00
|
|
|
this._windowSwitchTimestamp = global.get_current_time();
|
|
|
|
|
2011-01-07 10:12:00 +00:00
|
|
|
if (targetIsWindow &&
|
|
|
|
dragEvent.targetActor._delegate.metaWindow == this._lastHoveredWindow)
|
2011-01-20 15:46:55 +00:00
|
|
|
return DND.DragMotionResult.CONTINUE;
|
|
|
|
|
|
|
|
this._lastHoveredWindow = null;
|
2011-01-07 10:12:00 +00:00
|
|
|
|
2011-02-24 10:30:46 +00:00
|
|
|
this._resetWindowSwitchTimeout();
|
2011-01-05 14:47:27 +00:00
|
|
|
|
2011-01-07 10:12:00 +00:00
|
|
|
if (targetIsWindow) {
|
|
|
|
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
|
2011-01-05 14:47:27 +00:00
|
|
|
this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
|
|
|
|
Lang.bind(this, function() {
|
|
|
|
this._needsFakePointerEvent = true;
|
|
|
|
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
|
|
|
|
this._windowSwitchTimestamp);
|
|
|
|
this.hideTemporarily();
|
2011-01-07 10:12:00 +00:00
|
|
|
this._lastHoveredWindow = null;
|
2011-01-05 14:47:27 +00:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
return DND.DragMotionResult.CONTINUE;
|
|
|
|
},
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
setScrollAdjustment: function(adjustment, direction) {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
this._scrollAdjustment = adjustment;
|
|
|
|
if (this._scrollAdjustment == null)
|
|
|
|
this._scrollDirection = SwipeScrollDirection.NONE;
|
|
|
|
else
|
|
|
|
this._scrollDirection = direction;
|
|
|
|
},
|
|
|
|
|
|
|
|
_onButtonPress: function(actor, event) {
|
2011-04-23 07:45:58 +00:00
|
|
|
if (this._scrollDirection == SwipeScrollDirection.NONE
|
|
|
|
|| event.get_button() != 1)
|
2011-01-21 13:08:42 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
let [stageX, stageY] = event.get_coords();
|
|
|
|
this._dragStartX = this._dragX = stageX;
|
|
|
|
this._dragStartY = this._dragY = stageY;
|
|
|
|
this._dragStartValue = this._scrollAdjustment.value;
|
|
|
|
this._lastMotionTime = -1; // used to track "stopping" while swipe-scrolling
|
|
|
|
this._capturedEventId = global.stage.connect('captured-event',
|
|
|
|
Lang.bind(this, this._onCapturedEvent));
|
|
|
|
this.emit('swipe-scroll-begin');
|
|
|
|
},
|
|
|
|
|
|
|
|
_onCapturedEvent: function(actor, event) {
|
|
|
|
let stageX, stageY;
|
2011-01-24 22:15:33 +00:00
|
|
|
let threshold = Gtk.Settings.get_default().gtk_dnd_drag_threshold;
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
switch(event.type()) {
|
|
|
|
case Clutter.EventType.BUTTON_RELEASE:
|
|
|
|
[stageX, stageY] = event.get_coords();
|
|
|
|
|
|
|
|
// default to snapping back to the original value
|
|
|
|
let newValue = this._dragStartValue;
|
|
|
|
|
|
|
|
let minValue = this._scrollAdjustment.lower;
|
|
|
|
let maxValue = this._scrollAdjustment.upper - this._scrollAdjustment.page_size;
|
|
|
|
|
|
|
|
let direction;
|
|
|
|
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
|
|
|
direction = stageX > this._dragStartX ? -1 : 1;
|
|
|
|
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
|
|
|
direction *= -1;
|
|
|
|
} else {
|
|
|
|
direction = stageY > this._dragStartY ? -1 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We default to scroll a full page size; both the first
|
|
|
|
// and the last page may be smaller though, so we need to
|
|
|
|
// adjust difference in those cases.
|
|
|
|
let difference = direction * this._scrollAdjustment.page_size;
|
|
|
|
if (this._dragStartValue + difference > maxValue)
|
|
|
|
difference = maxValue - this._dragStartValue;
|
|
|
|
else if (this._dragStartValue + difference < minValue)
|
|
|
|
difference = minValue - this._dragStartValue;
|
|
|
|
|
|
|
|
// If the user has moved more than half the scroll
|
|
|
|
// difference, we want to "settle" to the new value
|
|
|
|
// even if the user stops dragging rather "throws" by
|
|
|
|
// releasing during the drag.
|
|
|
|
let distance = this._dragStartValue - this._scrollAdjustment.value;
|
|
|
|
let noStop = Math.abs(distance / difference) > 0.5;
|
|
|
|
|
|
|
|
// We detect if the user is stopped by comparing the
|
|
|
|
// timestamp of the button release with the timestamp of
|
|
|
|
// the last motion. Experimentally, a difference of 0 or 1
|
|
|
|
// millisecond indicates that the mouse is in motion, a
|
|
|
|
// larger difference indicates that the mouse is stopped.
|
|
|
|
if ((this._lastMotionTime > 0 &&
|
|
|
|
this._lastMotionTime > event.get_time() - 2) ||
|
|
|
|
noStop) {
|
|
|
|
if (this._dragStartValue + difference >= minValue &&
|
|
|
|
this._dragStartValue + difference <= maxValue)
|
|
|
|
newValue += difference;
|
|
|
|
}
|
|
|
|
|
2011-01-24 21:31:10 +00:00
|
|
|
let result;
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
// See if the user has moved the mouse enough to trigger
|
|
|
|
// a drag
|
|
|
|
if (Math.abs(stageX - this._dragStartX) < threshold &&
|
|
|
|
Math.abs(stageY - this._dragStartY) < threshold) {
|
|
|
|
// no motion? It's a click!
|
2011-01-24 21:31:10 +00:00
|
|
|
result = SwipeScrollResult.CLICK;
|
|
|
|
this.emit('swipe-scroll-end', result);
|
2011-01-21 13:08:42 +00:00
|
|
|
} else {
|
|
|
|
if (newValue == this._dragStartValue)
|
|
|
|
result = SwipeScrollResult.CANCEL;
|
|
|
|
else
|
|
|
|
result = SwipeScrollResult.SWIPE;
|
|
|
|
|
|
|
|
// The event capture handler is disconnected
|
|
|
|
// while scrolling to the final position, so
|
|
|
|
// to avoid undesired prelights we raise
|
|
|
|
// the cover pane.
|
|
|
|
this._coverPane.raise_top();
|
|
|
|
this._coverPane.show();
|
|
|
|
|
|
|
|
Tweener.addTween(this._scrollAdjustment,
|
|
|
|
{ value: newValue,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
onCompleteScope: this,
|
|
|
|
onComplete: function() {
|
|
|
|
this._coverPane.hide();
|
|
|
|
this.emit('swipe-scroll-end',
|
|
|
|
result);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
global.stage.disconnect(this._capturedEventId);
|
|
|
|
this._capturedEventId = 0;
|
|
|
|
|
2011-01-24 21:31:10 +00:00
|
|
|
return result != SwipeScrollResult.CLICK;
|
2011-01-21 13:08:42 +00:00
|
|
|
|
|
|
|
case Clutter.EventType.MOTION:
|
|
|
|
[stageX, stageY] = event.get_coords();
|
|
|
|
let dx = this._dragX - stageX;
|
|
|
|
let dy = this._dragY - stageY;
|
2011-06-13 13:54:05 +00:00
|
|
|
let primary = Main.layoutManager.primaryMonitor;
|
2011-01-21 13:08:42 +00:00
|
|
|
|
2011-01-24 22:15:33 +00:00
|
|
|
this._dragX = stageX;
|
|
|
|
this._dragY = stageY;
|
|
|
|
this._lastMotionTime = event.get_time();
|
|
|
|
|
|
|
|
// See if the user has moved the mouse enough to trigger
|
|
|
|
// a drag
|
|
|
|
if (Math.abs(stageX - this._dragStartX) < threshold &&
|
|
|
|
Math.abs(stageY - this._dragStartY) < threshold)
|
|
|
|
return true;
|
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
|
|
|
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
|
|
|
this._scrollAdjustment.value -= (dx / primary.width) * this._scrollAdjustment.page_size;
|
|
|
|
else
|
|
|
|
this._scrollAdjustment.value += (dx / primary.width) * this._scrollAdjustment.page_size;
|
|
|
|
} else {
|
|
|
|
this._scrollAdjustment.value += (dy / primary.height) * this._scrollAdjustment.page_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Block enter/leave events to avoid prelights
|
|
|
|
// during swipe-scroll
|
|
|
|
case Clutter.EventType.ENTER:
|
|
|
|
case Clutter.EventType.LEAVE:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2010-07-15 14:21:32 +00:00
|
|
|
_getDesktopClone: function() {
|
|
|
|
let windows = global.get_window_actors().filter(function(w) {
|
|
|
|
return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP;
|
|
|
|
});
|
|
|
|
if (windows.length == 0)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
let clone = new Clutter.Clone({ source: windows[0].get_texture() });
|
|
|
|
clone.source.connect('destroy', Lang.bind(this, function() {
|
|
|
|
clone.destroy();
|
|
|
|
}));
|
|
|
|
return clone;
|
|
|
|
},
|
|
|
|
|
2011-06-13 13:54:05 +00:00
|
|
|
_relayout: function () {
|
|
|
|
// To avoid updating the position and size of the workspaces
|
|
|
|
// we just hide the overview. The positions will be updated
|
|
|
|
// when it is next shown.
|
|
|
|
this.hide();
|
|
|
|
|
|
|
|
let primary = Main.layoutManager.primaryMonitor;
|
2009-12-25 11:27:09 +00:00
|
|
|
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
2009-08-25 19:23:53 +00:00
|
|
|
|
2011-03-04 20:54:19 +00:00
|
|
|
let contentY = Main.panel.actor.height;
|
2010-07-29 07:55:08 +00:00
|
|
|
let contentHeight = primary.height - contentY - Main.messageTray.actor.height;
|
2009-09-13 18:54:56 +00:00
|
|
|
|
2010-11-11 17:50:19 +00:00
|
|
|
this._group.set_position(primary.x, primary.y);
|
|
|
|
this._group.set_size(primary.width, primary.height);
|
|
|
|
|
2009-09-13 18:54:56 +00:00
|
|
|
this._coverPane.set_position(0, contentY);
|
2009-08-25 19:23:53 +00:00
|
|
|
this._coverPane.set_size(primary.width, contentHeight);
|
2009-08-09 23:48:54 +00:00
|
|
|
|
2011-02-21 14:32:35 +00:00
|
|
|
let dashWidth = Math.round(DASH_SPLIT_FRACTION * primary.width);
|
|
|
|
let viewWidth = primary.width - dashWidth - this._spacing;
|
2010-07-29 07:55:08 +00:00
|
|
|
let viewHeight = contentHeight - 2 * this._spacing;
|
|
|
|
let viewY = contentY + this._spacing;
|
2011-02-21 14:32:35 +00:00
|
|
|
let viewX = rtl ? 0 : dashWidth + this._spacing;
|
2009-08-09 23:48:54 +00:00
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
// Set the dash's x position - y is handled by a constraint
|
|
|
|
let dashX;
|
2009-12-25 11:27:09 +00:00
|
|
|
if (rtl) {
|
2011-08-28 13:35:13 +00:00
|
|
|
this._dash.actor.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
2010-07-29 07:55:08 +00:00
|
|
|
dashX = primary.width;
|
2009-12-25 11:27:09 +00:00
|
|
|
} else {
|
2010-07-29 07:55:08 +00:00
|
|
|
dashX = 0;
|
2009-12-25 11:27:09 +00:00
|
|
|
}
|
2011-08-28 13:35:13 +00:00
|
|
|
this._dash.actor.set_x(dashX);
|
2009-08-09 23:48:54 +00:00
|
|
|
|
2011-08-28 13:29:51 +00:00
|
|
|
this._viewSelector.actor.set_position(viewX, viewY);
|
|
|
|
this._viewSelector.actor.set_size(viewWidth, viewHeight);
|
2008-12-01 19:51:43 +00:00
|
|
|
},
|
|
|
|
|
2010-05-08 14:06:28 +00:00
|
|
|
//// Public methods ////
|
|
|
|
|
|
|
|
beginItemDrag: function(source) {
|
|
|
|
this.emit('item-drag-begin');
|
2009-03-11 19:21:45 +00:00
|
|
|
},
|
|
|
|
|
2011-03-09 15:40:48 +00:00
|
|
|
cancelledItemDrag: function(source) {
|
|
|
|
this.emit('item-drag-cancelled');
|
|
|
|
},
|
|
|
|
|
2010-05-08 14:06:28 +00:00
|
|
|
endItemDrag: function(source) {
|
|
|
|
this.emit('item-drag-end');
|
|
|
|
},
|
2009-03-11 19:21:45 +00:00
|
|
|
|
2010-11-15 20:58:27 +00:00
|
|
|
beginWindowDrag: function(source) {
|
|
|
|
this.emit('window-drag-begin');
|
|
|
|
},
|
|
|
|
|
2011-03-08 13:44:47 +00:00
|
|
|
cancelledWindowDrag: function(source) {
|
|
|
|
this.emit('window-drag-cancelled');
|
|
|
|
},
|
|
|
|
|
2010-11-15 20:58:27 +00:00
|
|
|
endWindowDrag: function(source) {
|
|
|
|
this.emit('window-drag-end');
|
|
|
|
},
|
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
// show:
|
|
|
|
//
|
|
|
|
// Animates the overview visible and grabs mouse and keyboard input
|
2008-12-01 19:51:43 +00:00
|
|
|
show : function() {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
2011-01-05 14:39:36 +00:00
|
|
|
if (this._shown)
|
2008-12-01 19:51:43 +00:00
|
|
|
return;
|
2011-01-05 14:39:36 +00:00
|
|
|
// Do this manually instead of using _syncInputMode, to handle failure
|
2011-02-16 18:27:05 +00:00
|
|
|
if (!Main.pushModal(this._group))
|
2009-09-16 15:37:51 +00:00
|
|
|
return;
|
2011-01-05 14:39:36 +00:00
|
|
|
this._modal = true;
|
|
|
|
this._animateVisible();
|
|
|
|
this._shown = true;
|
2011-01-21 13:08:42 +00:00
|
|
|
|
|
|
|
this._buttonPressId = this._group.connect('button-press-event',
|
|
|
|
Lang.bind(this, this._onButtonPress));
|
2011-01-05 14:39:36 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_animateVisible: function() {
|
|
|
|
if (this.visible || this.animationInProgress)
|
|
|
|
return;
|
2008-11-28 20:12:20 +00:00
|
|
|
|
2008-12-01 19:51:43 +00:00
|
|
|
this.visible = true;
|
2009-08-07 22:22:05 +00:00
|
|
|
this.animationInProgress = true;
|
2008-11-28 20:12:20 +00:00
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
// All the the actors in the window group are completely obscured,
|
|
|
|
// hiding the group holding them while the Overview is displayed greatly
|
|
|
|
// increases performance of the Overview especially when there are many
|
|
|
|
// windows visible.
|
|
|
|
//
|
|
|
|
// If we switched to displaying the actors in the Overview rather than
|
|
|
|
// clones of them, this would obviously no longer be necessary.
|
2011-08-29 21:55:42 +00:00
|
|
|
//
|
|
|
|
// Disable unredirection while in the overview
|
|
|
|
Meta.disable_unredirect_for_screen(global.screen);
|
2011-07-19 23:45:53 +00:00
|
|
|
global.window_group.hide();
|
2010-07-29 07:55:08 +00:00
|
|
|
this._group.show();
|
|
|
|
this._background.show();
|
2009-08-12 19:09:56 +00:00
|
|
|
|
2010-10-04 14:42:11 +00:00
|
|
|
this._workspacesDisplay.show();
|
2010-02-12 20:12:39 +00:00
|
|
|
|
2010-07-15 14:21:32 +00:00
|
|
|
if (!this._desktopFade.child)
|
|
|
|
this._desktopFade.child = this._getDesktopClone();
|
|
|
|
|
2011-11-25 23:02:13 +00:00
|
|
|
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
|
2010-07-15 14:21:32 +00:00
|
|
|
this._desktopFade.opacity = 255;
|
|
|
|
this._desktopFade.show();
|
|
|
|
Tweener.addTween(this._desktopFade,
|
|
|
|
{ opacity: 0,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2010-11-11 17:50:19 +00:00
|
|
|
this._group.opacity = 0;
|
|
|
|
Tweener.addTween(this._group,
|
2009-08-10 22:31:39 +00:00
|
|
|
{ opacity: 255,
|
|
|
|
transition: 'easeOutQuad',
|
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
|
|
|
time: ANIMATION_TIME,
|
|
|
|
onComplete: this._showDone,
|
|
|
|
onCompleteScope: this
|
2009-03-20 16:06:34 +00:00
|
|
|
});
|
2009-05-07 13:47:48 +00:00
|
|
|
|
2011-08-29 01:41:28 +00:00
|
|
|
Tweener.addTween(this._background,
|
|
|
|
{ dim_factor: 0.4,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
});
|
|
|
|
|
2009-09-13 18:54:56 +00:00
|
|
|
this._coverPane.raise_top();
|
2011-01-21 13:08:42 +00:00
|
|
|
this._coverPane.show();
|
2009-05-07 13:47:48 +00:00
|
|
|
this.emit('showing');
|
2008-12-01 19:51:43 +00:00
|
|
|
},
|
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
// showTemporarily:
|
|
|
|
//
|
|
|
|
// Animates the overview visible without grabbing mouse and keyboard input;
|
|
|
|
// if show() has already been called, this has no immediate effect, but
|
|
|
|
// will result in the overview not being hidden until hideTemporarily() is
|
|
|
|
// called.
|
|
|
|
showTemporarily: function() {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
if (this._shownTemporarily)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._syncInputMode();
|
|
|
|
this._animateVisible();
|
|
|
|
this._shownTemporarily = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
// hide:
|
|
|
|
//
|
|
|
|
// Reverses the effect of show()
|
2009-09-11 16:39:59 +00:00
|
|
|
hide: function() {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
if (!this._shown)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!this._shownTemporarily)
|
|
|
|
this._animateNotVisible();
|
|
|
|
|
|
|
|
this._shown = false;
|
|
|
|
this._syncInputMode();
|
2011-01-21 13:08:42 +00:00
|
|
|
|
|
|
|
if (this._buttonPressId > 0)
|
|
|
|
this._group.disconnect(this._buttonPressId);
|
|
|
|
this._buttonPressId = 0;
|
2011-01-05 14:39:36 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// hideTemporarily:
|
|
|
|
//
|
|
|
|
// Reverses the effect of showTemporarily()
|
|
|
|
hideTemporarily: function() {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
if (!this._shownTemporarily)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!this._shown)
|
|
|
|
this._animateNotVisible();
|
|
|
|
|
|
|
|
this._shownTemporarily = false;
|
|
|
|
this._syncInputMode();
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function() {
|
2011-08-28 14:24:48 +00:00
|
|
|
if (this.isDummy)
|
|
|
|
return;
|
|
|
|
|
2011-01-05 14:39:36 +00:00
|
|
|
if (this._shown)
|
|
|
|
this.hide();
|
|
|
|
else
|
|
|
|
this.show();
|
|
|
|
},
|
|
|
|
|
|
|
|
//// Private methods ////
|
|
|
|
|
|
|
|
_syncInputMode: function() {
|
|
|
|
// We delay input mode changes during animation so that when removing the
|
|
|
|
// overview we don't have a problem with the release of a press/release
|
|
|
|
// going to an application.
|
|
|
|
if (this.animationInProgress)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (this._shown) {
|
|
|
|
if (!this._modal) {
|
2011-02-24 22:29:20 +00:00
|
|
|
if (Main.pushModal(this._group))
|
2011-01-05 14:39:36 +00:00
|
|
|
this._modal = true;
|
|
|
|
else
|
|
|
|
this.hide();
|
|
|
|
}
|
|
|
|
} else if (this._shownTemporarily) {
|
|
|
|
if (this._modal) {
|
2011-02-24 22:29:20 +00:00
|
|
|
Main.popModal(this._group);
|
2011-01-05 14:39:36 +00:00
|
|
|
this._modal = false;
|
|
|
|
}
|
|
|
|
global.stage_input_mode = Shell.StageInputMode.FULLSCREEN;
|
|
|
|
} else {
|
|
|
|
if (this._modal) {
|
2011-02-24 22:29:20 +00:00
|
|
|
Main.popModal(this._group);
|
2011-01-05 14:39:36 +00:00
|
|
|
this._modal = false;
|
|
|
|
}
|
|
|
|
else if (global.stage_input_mode == Shell.StageInputMode.FULLSCREEN)
|
|
|
|
global.stage_input_mode = Shell.StageInputMode.NORMAL;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_animateNotVisible: function() {
|
|
|
|
if (!this.visible || this.animationInProgress)
|
2008-12-01 19:51:43 +00:00
|
|
|
return;
|
|
|
|
|
2009-08-07 22:22:05 +00:00
|
|
|
this.animationInProgress = true;
|
2009-03-20 16:06:34 +00:00
|
|
|
this._hideInProgress = true;
|
2010-07-15 14:21:32 +00:00
|
|
|
|
2011-11-25 23:02:13 +00:00
|
|
|
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
|
2010-07-15 14:21:32 +00:00
|
|
|
this._desktopFade.opacity = 0;
|
|
|
|
this._desktopFade.show();
|
|
|
|
Tweener.addTween(this._desktopFade,
|
|
|
|
{ opacity: 255,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: 'easeOutQuad' });
|
|
|
|
}
|
|
|
|
|
2011-11-25 23:02:13 +00:00
|
|
|
this._workspacesDisplay.zoomFromOverview();
|
2008-12-04 15:16:16 +00:00
|
|
|
|
2010-11-11 17:50:19 +00:00
|
|
|
// Make other elements fade out.
|
|
|
|
Tweener.addTween(this._group,
|
2009-08-10 22:31:39 +00:00
|
|
|
{ opacity: 0,
|
|
|
|
transition: 'easeOutQuad',
|
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
|
|
|
time: ANIMATION_TIME,
|
|
|
|
onComplete: this._hideDone,
|
|
|
|
onCompleteScope: this
|
2008-12-04 15:16:16 +00:00
|
|
|
});
|
2009-05-07 13:47:48 +00:00
|
|
|
|
2011-08-29 01:41:28 +00:00
|
|
|
Tweener.addTween(this._background,
|
|
|
|
{ dim_factor: 1.0,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
});
|
|
|
|
|
2009-09-13 18:54:56 +00:00
|
|
|
this._coverPane.raise_top();
|
2011-01-21 13:08:42 +00:00
|
|
|
this._coverPane.show();
|
2009-05-07 13:47:48 +00:00
|
|
|
this.emit('hiding');
|
|
|
|
},
|
|
|
|
|
2009-04-22 00:23:06 +00:00
|
|
|
_showDone: function() {
|
2009-08-07 22:22:05 +00:00
|
|
|
this.animationInProgress = false;
|
2010-07-15 14:21:32 +00:00
|
|
|
this._desktopFade.hide();
|
2011-01-21 13:08:42 +00:00
|
|
|
this._coverPane.hide();
|
2009-08-07 22:22:05 +00:00
|
|
|
|
2009-05-07 13:47:48 +00:00
|
|
|
this.emit('shown');
|
2011-01-05 14:39:36 +00:00
|
|
|
// Handle any calls to hide* while we were showing
|
|
|
|
if (!this._shown && !this._shownTemporarily)
|
|
|
|
this._animateNotVisible();
|
|
|
|
|
|
|
|
this._syncInputMode();
|
2011-03-21 18:46:46 +00:00
|
|
|
global.sync_pointer();
|
2009-04-22 00:23:06 +00:00
|
|
|
},
|
2009-03-20 16:06:34 +00:00
|
|
|
|
2008-12-04 15:16:16 +00:00
|
|
|
_hideDone: function() {
|
2011-08-29 21:55:42 +00:00
|
|
|
// Re-enable unredirection
|
|
|
|
Meta.enable_unredirect_for_screen(global.screen);
|
|
|
|
|
2011-07-19 23:45:53 +00:00
|
|
|
global.window_group.show();
|
|
|
|
|
2010-07-29 07:55:08 +00:00
|
|
|
this._workspacesDisplay.hide();
|
2010-02-14 23:32:57 +00:00
|
|
|
|
2010-07-15 14:21:32 +00:00
|
|
|
this._desktopFade.hide();
|
|
|
|
this._background.hide();
|
2009-02-03 22:58:33 +00:00
|
|
|
this._group.hide();
|
2009-03-20 16:06:34 +00:00
|
|
|
|
2010-01-22 02:33:48 +00:00
|
|
|
this.visible = false;
|
2009-08-07 22:22:05 +00:00
|
|
|
this.animationInProgress = false;
|
2009-03-20 16:06:34 +00:00
|
|
|
this._hideInProgress = false;
|
2008-12-01 19:51:43 +00:00
|
|
|
|
2011-01-21 13:08:42 +00:00
|
|
|
this._coverPane.hide();
|
2009-09-13 18:54:56 +00:00
|
|
|
|
2009-05-07 13:47:48 +00:00
|
|
|
this.emit('hidden');
|
2011-01-05 14:39:36 +00:00
|
|
|
// Handle any calls to show* while we were hiding
|
|
|
|
if (this._shown || this._shownTemporarily)
|
|
|
|
this._animateVisible();
|
|
|
|
|
|
|
|
this._syncInputMode();
|
2011-01-05 14:47:27 +00:00
|
|
|
|
|
|
|
// Fake a pointer event if requested
|
|
|
|
if (this._needsFakePointerEvent) {
|
|
|
|
this._fakePointerEvent();
|
|
|
|
this._needsFakePointerEvent = false;
|
|
|
|
}
|
2008-12-01 19:51:43 +00:00
|
|
|
}
|
2011-11-20 17:56:27 +00:00
|
|
|
});
|
2009-08-11 11:46:10 +00:00
|
|
|
Signals.addSignalMethods(Overview.prototype);
|