2011-09-28 09:16:26 -04:00
|
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2008-11-21 09:02:09 -05:00
|
|
|
|
|
2019-02-08 22:21:36 -05:00
|
|
|
|
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
|
2012-12-22 22:10:27 -05:00
|
|
|
|
const Mainloop = imports.mainloop;
|
2014-06-25 12:13:26 -04:00
|
|
|
|
const Signals = imports.signals;
|
2008-11-21 09:02:09 -05:00
|
|
|
|
|
2009-04-13 10:55:41 -04:00
|
|
|
|
const AltTab = imports.ui.altTab;
|
2019-01-29 05:48:06 -05:00
|
|
|
|
const AppFavorites = imports.ui.appFavorites;
|
2017-07-15 00:03:55 -04:00
|
|
|
|
const Dialog = imports.ui.dialog;
|
2010-02-12 17:52:15 -05:00
|
|
|
|
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
|
2017-07-13 21:15:17 -04:00
|
|
|
|
const InhibitShortcutsDialog = imports.ui.inhibitShortcutsDialog;
|
2008-11-21 09:02:09 -05:00
|
|
|
|
const Main = imports.ui.main;
|
2013-08-17 11:42:39 -04:00
|
|
|
|
const ModalDialog = imports.ui.modalDialog;
|
2009-02-10 11:12:58 -05:00
|
|
|
|
const Tweener = imports.ui.tweener;
|
2014-03-13 18:51:10 -04:00
|
|
|
|
const WindowMenu = imports.ui.windowMenu;
|
2016-06-22 13:57:12 -04:00
|
|
|
|
const PadOsd = imports.ui.padOsd;
|
2017-02-26 17:48:25 -05:00
|
|
|
|
const EdgeDragAction = imports.ui.edgeDragAction;
|
2017-01-19 13:52:18 -05:00
|
|
|
|
const CloseDialog = imports.ui.closeDialog;
|
2017-06-08 10:49:20 -04:00
|
|
|
|
const SwitchMonitor = imports.ui.switchMonitor;
|
2008-11-21 09:02:09 -05:00
|
|
|
|
|
2018-09-05 20:55:20 -04:00
|
|
|
|
const { loadInterfaceXML } = imports.misc.fileUtils;
|
|
|
|
|
|
2018-06-18 10:38:46 -04:00
|
|
|
|
var SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
|
2017-07-18 13:47:27 -04:00
|
|
|
|
var MINIMIZE_WINDOW_ANIMATION_TIME = 0.2;
|
|
|
|
|
var SHOW_WINDOW_ANIMATION_TIME = 0.15;
|
|
|
|
|
var DIALOG_SHOW_WINDOW_ANIMATION_TIME = 0.1;
|
|
|
|
|
var DESTROY_WINDOW_ANIMATION_TIME = 0.15;
|
|
|
|
|
var DIALOG_DESTROY_WINDOW_ANIMATION_TIME = 0.1;
|
|
|
|
|
var WINDOW_ANIMATION_TIME = 0.25;
|
|
|
|
|
var DIM_BRIGHTNESS = -0.3;
|
|
|
|
|
var DIM_TIME = 0.500;
|
|
|
|
|
var UNDIM_TIME = 0.250;
|
2018-07-13 17:38:03 -04:00
|
|
|
|
var MOTION_THRESHOLD = 100;
|
2017-07-18 13:47:27 -04:00
|
|
|
|
|
|
|
|
|
var ONE_SECOND = 1000; // in ms
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2016-12-28 07:03:53 -05:00
|
|
|
|
const GSD_WACOM_BUS_NAME = 'org.gnome.SettingsDaemon.Wacom';
|
|
|
|
|
const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom';
|
|
|
|
|
|
2018-09-05 20:55:20 -04:00
|
|
|
|
const GsdWacomIface = loadInterfaceXML('org.gnome.SettingsDaemon.Wacom');
|
2016-12-28 07:03:53 -05:00
|
|
|
|
const GsdWacomProxy = Gio.DBusProxy.makeProxyWrapper(GsdWacomIface);
|
|
|
|
|
|
2019-05-23 16:45:44 -04:00
|
|
|
|
var DisplayChangeDialog = GObject.registerClass(
|
|
|
|
|
class DisplayChangeDialog extends ModalDialog.ModalDialog {
|
|
|
|
|
_init(wm) {
|
|
|
|
|
super._init({ styleClass: 'prompt-dialog' });
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
|
|
|
|
this._wm = wm;
|
|
|
|
|
|
2016-06-17 20:14:02 -04:00
|
|
|
|
this._countDown = Meta.MonitorManager.get_display_configuration_timeout();
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-07-15 00:03:55 -04:00
|
|
|
|
let iconName = 'preferences-desktop-display-symbolic';
|
|
|
|
|
let icon = new Gio.ThemedIcon({ name: iconName });
|
|
|
|
|
let title = _("Do you want to keep these display settings?");
|
|
|
|
|
let body = this._formatCountDown();
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-07-15 00:03:55 -04:00
|
|
|
|
this._content = new Dialog.MessageDialogContent({ icon, title, body });
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-07-15 00:03:55 -04:00
|
|
|
|
this.contentLayout.add(this._content,
|
|
|
|
|
{ x_fill: true,
|
|
|
|
|
y_fill: true });
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2019-05-15 15:32:29 -04:00
|
|
|
|
/* Translators: this and the following message should be limited in length,
|
2013-08-17 11:42:39 -04:00
|
|
|
|
to avoid ellipsizing the labels.
|
|
|
|
|
*/
|
|
|
|
|
this._cancelButton = this.addButton({ label: _("Revert Settings"),
|
2017-12-01 19:27:35 -05:00
|
|
|
|
action: this._onFailure.bind(this),
|
2015-07-29 07:45:11 -04:00
|
|
|
|
key: Clutter.Escape });
|
2019-01-28 20:27:05 -05:00
|
|
|
|
this._okButton = this.addButton({ label: _("Keep Changes"),
|
2017-12-01 19:27:35 -05:00
|
|
|
|
action: this._onSuccess.bind(this),
|
2015-07-29 07:45:11 -04:00
|
|
|
|
default: true });
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._timeoutId = Mainloop.timeout_add(ONE_SECOND, this._tick.bind(this));
|
2014-04-10 13:26:52 -04:00
|
|
|
|
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick');
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
close(timestamp) {
|
2013-08-17 11:42:39 -04:00
|
|
|
|
if (this._timeoutId > 0) {
|
|
|
|
|
Mainloop.source_remove(this._timeoutId);
|
|
|
|
|
this._timeoutId = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
super.close(timestamp);
|
|
|
|
|
}
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_formatCountDown() {
|
2013-08-17 11:42:39 -04:00
|
|
|
|
let fmt = ngettext("Settings changes will revert in %d second",
|
|
|
|
|
"Settings changes will revert in %d seconds");
|
|
|
|
|
return fmt.format(this._countDown);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_tick() {
|
2013-08-17 11:42:39 -04:00
|
|
|
|
this._countDown--;
|
|
|
|
|
|
|
|
|
|
if (this._countDown == 0) {
|
|
|
|
|
/* mutter already takes care of failing at timeout */
|
|
|
|
|
this._timeoutId = 0;
|
|
|
|
|
this.close();
|
2013-11-28 19:45:39 -05:00
|
|
|
|
return GLib.SOURCE_REMOVE;
|
2013-08-17 11:42:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-15 00:03:55 -04:00
|
|
|
|
this._content.body = this._formatCountDown();
|
2013-11-28 19:45:39 -05:00
|
|
|
|
return GLib.SOURCE_CONTINUE;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_onFailure() {
|
2013-08-17 11:42:39 -04:00
|
|
|
|
this._wm.complete_display_change(false);
|
|
|
|
|
this.close();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_onSuccess() {
|
2013-08-17 11:42:39 -04:00
|
|
|
|
this._wm.complete_display_change(true);
|
|
|
|
|
this.close();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2019-05-23 16:45:44 -04:00
|
|
|
|
});
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
var WindowDimmer = class {
|
|
|
|
|
constructor(actor) {
|
2012-07-13 13:57:36 -04:00
|
|
|
|
this._brightnessEffect = new Clutter.BrightnessContrastEffect();
|
|
|
|
|
actor.add_effect(this._brightnessEffect);
|
2010-09-10 21:30:50 -04:00
|
|
|
|
this.actor = actor;
|
2012-08-30 15:32:44 -04:00
|
|
|
|
this._enabled = true;
|
2012-07-13 13:57:36 -04:00
|
|
|
|
this._dimFactor = 0.0;
|
2012-08-30 15:32:44 -04:00
|
|
|
|
this._syncEnabled();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-08-30 15:32:44 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_syncEnabled() {
|
2012-08-30 15:32:44 -04:00
|
|
|
|
this._brightnessEffect.enabled = (this._enabled && this._dimFactor > 0);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
setEnabled(enabled) {
|
2012-08-30 15:32:44 -04:00
|
|
|
|
this._enabled = enabled;
|
|
|
|
|
this._syncEnabled();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2012-07-13 13:57:36 -04:00
|
|
|
|
set dimFactor(factor) {
|
|
|
|
|
this._dimFactor = factor;
|
|
|
|
|
this._brightnessEffect.set_brightness(factor * DIM_BRIGHTNESS);
|
2012-08-30 15:32:44 -04:00
|
|
|
|
this._syncEnabled();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2012-07-13 13:57:36 -04:00
|
|
|
|
get dimFactor() {
|
|
|
|
|
return this._dimFactor;
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
};
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2011-09-20 14:21:45 -04:00
|
|
|
|
function getWindowDimmer(actor) {
|
2012-08-30 15:32:44 -04:00
|
|
|
|
let enabled = Meta.prefs_get_attach_modal_dialogs();
|
|
|
|
|
if (actor._windowDimmer)
|
|
|
|
|
actor._windowDimmer.setEnabled(enabled);
|
|
|
|
|
|
|
|
|
|
if (enabled) {
|
|
|
|
|
if (!actor._windowDimmer)
|
|
|
|
|
actor._windowDimmer = new WindowDimmer(actor);
|
|
|
|
|
return actor._windowDimmer;
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
}
|
2008-11-21 16:34:10 -05:00
|
|
|
|
|
2012-12-22 22:10:27 -05:00
|
|
|
|
/*
|
|
|
|
|
* When the last window closed on a workspace is a dialog or splash
|
|
|
|
|
* screen, we assume that it might be an initial window shown before
|
|
|
|
|
* the main window of an application, and give the app a grace period
|
|
|
|
|
* where it can map another window before we remove the workspace.
|
|
|
|
|
*/
|
2017-07-18 13:47:27 -04:00
|
|
|
|
var LAST_WINDOW_GRACE_TIME = 1000;
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
var WorkspaceTracker = class {
|
|
|
|
|
constructor(wm) {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
this._wm = wm;
|
|
|
|
|
|
|
|
|
|
this._workspaces = [];
|
|
|
|
|
this._checkWorkspacesId = 0;
|
|
|
|
|
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._pauseWorkspaceCheck = false;
|
|
|
|
|
|
2012-12-22 22:10:27 -05:00
|
|
|
|
let tracker = Shell.WindowTracker.get_default();
|
2017-12-01 19:27:35 -05:00
|
|
|
|
tracker.connect('startup-sequence-changed', this._queueCheckWorkspaces.bind(this));
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
workspaceManager.connect('notify::n-workspaces',
|
|
|
|
|
this._nWorkspacesChanged.bind(this));
|
|
|
|
|
global.window_manager.connect('switch-workspace',
|
|
|
|
|
this._queueCheckWorkspaces.bind(this));
|
|
|
|
|
|
|
|
|
|
global.display.connect('window-entered-monitor',
|
|
|
|
|
this._windowEnteredMonitor.bind(this));
|
|
|
|
|
global.display.connect('window-left-monitor',
|
|
|
|
|
this._windowLeftMonitor.bind(this));
|
|
|
|
|
global.display.connect('restacked',
|
|
|
|
|
this._windowsRestacked.bind(this));
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-08-16 15:15:48 -04:00
|
|
|
|
this._workspaceSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' });
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this));
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
|
|
|
|
this._nWorkspacesChanged();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
blockUpdates() {
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._pauseWorkspaceCheck = true;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-03-27 09:34:28 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
unblockUpdates() {
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._pauseWorkspaceCheck = false;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-03-27 09:34:28 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_checkWorkspaces() {
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
2012-12-22 22:10:27 -05:00
|
|
|
|
let i;
|
|
|
|
|
let emptyWorkspaces = [];
|
|
|
|
|
|
|
|
|
|
if (!Meta.prefs_get_dynamic_workspaces()) {
|
|
|
|
|
this._checkWorkspacesId = 0;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-27 09:34:28 -04:00
|
|
|
|
// Update workspaces only if Dynamic Workspace Management has not been paused by some other function
|
|
|
|
|
if (this._pauseWorkspaceCheck)
|
|
|
|
|
return true;
|
|
|
|
|
|
2012-12-22 22:10:27 -05:00
|
|
|
|
for (i = 0; i < this._workspaces.length; i++) {
|
|
|
|
|
let lastRemoved = this._workspaces[i]._lastRemovedWindow;
|
|
|
|
|
if ((lastRemoved &&
|
|
|
|
|
(lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN ||
|
|
|
|
|
lastRemoved.get_window_type() == Meta.WindowType.DIALOG ||
|
|
|
|
|
lastRemoved.get_window_type() == Meta.WindowType.MODAL_DIALOG)) ||
|
|
|
|
|
this._workspaces[i]._keepAliveId)
|
|
|
|
|
emptyWorkspaces[i] = false;
|
|
|
|
|
else
|
|
|
|
|
emptyWorkspaces[i] = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let sequences = Shell.WindowTracker.get_default().get_startup_sequences();
|
|
|
|
|
for (i = 0; i < sequences.length; i++) {
|
|
|
|
|
let index = sequences[i].get_workspace();
|
2018-01-03 02:55:38 -05:00
|
|
|
|
if (index >= 0 && index <= workspaceManager.n_workspaces)
|
2012-12-22 22:10:27 -05:00
|
|
|
|
emptyWorkspaces[index] = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let windows = global.get_window_actors();
|
|
|
|
|
for (i = 0; i < windows.length; i++) {
|
2013-11-04 21:24:27 -05:00
|
|
|
|
let actor = windows[i];
|
|
|
|
|
let win = actor.get_meta_window();
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2013-11-04 21:24:27 -05:00
|
|
|
|
if (win.is_on_all_workspaces())
|
2012-12-22 22:10:27 -05:00
|
|
|
|
continue;
|
|
|
|
|
|
2013-11-04 21:24:27 -05:00
|
|
|
|
let workspaceIndex = win.get_workspace().index();
|
2012-12-22 22:10:27 -05:00
|
|
|
|
emptyWorkspaces[workspaceIndex] = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we don't have an empty workspace at the end, add one
|
2019-01-28 20:27:05 -05:00
|
|
|
|
if (!emptyWorkspaces[emptyWorkspaces.length - 1]) {
|
2018-01-03 02:55:38 -05:00
|
|
|
|
workspaceManager.append_new_workspace(false, global.get_current_time());
|
2018-09-05 09:27:02 -04:00
|
|
|
|
emptyWorkspaces.push(true);
|
2012-12-22 22:10:27 -05:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-05 09:27:02 -04:00
|
|
|
|
let lastIndex = emptyWorkspaces.length - 1;
|
|
|
|
|
let lastEmptyIndex = emptyWorkspaces.lastIndexOf(false) + 1;
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
2013-09-30 13:59:09 -04:00
|
|
|
|
emptyWorkspaces[activeWorkspaceIndex] = false;
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2018-09-05 09:27:02 -04:00
|
|
|
|
// Delete empty workspaces except for the last one; do it from the end
|
|
|
|
|
// to avoid index changes
|
|
|
|
|
for (i = lastIndex; i >= 0; i--) {
|
|
|
|
|
if (emptyWorkspaces[i] && i != lastEmptyIndex)
|
2018-01-03 02:55:38 -05:00
|
|
|
|
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
|
2012-12-22 22:10:27 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._checkWorkspacesId = 0;
|
|
|
|
|
return false;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
keepWorkspaceAlive(workspace, duration) {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
if (workspace._keepAliveId)
|
|
|
|
|
Mainloop.source_remove(workspace._keepAliveId);
|
|
|
|
|
|
2017-10-30 20:38:18 -04:00
|
|
|
|
workspace._keepAliveId = Mainloop.timeout_add(duration, () => {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
workspace._keepAliveId = 0;
|
|
|
|
|
this._queueCheckWorkspaces();
|
2013-11-28 19:45:39 -05:00
|
|
|
|
return GLib.SOURCE_REMOVE;
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2014-04-10 13:26:52 -04:00
|
|
|
|
GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_windowRemoved(workspace, window) {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
workspace._lastRemovedWindow = window;
|
|
|
|
|
this._queueCheckWorkspaces();
|
2017-10-30 20:38:18 -04:00
|
|
|
|
let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, () => {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
if (workspace._lastRemovedWindow == window) {
|
|
|
|
|
workspace._lastRemovedWindow = null;
|
|
|
|
|
this._queueCheckWorkspaces();
|
|
|
|
|
}
|
2013-11-28 19:45:39 -05:00
|
|
|
|
return GLib.SOURCE_REMOVE;
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2014-04-10 13:26:52 -04:00
|
|
|
|
GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
// If the window left the primary monitor, that
|
|
|
|
|
// might make that workspace empty
|
|
|
|
|
if (monitorIndex == Main.layoutManager.primaryIndex)
|
|
|
|
|
this._queueCheckWorkspaces();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
// If the window entered the primary monitor, that
|
|
|
|
|
// might make that workspace non-empty
|
|
|
|
|
if (monitorIndex == Main.layoutManager.primaryIndex)
|
|
|
|
|
this._queueCheckWorkspaces();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_windowsRestacked() {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
// Figure out where the pointer is in case we lost track of
|
|
|
|
|
// it during a grab. (In particular, if a trayicon popup menu
|
|
|
|
|
// is dismissed, see if we need to close the message tray.)
|
|
|
|
|
global.sync_pointer();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_queueCheckWorkspaces() {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
if (this._checkWorkspacesId == 0)
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._checkWorkspacesId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._checkWorkspaces.bind(this));
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_nWorkspacesChanged() {
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
2012-12-22 22:10:27 -05:00
|
|
|
|
let oldNumWorkspaces = this._workspaces.length;
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let newNumWorkspaces = workspaceManager.n_workspaces;
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
|
|
|
|
if (oldNumWorkspaces == newNumWorkspaces)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (newNumWorkspaces > oldNumWorkspaces) {
|
|
|
|
|
let w;
|
|
|
|
|
|
|
|
|
|
// Assume workspaces are only added at the end
|
|
|
|
|
for (w = oldNumWorkspaces; w < newNumWorkspaces; w++)
|
2018-01-03 02:55:38 -05:00
|
|
|
|
this._workspaces[w] = workspaceManager.get_workspace_by_index(w);
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
|
|
|
|
for (w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
|
|
|
|
let workspace = this._workspaces[w];
|
2017-12-01 19:27:35 -05:00
|
|
|
|
workspace._windowAddedId = workspace.connect('window-added', this._queueCheckWorkspaces.bind(this));
|
|
|
|
|
workspace._windowRemovedId = workspace.connect('window-removed', this._windowRemoved.bind(this));
|
2012-12-22 22:10:27 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// Assume workspaces are only removed sequentially
|
|
|
|
|
// (e.g. 2,3,4 - not 2,4,7)
|
|
|
|
|
let removedIndex;
|
|
|
|
|
let removedNum = oldNumWorkspaces - newNumWorkspaces;
|
|
|
|
|
for (let w = 0; w < oldNumWorkspaces; w++) {
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspace = workspaceManager.get_workspace_by_index(w);
|
2012-12-22 22:10:27 -05:00
|
|
|
|
if (this._workspaces[w] != workspace) {
|
|
|
|
|
removedIndex = w;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lostWorkspaces = this._workspaces.splice(removedIndex, removedNum);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
lostWorkspaces.forEach(workspace => {
|
2012-12-22 22:10:27 -05:00
|
|
|
|
workspace.disconnect(workspace._windowAddedId);
|
|
|
|
|
workspace.disconnect(workspace._windowRemovedId);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._queueCheckWorkspaces();
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
};
|
2012-12-22 22:10:27 -05:00
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
var TilePreview = class {
|
|
|
|
|
constructor() {
|
2013-09-01 20:17:58 -04:00
|
|
|
|
this.actor = new St.Widget();
|
2013-09-01 18:26:12 -04:00
|
|
|
|
global.window_group.add_actor(this.actor);
|
|
|
|
|
|
2013-09-01 20:17:58 -04:00
|
|
|
|
this._reset();
|
2013-09-01 18:26:12 -04:00
|
|
|
|
this._showing = false;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
show(window, tileRect, monitorIndex) {
|
2013-09-01 18:26:12 -04:00
|
|
|
|
let windowActor = window.get_compositor_private();
|
|
|
|
|
if (!windowActor)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
global.window_group.set_child_below_sibling(this.actor, windowActor);
|
|
|
|
|
|
2013-09-01 20:17:58 -04:00
|
|
|
|
if (this._rect && this._rect.equal(tileRect))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
let changeMonitor = (this._monitorIndex == -1 ||
|
|
|
|
|
this._monitorIndex != monitorIndex);
|
|
|
|
|
|
|
|
|
|
this._monitorIndex = monitorIndex;
|
|
|
|
|
this._rect = tileRect;
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2013-09-01 20:17:58 -04:00
|
|
|
|
let monitor = Main.layoutManager.monitors[monitorIndex];
|
|
|
|
|
|
|
|
|
|
this._updateStyle(monitor);
|
|
|
|
|
|
|
|
|
|
if (!this._showing || changeMonitor) {
|
|
|
|
|
let monitorRect = new Meta.Rectangle({ x: monitor.x,
|
|
|
|
|
y: monitor.y,
|
|
|
|
|
width: monitor.width,
|
|
|
|
|
height: monitor.height });
|
2014-09-18 17:02:45 -04:00
|
|
|
|
let [, rect] = window.get_frame_rect().intersect(monitorRect);
|
2013-09-01 20:17:58 -04:00
|
|
|
|
this.actor.set_size(rect.width, rect.height);
|
|
|
|
|
this.actor.set_position(rect.x, rect.y);
|
|
|
|
|
this.actor.opacity = 0;
|
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
|
|
|
|
this._showing = true;
|
|
|
|
|
this.actor.show();
|
2013-09-01 20:17:58 -04:00
|
|
|
|
Tweener.addTween(this.actor,
|
|
|
|
|
{ x: tileRect.x,
|
|
|
|
|
y: tileRect.y,
|
|
|
|
|
width: tileRect.width,
|
|
|
|
|
height: tileRect.height,
|
|
|
|
|
opacity: 255,
|
|
|
|
|
time: WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
|
});
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
hide() {
|
2013-09-01 18:26:12 -04:00
|
|
|
|
if (!this._showing)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this._showing = false;
|
2013-09-01 20:17:58 -04:00
|
|
|
|
Tweener.addTween(this.actor,
|
|
|
|
|
{ opacity: 0,
|
|
|
|
|
time: WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad',
|
2017-12-01 19:27:35 -05:00
|
|
|
|
onComplete: this._reset.bind(this)
|
2013-09-01 20:17:58 -04:00
|
|
|
|
});
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_reset() {
|
2013-09-01 20:17:58 -04:00
|
|
|
|
this.actor.hide();
|
|
|
|
|
this._rect = null;
|
|
|
|
|
this._monitorIndex = -1;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_updateStyle(monitor) {
|
2013-09-01 18:26:12 -04:00
|
|
|
|
let styles = ['tile-preview'];
|
2013-09-01 20:17:58 -04:00
|
|
|
|
if (this._monitorIndex == Main.layoutManager.primaryIndex)
|
2013-09-01 18:26:12 -04:00
|
|
|
|
styles.push('on-primary');
|
2013-09-01 20:17:58 -04:00
|
|
|
|
if (this._rect.x == monitor.x)
|
2013-09-01 18:26:12 -04:00
|
|
|
|
styles.push('tile-preview-left');
|
2013-09-01 20:17:58 -04:00
|
|
|
|
if (this._rect.x + this._rect.width == monitor.x + monitor.width)
|
2013-09-01 18:26:12 -04:00
|
|
|
|
styles.push('tile-preview-right');
|
|
|
|
|
|
|
|
|
|
this.actor.style_class = styles.join(' ');
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
};
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
var TouchpadWorkspaceSwitchAction = class {
|
2019-03-20 11:19:47 -04:00
|
|
|
|
constructor(actor, allowedModes) {
|
|
|
|
|
this._allowedModes = allowedModes;
|
2015-07-22 15:19:18 -04:00
|
|
|
|
this._dx = 0;
|
|
|
|
|
this._dy = 0;
|
2019-03-20 13:03:27 -04:00
|
|
|
|
this._enabled = true;
|
2017-12-01 19:27:35 -05:00
|
|
|
|
actor.connect('captured-event', this._handleEvent.bind(this));
|
2019-01-29 15:18:46 -05:00
|
|
|
|
this._touchpadSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.peripherals.touchpad' });
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
2019-03-20 13:03:27 -04:00
|
|
|
|
get enabled() {
|
|
|
|
|
return this._enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set enabled(enabled) {
|
|
|
|
|
if (this._enabled == enabled)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this._enabled = enabled;
|
|
|
|
|
if (!enabled)
|
|
|
|
|
this.emit('cancel');
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_checkActivated() {
|
2015-07-22 15:19:18 -04:00
|
|
|
|
let dir;
|
|
|
|
|
|
|
|
|
|
if (this._dy < -MOTION_THRESHOLD)
|
|
|
|
|
dir = Meta.MotionDirection.DOWN;
|
|
|
|
|
else if (this._dy > MOTION_THRESHOLD)
|
|
|
|
|
dir = Meta.MotionDirection.UP;
|
|
|
|
|
else if (this._dx < -MOTION_THRESHOLD)
|
|
|
|
|
dir = Meta.MotionDirection.RIGHT;
|
|
|
|
|
else if (this._dx > MOTION_THRESHOLD)
|
|
|
|
|
dir = Meta.MotionDirection.LEFT;
|
|
|
|
|
else
|
2018-07-13 17:38:03 -04:00
|
|
|
|
return false;
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
|
|
|
|
this.emit('activated', dir);
|
2018-07-13 17:38:03 -04:00
|
|
|
|
return true;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_handleEvent(actor, event) {
|
2015-07-22 15:19:18 -04:00
|
|
|
|
if (event.type() != Clutter.EventType.TOUCHPAD_SWIPE)
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
2016-05-03 07:22:53 -04:00
|
|
|
|
if (event.get_touchpad_gesture_finger_count() != 4)
|
2015-07-22 15:19:18 -04:00
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
2019-03-20 11:19:47 -04:00
|
|
|
|
if ((this._allowedModes & Main.actionMode) == 0)
|
2018-07-13 17:38:03 -04:00
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
2019-03-20 13:03:27 -04:00
|
|
|
|
if (!this._enabled)
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
2015-07-22 15:19:18 -04:00
|
|
|
|
if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.UPDATE) {
|
2017-09-18 13:37:07 -04:00
|
|
|
|
let [dx, dy] = event.get_gesture_motion_delta();
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
2018-07-13 17:38:03 -04:00
|
|
|
|
// Scale deltas up a bit to make it feel snappier
|
|
|
|
|
this._dx += dx * 2;
|
2019-01-28 20:27:05 -05:00
|
|
|
|
if (!(this._touchpadSettings.get_boolean('natural-scroll')))
|
2019-01-29 15:18:46 -05:00
|
|
|
|
this._dy -= dy * 2;
|
|
|
|
|
else
|
|
|
|
|
this._dy += dy * 2;
|
|
|
|
|
|
2018-07-13 17:38:03 -04:00
|
|
|
|
this.emit('motion', this._dx, this._dy);
|
2015-07-22 15:19:18 -04:00
|
|
|
|
} else {
|
2018-07-13 17:38:03 -04:00
|
|
|
|
if ((event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END && ! this._checkActivated()) ||
|
|
|
|
|
event.get_gesture_phase() == Clutter.TouchpadGesturePhase.CANCEL)
|
|
|
|
|
this.emit('cancel');
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
|
|
|
|
this._dx = 0;
|
|
|
|
|
this._dy = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Clutter.EVENT_STOP;
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
};
|
2015-07-22 15:19:18 -04:00
|
|
|
|
Signals.addSignalMethods(TouchpadWorkspaceSwitchAction.prototype);
|
|
|
|
|
|
2017-10-30 21:23:39 -04:00
|
|
|
|
var WorkspaceSwitchAction = GObject.registerClass({
|
2018-07-13 17:38:03 -04:00
|
|
|
|
Signals: { 'activated': { param_types: [Meta.MotionDirection.$gtype] },
|
|
|
|
|
'motion': { param_types: [GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
|
2019-01-28 20:27:05 -05:00
|
|
|
|
'cancel': { param_types: [] } },
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}, class WorkspaceSwitchAction extends Clutter.SwipeAction {
|
2019-03-20 11:19:47 -04:00
|
|
|
|
_init(allowedModes) {
|
2017-10-30 21:23:39 -04:00
|
|
|
|
super._init();
|
2014-06-25 12:13:26 -04:00
|
|
|
|
this.set_n_touch_points(4);
|
2018-07-13 17:38:03 -04:00
|
|
|
|
this._swept = false;
|
2019-03-20 11:19:47 -04:00
|
|
|
|
this._allowedModes = allowedModes;
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2017-10-30 20:38:18 -04:00
|
|
|
|
global.display.connect('grab-op-begin', () => {
|
2014-06-25 12:13:26 -04:00
|
|
|
|
this.cancel();
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
vfunc_gesture_prepare(actor) {
|
2018-07-13 17:38:03 -04:00
|
|
|
|
this._swept = false;
|
|
|
|
|
|
2017-10-30 21:23:39 -04:00
|
|
|
|
if (!super.vfunc_gesture_prepare(actor))
|
2015-05-22 13:05:10 -04:00
|
|
|
|
return false;
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2019-03-20 11:19:47 -04:00
|
|
|
|
return (this._allowedModes & Main.actionMode);
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2018-07-13 17:38:03 -04:00
|
|
|
|
vfunc_gesture_progress(actor) {
|
|
|
|
|
let [x, y] = this.get_motion_coords(0);
|
|
|
|
|
let [xPress, yPress] = this.get_press_coords(0);
|
|
|
|
|
this.emit('motion', x - xPress, y - yPress);
|
|
|
|
|
return true;
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2018-07-13 17:38:03 -04:00
|
|
|
|
|
|
|
|
|
vfunc_gesture_cancel(actor) {
|
|
|
|
|
if (!this._swept)
|
|
|
|
|
this.emit('cancel');
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2018-07-13 17:38:03 -04:00
|
|
|
|
|
|
|
|
|
vfunc_swipe(actor, direction) {
|
|
|
|
|
let [x, y] = this.get_motion_coords(0);
|
|
|
|
|
let [xPress, yPress] = this.get_press_coords(0);
|
|
|
|
|
if (Math.abs(x - xPress) < MOTION_THRESHOLD &&
|
|
|
|
|
Math.abs(y - yPress) < MOTION_THRESHOLD) {
|
|
|
|
|
this.emit('cancel');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-22 13:05:10 -04:00
|
|
|
|
let dir;
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2015-05-22 13:05:10 -04:00
|
|
|
|
if (direction & Clutter.SwipeDirection.UP)
|
|
|
|
|
dir = Meta.MotionDirection.DOWN;
|
|
|
|
|
else if (direction & Clutter.SwipeDirection.DOWN)
|
|
|
|
|
dir = Meta.MotionDirection.UP;
|
|
|
|
|
else if (direction & Clutter.SwipeDirection.LEFT)
|
|
|
|
|
dir = Meta.MotionDirection.RIGHT;
|
|
|
|
|
else if (direction & Clutter.SwipeDirection.RIGHT)
|
|
|
|
|
dir = Meta.MotionDirection.LEFT;
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2018-07-13 17:38:03 -04:00
|
|
|
|
this._swept = true;
|
2015-05-22 13:05:10 -04:00
|
|
|
|
this.emit('activated', dir);
|
2014-06-25 12:13:26 -04:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2017-10-30 21:23:39 -04:00
|
|
|
|
var AppSwitchAction = GObject.registerClass({
|
2017-02-14 12:24:50 -05:00
|
|
|
|
Signals: { 'activated': {} },
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}, class AppSwitchAction extends Clutter.GestureAction {
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_init() {
|
2017-10-30 21:23:39 -04:00
|
|
|
|
super._init();
|
2014-06-27 16:45:58 -04:00
|
|
|
|
this.set_n_touch_points(3);
|
|
|
|
|
|
2017-10-30 20:38:18 -04:00
|
|
|
|
global.display.connect('grab-op-begin', () => {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
this.cancel();
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
2019-01-31 16:07:38 -05:00
|
|
|
|
vfunc_gesture_prepare(actor) {
|
2014-12-11 09:35:40 -05:00
|
|
|
|
if (Main.actionMode != Shell.ActionMode.NORMAL) {
|
2014-09-05 16:44:19 -04:00
|
|
|
|
this.cancel();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-27 16:45:58 -04:00
|
|
|
|
return this.get_n_current_points() <= 4;
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
2019-01-31 16:07:38 -05:00
|
|
|
|
vfunc_gesture_begin(actor) {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
// in milliseconds
|
|
|
|
|
const LONG_PRESS_TIMEOUT = 250;
|
|
|
|
|
|
|
|
|
|
let nPoints = this.get_n_current_points();
|
|
|
|
|
let event = this.get_last_event (nPoints - 1);
|
|
|
|
|
|
|
|
|
|
if (nPoints == 3)
|
|
|
|
|
this._longPressStartTime = event.get_time();
|
|
|
|
|
else if (nPoints == 4) {
|
|
|
|
|
// Check whether the 4th finger press happens after a 3-finger long press,
|
|
|
|
|
// this only needs to be checked on the first 4th finger press
|
|
|
|
|
if (this._longPressStartTime != null &&
|
2019-01-29 16:02:57 -05:00
|
|
|
|
event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT) {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
this.cancel();
|
2019-01-29 16:02:57 -05:00
|
|
|
|
} else {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
this._longPressStartTime = null;
|
|
|
|
|
this.emit('activated');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this.get_n_current_points() <= 4;
|
2017-10-30 21:23:39 -04:00
|
|
|
|
}
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
2019-01-31 16:07:38 -05:00
|
|
|
|
vfunc_gesture_progress(actor) {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
const MOTION_THRESHOLD = 30;
|
|
|
|
|
|
|
|
|
|
if (this.get_n_current_points() == 3) {
|
|
|
|
|
for (let i = 0; i < this.get_n_current_points(); i++) {
|
2018-07-13 17:32:33 -04:00
|
|
|
|
let [startX, startY] = this.get_press_coords(i);
|
|
|
|
|
let [x, y] = this.get_motion_coords(i);
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
|
|
|
|
if (Math.abs(x - startX) > MOTION_THRESHOLD ||
|
|
|
|
|
Math.abs(y - startY) > MOTION_THRESHOLD)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
var ResizePopup = class {
|
|
|
|
|
constructor() {
|
2014-12-29 20:30:38 -05:00
|
|
|
|
this._widget = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
|
|
|
|
this._label = new St.Label({ style_class: 'resize-popup',
|
|
|
|
|
x_align: Clutter.ActorAlign.CENTER,
|
|
|
|
|
y_align: Clutter.ActorAlign.CENTER,
|
|
|
|
|
x_expand: true, y_expand: true });
|
|
|
|
|
this._widget.add_child(this._label);
|
|
|
|
|
Main.uiGroup.add_actor(this._widget);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-12-29 20:30:38 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
set(rect, displayW, displayH) {
|
2014-12-29 20:30:38 -05:00
|
|
|
|
/* Translators: This represents the size of a window. The first number is
|
|
|
|
|
* the width of the window and the second is the height. */
|
2016-09-29 18:00:13 -04:00
|
|
|
|
let text = _("%d × %d").format(displayW, displayH);
|
2014-12-29 20:30:38 -05:00
|
|
|
|
this._label.set_text(text);
|
|
|
|
|
|
|
|
|
|
this._widget.set_position(rect.x, rect.y);
|
|
|
|
|
this._widget.set_size(rect.width, rect.height);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-12-29 20:30:38 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
destroy() {
|
2014-12-29 20:30:38 -05:00
|
|
|
|
this._widget.destroy();
|
|
|
|
|
this._widget = null;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
|
|
|
|
};
|
2008-11-21 09:02:09 -05:00
|
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
|
var WindowManager = class {
|
|
|
|
|
constructor() {
|
2010-03-15 22:06:58 -04:00
|
|
|
|
this._shellwm = global.window_manager;
|
2008-11-21 16:34:10 -05:00
|
|
|
|
|
2008-12-28 23:44:03 -05:00
|
|
|
|
this._minimizing = [];
|
2015-02-27 06:13:26 -05:00
|
|
|
|
this._unminimizing = [];
|
2008-12-28 23:44:03 -05:00
|
|
|
|
this._mapping = [];
|
2013-09-01 16:03:59 -04:00
|
|
|
|
this._resizing = [];
|
2008-12-28 23:44:03 -05:00
|
|
|
|
this._destroying = [];
|
2012-06-26 14:11:44 -04:00
|
|
|
|
this._movingWindow = null;
|
2008-11-21 16:34:10 -05:00
|
|
|
|
|
2010-09-12 05:39:52 -04:00
|
|
|
|
this._dimmedWindows = [];
|
|
|
|
|
|
2016-09-15 11:41:52 -04:00
|
|
|
|
this._skippedActors = [];
|
|
|
|
|
|
2012-08-10 20:53:38 -04:00
|
|
|
|
this._allowedKeybindings = {};
|
|
|
|
|
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._isWorkspacePrepended = false;
|
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
|
this._switchData = null;
|
2018-07-13 17:38:03 -04:00
|
|
|
|
this._shellwm.connect('kill-switch-workspace', (shellwm) => {
|
|
|
|
|
if (this._switchData) {
|
|
|
|
|
if (this._switchData.inProgress)
|
|
|
|
|
this._switchWorkspaceDone(shellwm);
|
|
|
|
|
else if (!this._switchData.gestureActivated)
|
|
|
|
|
this._finishWorkspaceSwitch(this._switchData);
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-10-30 20:38:18 -04:00
|
|
|
|
this._shellwm.connect('kill-window-effects', (shellwm, actor) => {
|
2010-06-16 17:28:57 -04:00
|
|
|
|
this._minimizeWindowDone(shellwm, actor);
|
|
|
|
|
this._mapWindowDone(shellwm, actor);
|
|
|
|
|
this._destroyWindowDone(shellwm, actor);
|
2013-09-01 16:03:59 -04:00
|
|
|
|
this._sizeChangeWindowDone(shellwm, actor);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2010-06-16 17:28:57 -04:00
|
|
|
|
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._shellwm.connect('switch-workspace', this._switchWorkspace.bind(this));
|
|
|
|
|
this._shellwm.connect('show-tile-preview', this._showTilePreview.bind(this));
|
|
|
|
|
this._shellwm.connect('hide-tile-preview', this._hideTilePreview.bind(this));
|
|
|
|
|
this._shellwm.connect('show-window-menu', this._showWindowMenu.bind(this));
|
|
|
|
|
this._shellwm.connect('minimize', this._minimizeWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('unminimize', this._unminimizeWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('size-change', this._sizeChangeWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('size-changed', this._sizeChangedWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('map', this._mapWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('destroy', this._destroyWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('filter-keybinding', this._filterKeybinding.bind(this));
|
|
|
|
|
this._shellwm.connect('confirm-display-change', this._confirmDisplayChange.bind(this));
|
|
|
|
|
this._shellwm.connect('create-close-dialog', this._createCloseDialog.bind(this));
|
|
|
|
|
this._shellwm.connect('create-inhibit-shortcuts-dialog', this._createInhibitShortcutsDialog.bind(this));
|
2018-01-03 02:55:38 -05:00
|
|
|
|
global.display.connect('restacked', this._syncStacking.bind(this));
|
2010-02-12 17:52:15 -05:00
|
|
|
|
|
|
|
|
|
this._workspaceSwitcherPopup = null;
|
2013-09-01 18:26:12 -04:00
|
|
|
|
this._tilePreview = null;
|
|
|
|
|
|
2015-02-19 14:39:26 -05:00
|
|
|
|
this.allowKeybinding('switch-to-session-1', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-2', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-3', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-4', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-5', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-6', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-7', Shell.ActionMode.ALL);
|
2015-02-19 14:39:26 -05:00
|
|
|
|
this.allowKeybinding('switch-to-session-8', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-9', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-10', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-11', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-12', Shell.ActionMode.ALL);
|
2015-02-19 14:39:26 -05:00
|
|
|
|
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-left',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-right',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-up',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-down',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-18 13:55:05 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-last',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-left',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-right',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-up',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-down',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-1',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-2',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-3',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-4',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-5',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-6',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-7',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-8',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-9',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-10',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-11',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-12',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-1',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-2',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-3',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-4',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-5',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-6',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-7',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-8',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-9',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-10',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-11',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-12',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-18 13:55:05 -04:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-last',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-11-22 19:18:06 -05:00
|
|
|
|
this.setCustomKeybindingHandler('switch-applications',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-group',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-11-22 19:18:06 -05:00
|
|
|
|
this.setCustomKeybindingHandler('switch-applications-backward',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-group-backward',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-11-22 21:20:10 -05:00
|
|
|
|
this.setCustomKeybindingHandler('switch-windows',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-11-22 21:20:10 -05:00
|
|
|
|
this.setCustomKeybindingHandler('switch-windows-backward',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 08:41:24 -04:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-windows',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 08:41:24 -04:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-windows-backward',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 08:41:24 -04:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-group',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 08:41:24 -04:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-group-backward',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-panels',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW |
|
|
|
|
|
Shell.ActionMode.LOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.UNLOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.LOGIN_SCREEN,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startA11ySwitcher.bind(this));
|
2012-12-03 05:07:28 -05:00
|
|
|
|
this.setCustomKeybindingHandler('switch-panels-backward',
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW |
|
|
|
|
|
Shell.ActionMode.LOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.UNLOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.LOGIN_SCREEN,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startA11ySwitcher.bind(this));
|
2017-06-08 10:49:20 -04:00
|
|
|
|
this.setCustomKeybindingHandler('switch-monitor',
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 00:34:53 -04:00
|
|
|
|
|
2014-01-14 17:58:51 -05:00
|
|
|
|
this.addKeybinding('pause-resume-tweens',
|
2014-06-24 15:17:09 -04:00
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
2014-01-14 08:49:32 -05:00
|
|
|
|
Meta.KeyBindingFlags.NONE,
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.ALL,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._toggleTweens.bind(this));
|
2014-01-14 08:49:32 -05:00
|
|
|
|
|
2012-08-11 00:34:53 -04:00
|
|
|
|
this.addKeybinding('open-application-menu',
|
2014-06-24 15:17:09 -04:00
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
2018-06-22 08:23:31 -04:00
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
2014-12-11 09:35:40 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
2015-02-25 19:00:41 -05:00
|
|
|
|
Shell.ActionMode.POPUP,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._toggleAppMenu.bind(this));
|
2010-09-12 05:39:52 -04:00
|
|
|
|
|
2015-02-17 20:52:07 -05:00
|
|
|
|
this.addKeybinding('toggle-message-tray',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
2018-06-22 08:23:31 -04:00
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
2015-02-17 20:52:07 -05:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
2015-03-06 12:02:57 -05:00
|
|
|
|
Shell.ActionMode.OVERVIEW |
|
2015-02-25 19:00:41 -05:00
|
|
|
|
Shell.ActionMode.POPUP,
|
2017-12-01 19:27:35 -05:00
|
|
|
|
this._toggleCalendar.bind(this));
|
2015-02-17 20:52:07 -05:00
|
|
|
|
|
2019-01-29 05:48:06 -05:00
|
|
|
|
this.addKeybinding('switch-to-application-1',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-2',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-3',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-4',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-5',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-6',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-7',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-8',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-9',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
2017-12-01 19:27:35 -05:00
|
|
|
|
global.display.connect('show-resize-popup', this._showResizePopup.bind(this));
|
|
|
|
|
global.display.connect('show-pad-osd', this._showPadOsd.bind(this));
|
2017-10-30 20:38:18 -04:00
|
|
|
|
global.display.connect('show-osd', (display, monitorIndex, iconName, label) => {
|
2016-12-28 06:14:32 -05:00
|
|
|
|
let icon = Gio.Icon.new_for_string(iconName);
|
|
|
|
|
Main.osdWindowManager.show(monitorIndex, icon, label, null);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2014-12-29 20:30:38 -05:00
|
|
|
|
|
2016-12-28 07:03:53 -05:00
|
|
|
|
this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
|
|
|
|
|
GSD_WACOM_OBJECT_PATH,
|
2017-10-30 20:38:18 -04:00
|
|
|
|
(proxy, error) => {
|
2016-12-28 07:03:53 -05:00
|
|
|
|
if (error) {
|
|
|
|
|
log(error.message);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2016-12-28 07:03:53 -05:00
|
|
|
|
|
2017-10-30 20:38:18 -04:00
|
|
|
|
global.display.connect('pad-mode-switch', (display, pad, group, mode) => {
|
2016-12-28 07:03:53 -05:00
|
|
|
|
let labels = [];
|
|
|
|
|
|
|
|
|
|
//FIXME: Fix num buttons
|
|
|
|
|
for (let i = 0; i < 50; i++) {
|
|
|
|
|
let str = display.get_pad_action_label(pad, Meta.PadActionType.BUTTON, i);
|
2019-01-28 20:27:05 -05:00
|
|
|
|
labels.push(str ? str : '');
|
2016-12-28 07:03:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this._gsdWacomProxy) {
|
|
|
|
|
this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels);
|
|
|
|
|
this._gsdWacomProxy.SetGroupModeLEDRemote(pad.get_device_node(), group, mode);
|
|
|
|
|
}
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2016-12-28 07:03:53 -05:00
|
|
|
|
|
2017-10-30 20:38:18 -04:00
|
|
|
|
Main.overview.connect('showing', () => {
|
2014-01-19 10:12:15 -05:00
|
|
|
|
for (let i = 0; i < this._dimmedWindows.length; i++)
|
|
|
|
|
this._undimWindow(this._dimmedWindows[i]);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
|
|
|
|
Main.overview.connect('hiding', () => {
|
2014-01-19 10:12:15 -05:00
|
|
|
|
for (let i = 0; i < this._dimmedWindows.length; i++)
|
|
|
|
|
this._dimWindow(this._dimmedWindows[i]);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2014-01-19 10:12:15 -05:00
|
|
|
|
|
2014-03-13 18:51:10 -04:00
|
|
|
|
this._windowMenuManager = new WindowMenu.WindowMenuManager();
|
|
|
|
|
|
2013-06-16 00:21:21 -04:00
|
|
|
|
if (Main.sessionMode.hasWorkspaces)
|
|
|
|
|
this._workspaceTracker = new WorkspaceTracker(this);
|
2012-12-22 22:10:48 -05:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT,
|
|
|
|
|
false, -1, 1);
|
2014-06-25 12:13:26 -04:00
|
|
|
|
|
2019-03-20 11:21:01 -04:00
|
|
|
|
let allowedModes = Shell.ActionMode.NORMAL;
|
2019-06-26 12:06:28 -04:00
|
|
|
|
let workspaceSwitchAction = new WorkspaceSwitchAction(allowedModes);
|
|
|
|
|
workspaceSwitchAction.connect('motion', this._switchWorkspaceMotion.bind(this));
|
|
|
|
|
workspaceSwitchAction.connect('activated', this._actionSwitchWorkspace.bind(this));
|
|
|
|
|
workspaceSwitchAction.connect('cancel', this._switchWorkspaceCancel.bind(this));
|
|
|
|
|
global.stage.add_action(workspaceSwitchAction);
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
2015-07-22 15:19:18 -04:00
|
|
|
|
// This is not a normal Clutter.GestureAction, doesn't need add_action()
|
2019-06-26 12:06:28 -04:00
|
|
|
|
let touchpadSwitchAction = new TouchpadWorkspaceSwitchAction(global.stage, allowedModes);
|
|
|
|
|
touchpadSwitchAction.connect('motion', this._switchWorkspaceMotion.bind(this));
|
|
|
|
|
touchpadSwitchAction.connect('activated', this._actionSwitchWorkspace.bind(this));
|
|
|
|
|
touchpadSwitchAction.connect('cancel', this._switchWorkspaceCancel.bind(this));
|
2015-07-22 15:19:18 -04:00
|
|
|
|
|
2019-06-26 12:06:28 -04:00
|
|
|
|
let appSwitchAction = new AppSwitchAction();
|
|
|
|
|
appSwitchAction.connect('activated', this._switchApp.bind(this));
|
|
|
|
|
global.stage.add_action(appSwitchAction);
|
2017-02-26 17:48:25 -05:00
|
|
|
|
|
2017-09-25 09:26:14 -04:00
|
|
|
|
let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
|
2019-06-26 12:06:28 -04:00
|
|
|
|
let bottomDragAction = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
|
|
|
|
|
bottomDragAction.connect('activated', () => {
|
2017-02-26 17:48:25 -05:00
|
|
|
|
Main.keyboard.show(Main.layoutManager.bottomIndex);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2019-01-21 14:49:07 -05:00
|
|
|
|
Main.layoutManager.connect('keyboard-visible-changed', (manager, visible) => {
|
2019-06-26 12:06:28 -04:00
|
|
|
|
bottomDragAction.cancel();
|
|
|
|
|
bottomDragAction.set_enabled(!visible);
|
2019-01-21 14:49:07 -05:00
|
|
|
|
});
|
2019-06-26 12:06:28 -04:00
|
|
|
|
global.stage.add_action(bottomDragAction);
|
2018-06-07 11:52:18 -04:00
|
|
|
|
|
2019-06-26 12:06:28 -04:00
|
|
|
|
let topDragAction = new EdgeDragAction.EdgeDragAction(St.Side.TOP, mode);
|
|
|
|
|
topDragAction.connect('activated', () => {
|
2018-06-07 11:52:18 -04:00
|
|
|
|
let currentWindow = global.display.focus_window;
|
|
|
|
|
if (currentWindow)
|
|
|
|
|
currentWindow.unmake_fullscreen();
|
|
|
|
|
});
|
2019-02-09 17:40:02 -05:00
|
|
|
|
|
|
|
|
|
let updateUnfullscreenGesture = () => {
|
|
|
|
|
let currentWindow = global.display.focus_window;
|
2019-06-26 12:06:28 -04:00
|
|
|
|
topDragAction.enabled = currentWindow && currentWindow.is_fullscreen();
|
2019-01-28 20:18:52 -05:00
|
|
|
|
};
|
2019-02-09 17:40:02 -05:00
|
|
|
|
|
|
|
|
|
global.display.connect('notify::focus-window', updateUnfullscreenGesture);
|
|
|
|
|
global.display.connect('in-fullscreen-changed', updateUnfullscreenGesture);
|
|
|
|
|
|
2019-06-26 12:06:28 -04:00
|
|
|
|
global.stage.add_action(topDragAction);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2016-06-22 13:57:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
|
2016-06-22 13:57:12 -04:00
|
|
|
|
this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
|
2019-01-27 19:42:00 -05:00
|
|
|
|
this._currentPadOsd.connect('closed', () => this._currentPadOsd = null);
|
2015-07-01 09:51:15 -04:00
|
|
|
|
|
2016-06-22 13:57:12 -04:00
|
|
|
|
return this._currentPadOsd.actor;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-07-01 09:51:15 -04:00
|
|
|
|
|
2018-07-13 17:38:03 -04:00
|
|
|
|
_switchWorkspaceMotion(action, xRel, yRel) {
|
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let activeWorkspace = workspaceManager.get_active_workspace();
|
|
|
|
|
|
|
|
|
|
if (!this._switchData)
|
|
|
|
|
this._prepareWorkspaceSwitch(activeWorkspace.index(), -1);
|
|
|
|
|
|
|
|
|
|
if (yRel < 0 && !this._switchData.surroundings[Meta.MotionDirection.DOWN])
|
|
|
|
|
yRel = 0;
|
|
|
|
|
if (yRel > 0 && !this._switchData.surroundings[Meta.MotionDirection.UP])
|
|
|
|
|
yRel = 0;
|
|
|
|
|
if (xRel < 0 && !this._switchData.surroundings[Meta.MotionDirection.RIGHT])
|
|
|
|
|
xRel = 0;
|
|
|
|
|
if (xRel > 0 && !this._switchData.surroundings[Meta.MotionDirection.LEFT])
|
|
|
|
|
xRel = 0;
|
|
|
|
|
|
|
|
|
|
this._switchData.container.set_position(xRel, yRel);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2018-07-13 17:38:03 -04:00
|
|
|
|
|
|
|
|
|
_switchWorkspaceCancel() {
|
|
|
|
|
if (!this._switchData || this._switchData.inProgress)
|
|
|
|
|
return;
|
|
|
|
|
let switchData = this._switchData;
|
|
|
|
|
this._switchData = null;
|
|
|
|
|
Tweener.addTween(switchData.container,
|
|
|
|
|
{ x: 0,
|
|
|
|
|
y: 0,
|
|
|
|
|
time: WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
|
onComplete: this._finishWorkspaceSwitch,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [switchData],
|
|
|
|
|
});
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2018-07-13 17:38:03 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_actionSwitchWorkspace(action, direction) {
|
2018-07-13 09:04:02 -04:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let activeWorkspace = workspaceManager.get_active_workspace();
|
|
|
|
|
let newWs = activeWorkspace.get_neighbor(direction);
|
2018-07-13 17:38:03 -04:00
|
|
|
|
|
|
|
|
|
if (newWs == activeWorkspace) {
|
|
|
|
|
this._switchWorkspaceCancel();
|
|
|
|
|
} else {
|
|
|
|
|
this._switchData.gestureActivated = true;
|
|
|
|
|
this.actionMoveWorkspace(newWs);
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_lookupIndex(windows, metaWindow) {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
for (let i = 0; i < windows.length; i++) {
|
|
|
|
|
if (windows[i].metaWindow == metaWindow) {
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_switchApp() {
|
2017-10-30 20:38:18 -04:00
|
|
|
|
let windows = global.get_window_actors().filter(actor => {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
let win = actor.metaWindow;
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let activeWorkspace = workspaceManager.get_active_workspace();
|
2014-06-27 16:45:58 -04:00
|
|
|
|
return (!win.is_override_redirect() &&
|
2018-01-03 02:55:38 -05:00
|
|
|
|
win.located_on_workspace(activeWorkspace));
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2014-06-27 16:45:58 -04:00
|
|
|
|
|
|
|
|
|
if (windows.length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
let focusWindow = global.display.focus_window;
|
|
|
|
|
let nextWindow;
|
|
|
|
|
|
2019-01-29 16:02:57 -05:00
|
|
|
|
if (focusWindow == null) {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
nextWindow = windows[0].metaWindow;
|
2019-01-29 16:02:57 -05:00
|
|
|
|
} else {
|
2014-06-27 16:45:58 -04:00
|
|
|
|
let index = this._lookupIndex (windows, focusWindow) + 1;
|
|
|
|
|
|
|
|
|
|
if (index >= windows.length)
|
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
|
|
nextWindow = windows[index].metaWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Main.activateWindow(nextWindow);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-03-15 22:06:58 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
insertWorkspace(pos) {
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
|
2015-01-15 17:03:24 -05:00
|
|
|
|
if (!Meta.prefs_get_dynamic_workspaces())
|
|
|
|
|
return;
|
|
|
|
|
|
2019-07-08 18:11:06 -04:00
|
|
|
|
let newWs = workspaceManager.append_new_workspace(
|
|
|
|
|
false, global.get_current_time());
|
|
|
|
|
workspaceManager.reorder_workspace(newWs, pos);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-01-15 17:03:24 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
keepWorkspaceAlive(workspace, duration) {
|
2013-06-16 00:21:21 -04:00
|
|
|
|
if (!this._workspaceTracker)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-06-16 00:12:22 -04:00
|
|
|
|
this._workspaceTracker.keepWorkspaceAlive(workspace, duration);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-06-16 00:12:22 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
skipNextEffect(actor) {
|
2016-09-15 11:41:52 -04:00
|
|
|
|
this._skippedActors.push(actor);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2016-09-15 11:41:52 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
setCustomKeybindingHandler(name, modes, handler) {
|
2012-08-10 20:53:38 -04:00
|
|
|
|
if (Meta.keybindings_set_custom_handler(name, handler))
|
|
|
|
|
this.allowKeybinding(name, modes);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-08-10 20:53:38 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
addKeybinding(name, settings, flags, modes, handler) {
|
2012-12-12 03:40:49 -05:00
|
|
|
|
let action = global.display.add_keybinding(name, settings, flags, handler);
|
|
|
|
|
if (action != Meta.KeyBindingAction.NONE)
|
2012-08-10 20:53:38 -04:00
|
|
|
|
this.allowKeybinding(name, modes);
|
2012-12-12 03:40:49 -05:00
|
|
|
|
return action;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-08-10 20:53:38 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
removeKeybinding(name) {
|
2012-08-10 20:53:38 -04:00
|
|
|
|
if (global.display.remove_keybinding(name))
|
2014-12-11 09:35:40 -05:00
|
|
|
|
this.allowKeybinding(name, Shell.ActionMode.NONE);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-08-10 20:53:38 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
allowKeybinding(name, modes) {
|
2012-08-10 20:53:38 -04:00
|
|
|
|
this._allowedKeybindings[name] = modes;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-08-10 20:53:38 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_shouldAnimate() {
|
2019-07-09 08:46:36 -04:00
|
|
|
|
return !Main.overview.visible;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-07-13 20:43:07 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_shouldAnimateActor(actor, types) {
|
2016-09-15 11:41:52 -04:00
|
|
|
|
if (this._removeEffect(this._skippedActors, actor))
|
|
|
|
|
return false;
|
|
|
|
|
|
2012-07-13 20:43:07 -04:00
|
|
|
|
if (!this._shouldAnimate())
|
2009-02-03 13:25:34 -05:00
|
|
|
|
return false;
|
2014-07-07 11:18:07 -04:00
|
|
|
|
|
2017-01-25 11:42:49 -05:00
|
|
|
|
if (!actor.get_texture())
|
|
|
|
|
return false;
|
|
|
|
|
|
2014-07-07 11:18:07 -04:00
|
|
|
|
let type = actor.meta_window.get_window_type();
|
2018-07-14 16:56:22 -04:00
|
|
|
|
return types.includes(type);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_removeEffect(list, actor) {
|
2009-02-05 19:57:54 -05:00
|
|
|
|
let idx = list.indexOf(actor);
|
|
|
|
|
if (idx != -1) {
|
|
|
|
|
list.splice(idx, 1);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2009-02-05 19:57:54 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_minimizeWindow(shellwm, actor) {
|
2014-07-07 11:18:07 -04:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG,
|
|
|
|
|
Meta.WindowType.DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_minimize(actor);
|
2008-12-28 23:44:03 -05:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor.set_scale(1.0, 1.0);
|
|
|
|
|
|
|
|
|
|
this._minimizing.push(actor);
|
2010-02-05 07:50:11 -05:00
|
|
|
|
|
2013-02-18 13:26:13 -05:00
|
|
|
|
if (actor.meta_window.is_monitor_sized()) {
|
|
|
|
|
Tweener.addTween(actor,
|
2019-01-29 14:36:54 -05:00
|
|
|
|
{ opacity: 0,
|
|
|
|
|
time: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
|
onComplete: this._minimizeWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._minimizeWindowOverwritten,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
2013-02-18 13:26:13 -05:00
|
|
|
|
} else {
|
|
|
|
|
let xDest, yDest, xScale, yScale;
|
|
|
|
|
let [success, geom] = actor.meta_window.get_icon_geometry();
|
|
|
|
|
if (success) {
|
|
|
|
|
xDest = geom.x;
|
|
|
|
|
yDest = geom.y;
|
|
|
|
|
xScale = geom.width / actor.width;
|
|
|
|
|
yScale = geom.height / actor.height;
|
|
|
|
|
} else {
|
|
|
|
|
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
2018-04-18 02:27:34 -04:00
|
|
|
|
if (!monitor) {
|
|
|
|
|
this._minimizeWindowDone();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-02-18 13:26:13 -05:00
|
|
|
|
xDest = monitor.x;
|
|
|
|
|
yDest = monitor.y;
|
|
|
|
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
|
|
|
|
xDest += monitor.width;
|
|
|
|
|
xScale = 0;
|
|
|
|
|
yScale = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Tweener.addTween(actor,
|
|
|
|
|
{ scale_x: xScale,
|
|
|
|
|
scale_y: yScale,
|
|
|
|
|
x: xDest,
|
|
|
|
|
y: yDest,
|
2014-07-07 11:18:07 -04:00
|
|
|
|
time: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeInExpo',
|
2013-02-18 13:26:13 -05:00
|
|
|
|
onComplete: this._minimizeWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._minimizeWindowOverwritten,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_minimizeWindowDone(shellwm, actor) {
|
2009-02-05 19:57:54 -05:00
|
|
|
|
if (this._removeEffect(this._minimizing, actor)) {
|
2008-12-28 23:44:03 -05:00
|
|
|
|
Tweener.removeTweens(actor);
|
|
|
|
|
actor.set_scale(1.0, 1.0);
|
2013-02-18 13:26:13 -05:00
|
|
|
|
actor.set_opacity(255);
|
2014-07-07 11:18:07 -04:00
|
|
|
|
actor.set_pivot_point(0, 0);
|
2009-02-05 19:57:54 -05:00
|
|
|
|
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_minimize(actor);
|
2009-02-05 19:57:54 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_minimizeWindowOverwritten(shellwm, actor) {
|
2009-02-05 19:57:54 -05:00
|
|
|
|
if (this._removeEffect(this._minimizing, actor)) {
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_minimize(actor);
|
2008-12-28 23:44:03 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2009-02-05 19:57:54 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_unminimizeWindow(shellwm, actor) {
|
2015-02-27 06:13:26 -05:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG,
|
|
|
|
|
Meta.WindowType.DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
|
|
|
|
shellwm.completed_unminimize(actor);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._unminimizing.push(actor);
|
|
|
|
|
|
|
|
|
|
if (actor.meta_window.is_monitor_sized()) {
|
|
|
|
|
actor.opacity = 0;
|
|
|
|
|
actor.set_scale(1.0, 1.0);
|
|
|
|
|
Tweener.addTween(actor,
|
2019-01-29 14:36:54 -05:00
|
|
|
|
{ opacity: 255,
|
|
|
|
|
time: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
|
onComplete: this._unminimizeWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._unminimizeWindowOverwritten,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
2015-02-27 06:13:26 -05:00
|
|
|
|
} else {
|
|
|
|
|
let [success, geom] = actor.meta_window.get_icon_geometry();
|
|
|
|
|
if (success) {
|
|
|
|
|
actor.set_position(geom.x, geom.y);
|
|
|
|
|
actor.set_scale(geom.width / actor.width,
|
|
|
|
|
geom.height / actor.height);
|
|
|
|
|
} else {
|
|
|
|
|
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
2018-04-18 02:27:34 -04:00
|
|
|
|
if (!monitor) {
|
|
|
|
|
actor.show();
|
|
|
|
|
this._unminimizeWindowDone();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-02-27 06:13:26 -05:00
|
|
|
|
actor.set_position(monitor.x, monitor.y);
|
|
|
|
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
|
|
|
|
actor.x += monitor.width;
|
|
|
|
|
actor.set_scale(0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let rect = actor.meta_window.get_frame_rect();
|
|
|
|
|
let [xDest, yDest] = [rect.x, rect.y];
|
|
|
|
|
|
|
|
|
|
actor.show();
|
|
|
|
|
Tweener.addTween(actor,
|
|
|
|
|
{ scale_x: 1.0,
|
|
|
|
|
scale_y: 1.0,
|
|
|
|
|
x: xDest,
|
|
|
|
|
y: yDest,
|
|
|
|
|
time: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeInExpo',
|
|
|
|
|
onComplete: this._unminimizeWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._unminimizeWindowOverwritten,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-02-27 06:13:26 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_unminimizeWindowDone(shellwm, actor) {
|
2015-02-27 06:13:26 -05:00
|
|
|
|
if (this._removeEffect(this._unminimizing, actor)) {
|
|
|
|
|
Tweener.removeTweens(actor);
|
|
|
|
|
actor.set_scale(1.0, 1.0);
|
|
|
|
|
actor.set_opacity(255);
|
|
|
|
|
actor.set_pivot_point(0, 0);
|
|
|
|
|
|
|
|
|
|
shellwm.completed_unminimize(actor);
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-02-27 06:13:26 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_unminimizeWindowOverwritten(shellwm, actor) {
|
2015-02-27 06:13:26 -05:00
|
|
|
|
if (this._removeEffect(this._unminimizing, actor)) {
|
|
|
|
|
shellwm.completed_unminimize(actor);
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-02-27 06:13:26 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_sizeChangeWindow(shellwm, actor, whichChange, oldFrameRect, oldBufferRect) {
|
2013-09-01 16:03:59 -04:00
|
|
|
|
let types = [Meta.WindowType.NORMAL];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
|
|
|
|
shellwm.completed_size_change(actor);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-20 11:56:48 -04:00
|
|
|
|
if (oldFrameRect.width > 0 && oldFrameRect.height > 0)
|
2017-05-20 13:34:51 -04:00
|
|
|
|
this._prepareAnimationInfo(shellwm, actor, oldFrameRect, whichChange);
|
2013-09-01 16:03:59 -04:00
|
|
|
|
else
|
|
|
|
|
shellwm.completed_size_change(actor);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 16:03:59 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_prepareAnimationInfo(shellwm, actor, oldFrameRect, change) {
|
2013-09-01 16:03:59 -04:00
|
|
|
|
// Position a clone of the window on top of the old position,
|
|
|
|
|
// while actor updates are frozen.
|
|
|
|
|
let actorContent = Shell.util_get_content_for_window_actor(actor, oldFrameRect);
|
|
|
|
|
let actorClone = new St.Widget({ content: actorContent });
|
|
|
|
|
actorClone.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
|
|
|
|
|
actorClone.set_position(oldFrameRect.x, oldFrameRect.y);
|
|
|
|
|
actorClone.set_size(oldFrameRect.width, oldFrameRect.height);
|
|
|
|
|
Main.uiGroup.add_actor(actorClone);
|
|
|
|
|
|
2017-05-20 13:34:51 -04:00
|
|
|
|
if (this._clearAnimationInfo(actor))
|
2016-09-26 11:58:25 -04:00
|
|
|
|
this._shellwm.completed_size_change(actor);
|
|
|
|
|
|
2019-02-07 14:27:35 -05:00
|
|
|
|
let destroyId = actor.connect('destroy', () => {
|
|
|
|
|
this._clearAnimationInfo(actor);
|
|
|
|
|
});
|
|
|
|
|
|
2017-05-20 13:34:51 -04:00
|
|
|
|
actor.__animationInfo = { clone: actorClone,
|
2019-02-07 14:27:35 -05:00
|
|
|
|
oldRect: oldFrameRect,
|
|
|
|
|
destroyId: destroyId };
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2016-09-26 11:58:25 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_sizeChangedWindow(shellwm, actor) {
|
2017-05-20 13:34:51 -04:00
|
|
|
|
if (!actor.__animationInfo)
|
2016-09-26 11:58:25 -04:00
|
|
|
|
return;
|
2018-07-14 16:56:22 -04:00
|
|
|
|
if (this._resizing.includes(actor))
|
2017-01-25 11:47:18 -05:00
|
|
|
|
return;
|
2016-09-26 11:58:25 -04:00
|
|
|
|
|
2017-05-20 13:34:51 -04:00
|
|
|
|
let actorClone = actor.__animationInfo.clone;
|
2016-09-26 11:58:25 -04:00
|
|
|
|
let targetRect = actor.meta_window.get_frame_rect();
|
2017-05-20 13:34:51 -04:00
|
|
|
|
let sourceRect = actor.__animationInfo.oldRect;
|
2013-09-01 16:03:59 -04:00
|
|
|
|
|
2017-05-20 11:04:08 -04:00
|
|
|
|
let scaleX = targetRect.width / sourceRect.width;
|
|
|
|
|
let scaleY = targetRect.height / sourceRect.height;
|
2016-09-26 11:58:25 -04:00
|
|
|
|
|
|
|
|
|
this._resizing.push(actor);
|
2013-09-01 16:03:59 -04:00
|
|
|
|
|
|
|
|
|
// Now scale and fade out the clone
|
|
|
|
|
Tweener.addTween(actorClone,
|
|
|
|
|
{ x: targetRect.x,
|
|
|
|
|
y: targetRect.y,
|
|
|
|
|
scale_x: scaleX,
|
|
|
|
|
scale_y: scaleY,
|
|
|
|
|
opacity: 0,
|
|
|
|
|
time: WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
|
});
|
|
|
|
|
|
2017-05-20 10:34:35 -04:00
|
|
|
|
actor.translation_x = -targetRect.x + sourceRect.x;
|
|
|
|
|
actor.translation_y = -targetRect.y + sourceRect.y;
|
2016-09-26 11:58:25 -04:00
|
|
|
|
|
2013-09-01 16:03:59 -04:00
|
|
|
|
// Now set scale the actor to size it as the clone.
|
|
|
|
|
actor.scale_x = 1 / scaleX;
|
|
|
|
|
actor.scale_y = 1 / scaleY;
|
|
|
|
|
|
|
|
|
|
// Scale it to its actual new size
|
|
|
|
|
Tweener.addTween(actor,
|
|
|
|
|
{ scale_x: 1.0,
|
|
|
|
|
scale_y: 1.0,
|
|
|
|
|
translation_x: 0,
|
|
|
|
|
translation_y: 0,
|
|
|
|
|
time: WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
|
onComplete: this._sizeChangeWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
2015-10-16 16:45:09 -04:00
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._sizeChangeWindowOverwritten,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
2013-09-01 16:03:59 -04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Now unfreeze actor updates, to get it to the new size.
|
|
|
|
|
// It's important that we don't wait until the animation is completed to
|
|
|
|
|
// do this, otherwise our scale will be applied to the old texture size.
|
2015-07-06 00:16:33 -04:00
|
|
|
|
shellwm.completed_size_change(actor);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_clearAnimationInfo(actor) {
|
2017-05-20 13:34:51 -04:00
|
|
|
|
if (actor.__animationInfo) {
|
|
|
|
|
actor.__animationInfo.clone.destroy();
|
2019-02-07 14:27:35 -05:00
|
|
|
|
actor.disconnect(actor.__animationInfo.destroyId);
|
2017-05-20 13:34:51 -04:00
|
|
|
|
delete actor.__animationInfo;
|
2016-09-26 11:58:25 -04:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2016-09-26 11:58:25 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_sizeChangeWindowDone(shellwm, actor) {
|
2013-09-01 16:03:59 -04:00
|
|
|
|
if (this._removeEffect(this._resizing, actor)) {
|
|
|
|
|
Tweener.removeTweens(actor);
|
|
|
|
|
actor.scale_x = 1.0;
|
|
|
|
|
actor.scale_y = 1.0;
|
|
|
|
|
actor.translation_x = 0;
|
|
|
|
|
actor.translation_y = 0;
|
2017-05-20 13:34:51 -04:00
|
|
|
|
this._clearAnimationInfo(actor);
|
2013-09-01 16:03:59 -04:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 16:03:59 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_sizeChangeWindowOverwritten(shellwm, actor) {
|
2016-09-26 11:58:25 -04:00
|
|
|
|
if (this._removeEffect(this._resizing, actor))
|
2017-05-20 13:34:51 -04:00
|
|
|
|
this._clearAnimationInfo(actor);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-10-16 16:45:09 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_hasAttachedDialogs(window, ignoreWindow) {
|
2010-09-10 21:30:50 -04:00
|
|
|
|
var count = 0;
|
2017-10-30 20:38:18 -04:00
|
|
|
|
window.foreach_transient(win => {
|
2016-08-22 10:56:41 -04:00
|
|
|
|
if (win != ignoreWindow &&
|
|
|
|
|
win.is_attached_dialog() &&
|
|
|
|
|
win.get_transient_for() == window) {
|
2010-09-10 21:30:50 -04:00
|
|
|
|
count++;
|
2016-08-22 10:56:41 -04:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2010-09-10 21:30:50 -04:00
|
|
|
|
});
|
|
|
|
|
return count != 0;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_checkDimming(window, ignoreWindow) {
|
2011-04-05 10:16:50 -04:00
|
|
|
|
let shouldDim = this._hasAttachedDialogs(window, ignoreWindow);
|
2011-03-07 22:09:41 -05:00
|
|
|
|
|
|
|
|
|
if (shouldDim && !window._dimmed) {
|
|
|
|
|
window._dimmed = true;
|
|
|
|
|
this._dimmedWindows.push(window);
|
2012-08-29 18:51:53 -04:00
|
|
|
|
this._dimWindow(window);
|
2011-03-07 22:09:41 -05:00
|
|
|
|
} else if (!shouldDim && window._dimmed) {
|
|
|
|
|
window._dimmed = false;
|
2017-10-30 20:38:18 -04:00
|
|
|
|
this._dimmedWindows =
|
|
|
|
|
this._dimmedWindows.filter(win => win != window);
|
2012-08-29 18:51:53 -04:00
|
|
|
|
this._undimWindow(window);
|
2010-09-30 17:09:15 -04:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-30 17:09:15 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_dimWindow(window) {
|
2011-03-07 22:09:41 -05:00
|
|
|
|
let actor = window.get_compositor_private();
|
|
|
|
|
if (!actor)
|
2010-09-10 21:30:50 -04:00
|
|
|
|
return;
|
2012-07-13 13:57:36 -04:00
|
|
|
|
let dimmer = getWindowDimmer(actor);
|
2012-08-30 15:32:44 -04:00
|
|
|
|
if (!dimmer)
|
2012-07-13 13:57:36 -04:00
|
|
|
|
return;
|
2016-02-22 12:11:56 -05:00
|
|
|
|
if (this._shouldAnimate())
|
|
|
|
|
Tweener.addTween(dimmer,
|
|
|
|
|
{ dimFactor: 1.0,
|
|
|
|
|
time: DIM_TIME,
|
|
|
|
|
transition: 'linear'
|
|
|
|
|
});
|
|
|
|
|
else
|
|
|
|
|
dimmer.dimFactor = 1.0;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_undimWindow(window) {
|
2011-03-07 22:09:41 -05:00
|
|
|
|
let actor = window.get_compositor_private();
|
|
|
|
|
if (!actor)
|
2010-09-10 21:30:50 -04:00
|
|
|
|
return;
|
2012-07-13 13:57:36 -04:00
|
|
|
|
let dimmer = getWindowDimmer(actor);
|
2012-08-30 15:32:44 -04:00
|
|
|
|
if (!dimmer)
|
2012-07-13 13:57:36 -04:00
|
|
|
|
return;
|
2016-02-22 12:11:56 -05:00
|
|
|
|
if (this._shouldAnimate())
|
|
|
|
|
Tweener.addTween(dimmer,
|
|
|
|
|
{ dimFactor: 0.0,
|
|
|
|
|
time: UNDIM_TIME,
|
|
|
|
|
transition: 'linear' });
|
|
|
|
|
else
|
|
|
|
|
dimmer.dimFactor = 0.0;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_mapWindow(shellwm, actor) {
|
2010-09-30 17:09:15 -04:00
|
|
|
|
actor._windowType = actor.meta_window.get_window_type();
|
2017-10-30 20:38:18 -04:00
|
|
|
|
actor._notifyWindowTypeSignalId =
|
|
|
|
|
actor.meta_window.connect('notify::window-type', () => {
|
|
|
|
|
let type = actor.meta_window.get_window_type();
|
|
|
|
|
if (type == actor._windowType)
|
|
|
|
|
return;
|
|
|
|
|
if (type == Meta.WindowType.MODAL_DIALOG ||
|
|
|
|
|
actor._windowType == Meta.WindowType.MODAL_DIALOG) {
|
|
|
|
|
let parent = actor.get_meta_window().get_transient_for();
|
|
|
|
|
if (parent)
|
|
|
|
|
this._checkDimming(parent);
|
|
|
|
|
}
|
2010-09-30 17:09:15 -04:00
|
|
|
|
|
2017-10-30 20:38:18 -04:00
|
|
|
|
actor._windowType = type;
|
|
|
|
|
});
|
|
|
|
|
actor.meta_window.connect('unmanaged', window => {
|
|
|
|
|
let parent = window.get_transient_for();
|
|
|
|
|
if (parent)
|
|
|
|
|
this._checkDimming(parent);
|
|
|
|
|
});
|
2012-12-14 21:23:36 -05:00
|
|
|
|
|
2016-02-22 11:59:05 -05:00
|
|
|
|
if (actor.meta_window.is_attached_dialog())
|
|
|
|
|
this._checkDimming(actor.get_meta_window().get_transient_for());
|
|
|
|
|
|
2014-07-07 11:18:07 -04:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.DIALOG,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_map(actor);
|
2008-12-28 23:44:03 -05:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-07 11:18:07 -04:00
|
|
|
|
switch (actor._windowType) {
|
|
|
|
|
case Meta.WindowType.NORMAL:
|
|
|
|
|
actor.set_pivot_point(0.5, 1.0);
|
|
|
|
|
actor.scale_x = 0.01;
|
2014-07-28 12:12:30 -04:00
|
|
|
|
actor.scale_y = 0.05;
|
2014-07-07 11:18:07 -04:00
|
|
|
|
actor.opacity = 0;
|
2012-12-14 21:23:36 -05:00
|
|
|
|
actor.show();
|
|
|
|
|
this._mapping.push(actor);
|
2010-04-02 14:30:10 -04:00
|
|
|
|
|
2012-12-14 21:23:36 -05:00
|
|
|
|
Tweener.addTween(actor,
|
2014-07-07 11:18:07 -04:00
|
|
|
|
{ opacity: 255,
|
|
|
|
|
scale_x: 1,
|
|
|
|
|
scale_y: 1,
|
|
|
|
|
time: SHOW_WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutExpo',
|
2012-12-14 21:23:36 -05:00
|
|
|
|
onComplete: this._mapWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._mapWindowOverwrite,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
2014-07-07 11:18:07 -04:00
|
|
|
|
break;
|
|
|
|
|
case Meta.WindowType.MODAL_DIALOG:
|
|
|
|
|
case Meta.WindowType.DIALOG:
|
|
|
|
|
actor.set_pivot_point(0.5, 0.5);
|
|
|
|
|
actor.scale_y = 0;
|
2012-12-14 21:23:36 -05:00
|
|
|
|
actor.opacity = 0;
|
|
|
|
|
actor.show();
|
|
|
|
|
this._mapping.push(actor);
|
|
|
|
|
|
|
|
|
|
Tweener.addTween(actor,
|
|
|
|
|
{ opacity: 255,
|
2014-07-07 11:18:07 -04:00
|
|
|
|
scale_x: 1,
|
|
|
|
|
scale_y: 1,
|
2014-07-28 12:12:30 -04:00
|
|
|
|
time: DIALOG_SHOW_WINDOW_ANIMATION_TIME,
|
2012-12-14 21:23:36 -05:00
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
|
onComplete: this._mapWindowDone,
|
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
|
|
|
|
onOverwrite: this._mapWindowOverwrite,
|
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
2014-07-07 11:18:07 -04:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
shellwm.completed_map(actor);
|
|
|
|
|
return;
|
2012-12-14 21:23:36 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_mapWindowDone(shellwm, actor) {
|
2009-02-05 19:57:54 -05:00
|
|
|
|
if (this._removeEffect(this._mapping, actor)) {
|
2008-12-28 23:44:03 -05:00
|
|
|
|
Tweener.removeTweens(actor);
|
2010-04-02 14:30:10 -04:00
|
|
|
|
actor.opacity = 255;
|
2014-07-07 11:18:07 -04:00
|
|
|
|
actor.set_pivot_point(0, 0);
|
2012-12-16 14:02:17 -05:00
|
|
|
|
actor.scale_y = 1;
|
2014-07-07 11:18:07 -04:00
|
|
|
|
actor.scale_x = 1;
|
|
|
|
|
actor.translation_y = 0;
|
|
|
|
|
actor.translation_x = 0;
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_map(actor);
|
2009-02-05 19:57:54 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2009-02-05 19:57:54 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_mapWindowOverwrite(shellwm, actor) {
|
2009-02-05 19:57:54 -05:00
|
|
|
|
if (this._removeEffect(this._mapping, actor)) {
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_map(actor);
|
2008-12-28 23:44:03 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_destroyWindow(shellwm, actor) {
|
2011-03-07 22:09:41 -05:00
|
|
|
|
let window = actor.meta_window;
|
2010-09-30 17:09:15 -04:00
|
|
|
|
if (actor._notifyWindowTypeSignalId) {
|
2011-03-07 22:09:41 -05:00
|
|
|
|
window.disconnect(actor._notifyWindowTypeSignalId);
|
2010-09-30 17:09:15 -04:00
|
|
|
|
actor._notifyWindowTypeSignalId = 0;
|
|
|
|
|
}
|
2011-03-07 22:09:41 -05:00
|
|
|
|
if (window._dimmed) {
|
2017-10-30 20:38:18 -04:00
|
|
|
|
this._dimmedWindows =
|
|
|
|
|
this._dimmedWindows.filter(win => win != window);
|
2011-03-07 22:09:41 -05:00
|
|
|
|
}
|
2012-12-14 21:23:36 -05:00
|
|
|
|
|
2016-02-22 11:59:05 -05:00
|
|
|
|
if (window.is_attached_dialog())
|
|
|
|
|
this._checkDimming(window.get_transient_for(), window);
|
|
|
|
|
|
2014-07-08 05:51:49 -04:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.DIALOG,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
2012-12-14 21:23:36 -05:00
|
|
|
|
shellwm.completed_destroy(actor);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 23:51:31 -04:00
|
|
|
|
switch (actor.meta_window.window_type) {
|
2014-07-08 05:51:49 -04:00
|
|
|
|
case Meta.WindowType.NORMAL:
|
2014-06-27 10:53:14 -04:00
|
|
|
|
actor.set_pivot_point(0.5, 0.5);
|
2014-07-08 05:51:49 -04:00
|
|
|
|
this._destroying.push(actor);
|
2010-09-15 07:52:20 -04:00
|
|
|
|
|
2014-07-08 05:51:49 -04:00
|
|
|
|
Tweener.addTween(actor,
|
|
|
|
|
{ opacity: 0,
|
|
|
|
|
scale_x: 0.8,
|
|
|
|
|
scale_y: 0.8,
|
|
|
|
|
time: DESTROY_WINDOW_ANIMATION_TIME,
|
|
|
|
|
transition: 'easeOutQuad',
|
2014-08-03 15:28:04 -04:00
|
|
|
|
onComplete: this._destroyWindowDone,
|
2014-07-08 05:51:49 -04:00
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
2014-08-03 15:28:04 -04:00
|
|
|
|
onOverwrite: this._destroyWindowDone,
|
2014-07-08 05:51:49 -04:00
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case Meta.WindowType.MODAL_DIALOG:
|
|
|
|
|
case Meta.WindowType.DIALOG:
|
|
|
|
|
actor.set_pivot_point(0.5, 0.5);
|
|
|
|
|
this._destroying.push(actor);
|
|
|
|
|
|
|
|
|
|
if (window.is_attached_dialog()) {
|
|
|
|
|
let parent = window.get_transient_for();
|
2017-10-30 20:38:18 -04:00
|
|
|
|
actor._parentDestroyId = parent.connect('unmanaged', () => {
|
2014-07-08 05:51:49 -04:00
|
|
|
|
Tweener.removeTweens(actor);
|
|
|
|
|
this._destroyWindowDone(shellwm, actor);
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2014-07-08 05:51:49 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
|
|
|
|
Tweener.addTween(actor,
|
2012-08-10 09:18:40 -04:00
|
|
|
|
{ scale_y: 0,
|
2014-07-28 12:12:30 -04:00
|
|
|
|
time: DIALOG_DESTROY_WINDOW_ANIMATION_TIME,
|
2014-07-08 05:51:49 -04:00
|
|
|
|
transition: 'easeOutQuad',
|
2014-08-03 15:28:04 -04:00
|
|
|
|
onComplete: this._destroyWindowDone,
|
2010-09-10 21:30:50 -04:00
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm, actor],
|
2010-09-15 07:52:20 -04:00
|
|
|
|
onOverwrite: this._destroyWindowDone,
|
2010-09-10 21:30:50 -04:00
|
|
|
|
onOverwriteScope: this,
|
|
|
|
|
onOverwriteParams: [shellwm, actor]
|
|
|
|
|
});
|
2014-07-08 05:51:49 -04:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
shellwm.completed_destroy(actor);
|
2010-09-10 21:30:50 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-09-10 21:30:50 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_destroyWindowDone(shellwm, actor) {
|
2010-09-15 07:52:20 -04:00
|
|
|
|
if (this._removeEffect(this._destroying, actor)) {
|
|
|
|
|
let parent = actor.get_meta_window().get_transient_for();
|
|
|
|
|
if (parent && actor._parentDestroyId) {
|
|
|
|
|
parent.disconnect(actor._parentDestroyId);
|
|
|
|
|
actor._parentDestroyId = 0;
|
2010-09-10 21:30:50 -04:00
|
|
|
|
}
|
2010-09-15 07:52:20 -04:00
|
|
|
|
shellwm.completed_destroy(actor);
|
2010-09-10 21:30:50 -04:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-28 23:44:03 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_filterKeybinding(shellwm, binding) {
|
2014-12-11 09:35:40 -05:00
|
|
|
|
if (Main.actionMode == Shell.ActionMode.NONE)
|
2012-08-20 10:20:23 -04:00
|
|
|
|
return true;
|
2012-08-20 04:38:13 -04:00
|
|
|
|
|
2012-08-10 20:53:38 -04:00
|
|
|
|
// There's little sense in implementing a keybinding in mutter and
|
|
|
|
|
// not having it work in NORMAL mode; handle this case generically
|
|
|
|
|
// so we don't have to explicitly allow all builtin keybindings in
|
|
|
|
|
// NORMAL mode.
|
2014-12-11 09:35:40 -05:00
|
|
|
|
if (Main.actionMode == Shell.ActionMode.NORMAL &&
|
2012-08-10 20:53:38 -04:00
|
|
|
|
binding.is_builtin())
|
2012-08-20 04:38:13 -04:00
|
|
|
|
return false;
|
|
|
|
|
|
2014-12-11 09:35:40 -05:00
|
|
|
|
return !(this._allowedKeybindings[binding.get_name()] & Main.actionMode);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-08-20 04:38:13 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_syncStacking() {
|
2014-12-17 16:57:44 -05:00
|
|
|
|
if (this._switchData == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
let windows = global.get_window_actors();
|
2018-07-13 09:04:02 -04:00
|
|
|
|
let lastCurSibling = null;
|
|
|
|
|
let lastDirSibling = [];
|
2014-12-17 16:57:44 -05:00
|
|
|
|
for (let i = 0; i < windows.length; i++) {
|
2018-07-13 09:04:02 -04:00
|
|
|
|
if (windows[i].get_parent() == this._switchData.curGroup) {
|
|
|
|
|
this._switchData.curGroup.set_child_above_sibling(windows[i], lastCurSibling);
|
|
|
|
|
lastCurSibling = windows[i];
|
|
|
|
|
} else {
|
|
|
|
|
for (let dir of Object.values(Meta.MotionDirection)) {
|
|
|
|
|
let info = this._switchData.surroundings[dir];
|
|
|
|
|
if (!info || windows[i].get_parent() != info.actor)
|
|
|
|
|
continue;
|
2014-12-17 16:57:44 -05:00
|
|
|
|
|
2018-07-13 09:04:02 -04:00
|
|
|
|
let sibling = lastDirSibling[dir];
|
|
|
|
|
if (sibling == undefined)
|
|
|
|
|
sibling = null;
|
2014-12-17 16:57:44 -05:00
|
|
|
|
|
2018-07-13 09:04:02 -04:00
|
|
|
|
info.actor.set_child_above_sibling(windows[i], sibling);
|
|
|
|
|
lastDirSibling[dir] = windows[i];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-12-04 10:16:16 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-04 10:16:16 -05:00
|
|
|
|
|
2019-05-03 16:56:02 -04:00
|
|
|
|
_getPositionForDirection(direction, fromWs, toWs) {
|
2008-12-01 14:51:43 -05:00
|
|
|
|
let xDest = 0, yDest = 0;
|
|
|
|
|
|
2019-05-03 16:56:02 -04:00
|
|
|
|
let oldWsIsFullscreen = fromWs.list_windows().some(w => w.is_fullscreen());
|
|
|
|
|
let newWsIsFullscreen = toWs.list_windows().some(w => w.is_fullscreen());
|
|
|
|
|
|
|
|
|
|
// We have to shift windows up or down by the height of the panel to prevent having a
|
|
|
|
|
// visible gap between the windows while switching workspaces. Since fullscreen windows
|
|
|
|
|
// hide the panel, they don't need to be shifted up or down.
|
|
|
|
|
let shiftHeight = Main.panel.height;
|
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
|
if (direction == Meta.MotionDirection.UP ||
|
2008-11-21 16:34:10 -05:00
|
|
|
|
direction == Meta.MotionDirection.UP_LEFT ||
|
|
|
|
|
direction == Meta.MotionDirection.UP_RIGHT)
|
2019-05-03 16:56:02 -04:00
|
|
|
|
yDest = -global.screen_height + (oldWsIsFullscreen ? 0 : shiftHeight);
|
2008-12-01 14:51:43 -05:00
|
|
|
|
else if (direction == Meta.MotionDirection.DOWN ||
|
2008-11-21 16:34:10 -05:00
|
|
|
|
direction == Meta.MotionDirection.DOWN_LEFT ||
|
|
|
|
|
direction == Meta.MotionDirection.DOWN_RIGHT)
|
2019-05-03 16:56:02 -04:00
|
|
|
|
yDest = global.screen_height - (newWsIsFullscreen ? 0 : shiftHeight);
|
2008-11-21 16:34:10 -05:00
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
|
if (direction == Meta.MotionDirection.LEFT ||
|
2008-11-21 16:34:10 -05:00
|
|
|
|
direction == Meta.MotionDirection.UP_LEFT ||
|
|
|
|
|
direction == Meta.MotionDirection.DOWN_LEFT)
|
2018-07-13 09:04:02 -04:00
|
|
|
|
xDest = -global.screen_width;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
else if (direction == Meta.MotionDirection.RIGHT ||
|
|
|
|
|
direction == Meta.MotionDirection.UP_RIGHT ||
|
|
|
|
|
direction == Meta.MotionDirection.DOWN_RIGHT)
|
2018-07-13 09:04:02 -04:00
|
|
|
|
xDest = global.screen_width;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
|
2018-07-13 09:04:02 -04:00
|
|
|
|
return [xDest, yDest];
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2018-07-13 09:04:02 -04:00
|
|
|
|
|
|
|
|
|
_prepareWorkspaceSwitch(from, to, direction) {
|
|
|
|
|
if (this._switchData)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
let wgroup = global.window_group;
|
|
|
|
|
let windows = global.get_window_actors();
|
2008-12-01 14:51:43 -05:00
|
|
|
|
let switchData = {};
|
2018-07-13 09:04:02 -04:00
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
|
this._switchData = switchData;
|
2018-07-13 09:04:02 -04:00
|
|
|
|
switchData.curGroup = new Clutter.Actor();
|
2013-02-22 06:23:56 -05:00
|
|
|
|
switchData.movingWindowBin = new Clutter.Actor();
|
2008-12-01 14:51:43 -05:00
|
|
|
|
switchData.windows = [];
|
2018-07-13 09:04:02 -04:00
|
|
|
|
switchData.surroundings = {};
|
2018-07-13 17:38:03 -04:00
|
|
|
|
switchData.gestureActivated = false;
|
|
|
|
|
switchData.inProgress = false;
|
2018-07-13 09:04:02 -04:00
|
|
|
|
|
|
|
|
|
switchData.container = new Clutter.Actor();
|
|
|
|
|
switchData.container.add_actor(switchData.curGroup);
|
2008-12-01 14:51:43 -05:00
|
|
|
|
|
2012-06-26 14:11:44 -04:00
|
|
|
|
wgroup.add_actor(switchData.movingWindowBin);
|
2018-07-13 09:04:02 -04:00
|
|
|
|
wgroup.add_actor(switchData.container);
|
|
|
|
|
|
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let curWs = workspaceManager.get_workspace_by_index (from);
|
|
|
|
|
|
|
|
|
|
for (let dir of Object.values(Meta.MotionDirection)) {
|
2018-07-31 00:37:20 -04:00
|
|
|
|
let ws = null;
|
|
|
|
|
|
|
|
|
|
if (to < 0)
|
|
|
|
|
ws = curWs.get_neighbor(dir);
|
|
|
|
|
else if (dir == direction)
|
|
|
|
|
ws = workspaceManager.get_workspace_by_index(to);
|
|
|
|
|
|
|
|
|
|
if (ws == null || ws == curWs) {
|
2018-07-13 09:04:02 -04:00
|
|
|
|
switchData.surroundings[dir] = null;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let info = { index: ws.index(),
|
|
|
|
|
actor: new Clutter.Actor() };
|
|
|
|
|
switchData.surroundings[dir] = info;
|
|
|
|
|
switchData.container.add_actor(info.actor);
|
|
|
|
|
info.actor.raise_top();
|
|
|
|
|
|
2019-05-03 16:56:02 -04:00
|
|
|
|
let [x, y] = this._getPositionForDirection(dir, curWs, ws);
|
2018-07-13 09:04:02 -04:00
|
|
|
|
info.actor.set_position(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switchData.movingWindowBin.raise_top();
|
2008-12-01 14:51:43 -05:00
|
|
|
|
|
|
|
|
|
for (let i = 0; i < windows.length; i++) {
|
2013-11-04 21:24:27 -05:00
|
|
|
|
let actor = windows[i];
|
|
|
|
|
let window = actor.get_meta_window();
|
2009-05-11 13:06:42 -04:00
|
|
|
|
|
2013-11-04 21:24:27 -05:00
|
|
|
|
if (!window.showing_on_its_workspace())
|
2009-05-11 13:06:42 -04:00
|
|
|
|
continue;
|
|
|
|
|
|
2013-11-04 21:24:27 -05:00
|
|
|
|
if (window.is_on_all_workspaces())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
let record = { window: actor,
|
|
|
|
|
parent: actor.get_parent() };
|
|
|
|
|
|
|
|
|
|
if (this._movingWindow && window == this._movingWindow) {
|
|
|
|
|
switchData.movingWindow = record;
|
2012-06-26 14:11:44 -04:00
|
|
|
|
switchData.windows.push(switchData.movingWindow);
|
2013-11-04 21:24:27 -05:00
|
|
|
|
actor.reparent(switchData.movingWindowBin);
|
|
|
|
|
} else if (window.get_workspace().index() == from) {
|
|
|
|
|
switchData.windows.push(record);
|
2018-07-13 09:04:02 -04:00
|
|
|
|
actor.reparent(switchData.curGroup);
|
|
|
|
|
} else {
|
|
|
|
|
let visible = false;
|
|
|
|
|
for (let dir of Object.values(Meta.MotionDirection)) {
|
|
|
|
|
let info = switchData.surroundings[dir];
|
|
|
|
|
|
|
|
|
|
if (!info || info.index != window.get_workspace().index())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
switchData.windows.push(record);
|
|
|
|
|
actor.reparent(info.actor);
|
|
|
|
|
visible = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor.visible = visible;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
}
|
2008-11-21 16:34:10 -05:00
|
|
|
|
}
|
2018-09-06 15:50:21 -04:00
|
|
|
|
|
|
|
|
|
for (let i = 0; i < switchData.windows.length; i++) {
|
|
|
|
|
let w = switchData.windows[i];
|
|
|
|
|
|
|
|
|
|
w.windowDestroyId = w.window.connect('destroy', () => {
|
|
|
|
|
switchData.windows.splice(switchData.windows.indexOf(w), 1);
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-11-21 16:34:10 -05:00
|
|
|
|
|
2018-07-13 09:04:02 -04:00
|
|
|
|
_finishWorkspaceSwitch(switchData) {
|
|
|
|
|
this._switchData = null;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
|
2018-07-13 09:04:02 -04:00
|
|
|
|
for (let i = 0; i < switchData.windows.length; i++) {
|
|
|
|
|
let w = switchData.windows[i];
|
|
|
|
|
|
2018-09-06 15:50:21 -04:00
|
|
|
|
w.window.disconnect(w.windowDestroyId);
|
2018-07-13 09:04:02 -04:00
|
|
|
|
w.window.reparent(w.parent);
|
2012-06-26 14:11:44 -04:00
|
|
|
|
|
2018-07-13 09:04:02 -04:00
|
|
|
|
if (w.window.get_meta_window().get_workspace() !=
|
|
|
|
|
global.workspace_manager.get_active_workspace())
|
|
|
|
|
w.window.hide();
|
|
|
|
|
}
|
|
|
|
|
Tweener.removeTweens(switchData.container);
|
|
|
|
|
switchData.container.destroy();
|
|
|
|
|
switchData.movingWindowBin.destroy();
|
|
|
|
|
|
|
|
|
|
this._movingWindow = null;
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2018-07-13 09:04:02 -04:00
|
|
|
|
|
|
|
|
|
_switchWorkspace(shellwm, from, to, direction) {
|
|
|
|
|
if (!Main.sessionMode.hasWorkspaces || !this._shouldAnimate()) {
|
|
|
|
|
shellwm.completed_switch_workspace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-13 17:38:03 -04:00
|
|
|
|
// If we come from a gesture, switchData will already be set,
|
|
|
|
|
// and we don't want to overwrite it.
|
|
|
|
|
if (!this._switchData)
|
|
|
|
|
this._prepareWorkspaceSwitch(from, to, direction);
|
|
|
|
|
|
|
|
|
|
this._switchData.inProgress = true;
|
|
|
|
|
|
2019-05-03 16:56:02 -04:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let fromWs = workspaceManager.get_workspace_by_index(from);
|
|
|
|
|
let toWs = workspaceManager.get_workspace_by_index(to);
|
|
|
|
|
|
|
|
|
|
let [xDest, yDest] = this._getPositionForDirection(direction, fromWs, toWs);
|
2018-07-13 09:04:02 -04:00
|
|
|
|
|
|
|
|
|
/* @direction is the direction that the "camera" moves, so the
|
|
|
|
|
* screen contents have to move one screen's worth in the
|
|
|
|
|
* opposite direction.
|
|
|
|
|
*/
|
|
|
|
|
xDest = -xDest;
|
|
|
|
|
yDest = -yDest;
|
|
|
|
|
|
|
|
|
|
Tweener.addTween(this._switchData.container,
|
2008-12-01 14:51:43 -05:00
|
|
|
|
{ x: xDest,
|
|
|
|
|
y: yDest,
|
2009-05-13 15:24:32 -04:00
|
|
|
|
time: WINDOW_ANIMATION_TIME,
|
2010-05-13 15:46:04 -04:00
|
|
|
|
transition: 'easeOutQuad',
|
2009-01-08 18:34:19 -05:00
|
|
|
|
onComplete: this._switchWorkspaceDone,
|
2009-09-15 13:09:51 -04:00
|
|
|
|
onCompleteScope: this,
|
|
|
|
|
onCompleteParams: [shellwm]
|
2008-12-01 14:51:43 -05:00
|
|
|
|
});
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2008-12-01 14:51:43 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_switchWorkspaceDone(shellwm) {
|
2018-07-13 09:04:02 -04:00
|
|
|
|
this._finishWorkspaceSwitch(this._switchData);
|
2009-09-15 13:09:51 -04:00
|
|
|
|
shellwm.completed_switch_workspace();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2009-04-13 10:55:41 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_showTilePreview(shellwm, window, tileRect, monitorIndex) {
|
2013-09-01 18:26:12 -04:00
|
|
|
|
if (!this._tilePreview)
|
|
|
|
|
this._tilePreview = new TilePreview();
|
|
|
|
|
this._tilePreview.show(window, tileRect, monitorIndex);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_hideTilePreview(shellwm) {
|
2013-09-01 18:26:12 -04:00
|
|
|
|
if (!this._tilePreview)
|
|
|
|
|
return;
|
|
|
|
|
this._tilePreview.hide();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-09-01 18:26:12 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_showWindowMenu(shellwm, window, menu, rect) {
|
2014-06-02 15:47:24 -04:00
|
|
|
|
this._windowMenuManager.showWindowMenuForWindow(window, menu, rect);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-03-13 18:51:10 -04:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_startSwitcher(display, window, binding) {
|
2016-05-19 10:36:46 -04:00
|
|
|
|
let constructor = null;
|
|
|
|
|
switch (binding.get_name()) {
|
2019-02-01 07:21:00 -05:00
|
|
|
|
case 'switch-applications':
|
|
|
|
|
case 'switch-applications-backward':
|
|
|
|
|
case 'switch-group':
|
|
|
|
|
case 'switch-group-backward':
|
|
|
|
|
constructor = AltTab.AppSwitcherPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'switch-windows':
|
|
|
|
|
case 'switch-windows-backward':
|
|
|
|
|
constructor = AltTab.WindowSwitcherPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'cycle-windows':
|
|
|
|
|
case 'cycle-windows-backward':
|
|
|
|
|
constructor = AltTab.WindowCyclerPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'cycle-group':
|
|
|
|
|
case 'cycle-group-backward':
|
|
|
|
|
constructor = AltTab.GroupCyclerPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'switch-monitor':
|
|
|
|
|
constructor = SwitchMonitor.SwitchMonitorPopup;
|
|
|
|
|
break;
|
2016-05-19 10:36:46 -04:00
|
|
|
|
}
|
2016-05-19 08:41:24 -04:00
|
|
|
|
|
2016-05-19 10:36:46 -04:00
|
|
|
|
if (!constructor)
|
|
|
|
|
return;
|
2016-05-19 08:41:24 -04:00
|
|
|
|
|
|
|
|
|
/* prevent a corner case where both popups show up at once */
|
|
|
|
|
if (this._workspaceSwitcherPopup != null)
|
|
|
|
|
this._workspaceSwitcherPopup.destroy();
|
|
|
|
|
|
2016-05-19 10:36:46 -04:00
|
|
|
|
let tabPopup = new constructor();
|
2016-05-19 08:41:24 -04:00
|
|
|
|
|
|
|
|
|
if (!tabPopup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
|
|
|
|
|
tabPopup.destroy();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2016-05-19 08:41:24 -04:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_startA11ySwitcher(display, window, binding) {
|
2014-05-29 17:26:25 -04:00
|
|
|
|
Main.ctrlAltTabManager.popup(binding.is_reversed(), binding.get_name(), binding.get_mask());
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2011-02-07 11:29:34 -05:00
|
|
|
|
|
2019-05-29 11:20:23 -04:00
|
|
|
|
_allowFavoriteShortcuts() {
|
|
|
|
|
return Main.sessionMode.hasOverview;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-29 05:48:06 -05:00
|
|
|
|
_switchToApplication(display, window, binding) {
|
2019-05-29 11:20:23 -04:00
|
|
|
|
if (!this._allowFavoriteShortcuts())
|
|
|
|
|
return;
|
|
|
|
|
|
2019-01-28 20:27:05 -05:00
|
|
|
|
let [, , , target] = binding.get_name().split('-');
|
2019-01-29 05:48:06 -05:00
|
|
|
|
let apps = AppFavorites.getAppFavorites().getFavorites();
|
|
|
|
|
let app = apps[target - 1];
|
|
|
|
|
if (app)
|
|
|
|
|
app.activate();
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_toggleAppMenu(display, window, event, binding) {
|
2013-04-26 10:14:55 -04:00
|
|
|
|
Main.panel.toggleAppMenu();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-03-27 09:26:20 -04:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_toggleCalendar(display, window, event, binding) {
|
2015-02-17 20:52:07 -05:00
|
|
|
|
Main.panel.toggleCalendar();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2015-02-17 20:52:07 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_toggleTweens() {
|
2014-01-14 08:49:32 -05:00
|
|
|
|
this._tweensPaused = !this._tweensPaused;
|
|
|
|
|
const OrigTweener = imports.tweener.tweener;
|
|
|
|
|
if (this._tweensPaused)
|
|
|
|
|
OrigTweener.pauseAllTweens();
|
|
|
|
|
else
|
|
|
|
|
OrigTweener.resumeAllTweens();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-01-14 08:49:32 -05:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
_showWorkspaceSwitcher(display, window, binding) {
|
|
|
|
|
let workspaceManager = display.get_workspace_manager();
|
|
|
|
|
|
2013-06-16 00:21:21 -04:00
|
|
|
|
if (!Main.sessionMode.hasWorkspaces)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
if (workspaceManager.n_workspaces == 1)
|
2010-02-12 17:52:15 -05:00
|
|
|
|
return;
|
|
|
|
|
|
2019-01-28 20:27:05 -05:00
|
|
|
|
let [action,,, target] = binding.get_name().split('-');
|
2012-06-27 15:13:32 -04:00
|
|
|
|
let newWs;
|
2013-05-17 10:54:23 -04:00
|
|
|
|
let direction;
|
|
|
|
|
|
2015-03-25 18:35:36 -04:00
|
|
|
|
if (action == 'move') {
|
|
|
|
|
// "Moving" a window to another workspace doesn't make sense when
|
|
|
|
|
// it cannot be unstuck, and is potentially confusing if a new
|
|
|
|
|
// workspaces is added at the start/end
|
|
|
|
|
if (window.is_always_on_all_workspaces() ||
|
|
|
|
|
(Meta.prefs_get_workspaces_only_on_primary() &&
|
|
|
|
|
window.get_monitor() != Main.layoutManager.primaryIndex))
|
2019-01-29 14:36:54 -05:00
|
|
|
|
return;
|
2015-03-25 18:35:36 -04:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-18 13:55:05 -04:00
|
|
|
|
if (target == 'last') {
|
|
|
|
|
direction = Meta.MotionDirection.DOWN;
|
2018-01-03 02:55:38 -05:00
|
|
|
|
newWs = workspaceManager.get_workspace_by_index(workspaceManager.n_workspaces - 1);
|
2013-05-18 13:55:05 -04:00
|
|
|
|
} else if (isNaN(target)) {
|
2015-01-15 18:13:58 -05:00
|
|
|
|
// Prepend a new workspace dynamically
|
2018-01-03 02:55:38 -05:00
|
|
|
|
if (workspaceManager.get_active_workspace_index() == 0 &&
|
2015-03-27 09:34:28 -04:00
|
|
|
|
action == 'move' && target == 'up' && this._isWorkspacePrepended == false) {
|
2015-01-15 18:13:58 -05:00
|
|
|
|
this.insertWorkspace(0);
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._isWorkspacePrepended = true;
|
|
|
|
|
}
|
2015-01-15 18:13:58 -05:00
|
|
|
|
|
2013-05-17 10:54:23 -04:00
|
|
|
|
direction = Meta.MotionDirection[target.toUpperCase()];
|
2018-01-03 02:55:38 -05:00
|
|
|
|
newWs = workspaceManager.get_active_workspace().get_neighbor(direction);
|
2019-01-24 17:06:48 -05:00
|
|
|
|
} else if ((target > 0) && (target <= workspaceManager.n_workspaces)) {
|
2013-05-17 10:54:23 -04:00
|
|
|
|
target--;
|
2018-01-03 02:55:38 -05:00
|
|
|
|
newWs = workspaceManager.get_workspace_by_index(target);
|
2013-05-17 10:54:23 -04:00
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
if (workspaceManager.get_active_workspace().index() > target)
|
2013-05-17 10:54:23 -04:00
|
|
|
|
direction = Meta.MotionDirection.UP;
|
|
|
|
|
else
|
|
|
|
|
direction = Meta.MotionDirection.DOWN;
|
|
|
|
|
}
|
2012-04-14 09:29:54 -04:00
|
|
|
|
|
2012-06-27 16:07:32 -04:00
|
|
|
|
if (direction != Meta.MotionDirection.UP &&
|
|
|
|
|
direction != Meta.MotionDirection.DOWN)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-04-14 09:29:54 -04:00
|
|
|
|
if (action == 'switch')
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.actionMoveWorkspace(newWs);
|
2012-04-14 09:29:54 -04:00
|
|
|
|
else
|
2013-05-17 10:54:23 -04:00
|
|
|
|
this.actionMoveWindow(window, newWs);
|
2012-06-27 15:13:32 -04:00
|
|
|
|
|
|
|
|
|
if (!Main.overview.visible) {
|
|
|
|
|
if (this._workspaceSwitcherPopup == null) {
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._workspaceTracker.blockUpdates();
|
2012-06-27 15:13:32 -04:00
|
|
|
|
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
|
2017-10-30 20:38:18 -04:00
|
|
|
|
this._workspaceSwitcherPopup.connect('destroy', () => {
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._workspaceTracker.unblockUpdates();
|
2012-06-27 15:13:32 -04:00
|
|
|
|
this._workspaceSwitcherPopup = null;
|
2015-03-27 09:34:28 -04:00
|
|
|
|
this._isWorkspacePrepended = false;
|
2017-10-30 20:38:18 -04:00
|
|
|
|
});
|
2012-06-27 15:13:32 -04:00
|
|
|
|
}
|
|
|
|
|
this._workspaceSwitcherPopup.display(direction, newWs.index());
|
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2010-03-16 22:08:52 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
actionMoveWorkspace(workspace) {
|
2013-06-16 00:21:21 -04:00
|
|
|
|
if (!Main.sessionMode.hasWorkspaces)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let activeWorkspace = workspaceManager.get_active_workspace();
|
2010-11-12 10:22:05 -05:00
|
|
|
|
|
2013-05-17 10:54:23 -04:00
|
|
|
|
if (activeWorkspace != workspace)
|
|
|
|
|
workspace.activate(global.get_current_time());
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2012-04-14 09:29:54 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
actionMoveWindow(window, workspace) {
|
2013-06-16 00:21:21 -04:00
|
|
|
|
if (!Main.sessionMode.hasWorkspaces)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-01-03 02:55:38 -05:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let activeWorkspace = workspaceManager.get_active_workspace();
|
2012-04-14 09:29:54 -04:00
|
|
|
|
|
2013-05-17 10:54:23 -04:00
|
|
|
|
if (activeWorkspace != workspace) {
|
2012-04-14 09:29:54 -04:00
|
|
|
|
// This won't have any effect for "always sticky" windows
|
|
|
|
|
// (like desktop windows or docks)
|
2012-06-26 14:11:44 -04:00
|
|
|
|
|
|
|
|
|
this._movingWindow = window;
|
2013-05-17 10:54:23 -04:00
|
|
|
|
window.change_workspace(workspace);
|
2012-04-14 09:29:54 -04:00
|
|
|
|
|
|
|
|
|
global.display.clear_mouse_mode();
|
2013-05-17 10:54:23 -04:00
|
|
|
|
workspace.activate_with_focus (window, global.get_current_time());
|
2012-04-14 09:29:54 -04:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2013-08-17 11:42:39 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_confirmDisplayChange() {
|
2013-08-17 11:42:39 -04:00
|
|
|
|
let dialog = new DisplayChangeDialog(this._shellwm);
|
|
|
|
|
dialog.open();
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2014-12-29 20:30:38 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_createCloseDialog(shellwm, window) {
|
2017-01-19 13:52:18 -05:00
|
|
|
|
return new CloseDialog.CloseDialog(window);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2017-01-19 13:52:18 -05:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_createInhibitShortcutsDialog(shellwm, window) {
|
2017-07-13 21:15:17 -04:00
|
|
|
|
return new InhibitShortcutsDialog.InhibitShortcutsDialog(window);
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
2017-07-13 21:15:17 -04:00
|
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
|
_showResizePopup(display, show, rect, displayW, displayH) {
|
2014-12-29 20:30:38 -05:00
|
|
|
|
if (show) {
|
|
|
|
|
if (!this._resizePopup)
|
|
|
|
|
this._resizePopup = new ResizePopup();
|
|
|
|
|
|
|
|
|
|
this._resizePopup.set(rect, displayW, displayH);
|
|
|
|
|
} else {
|
2015-01-02 12:27:52 -05:00
|
|
|
|
if (this._resizePopup) {
|
2014-12-29 20:30:38 -05:00
|
|
|
|
this._resizePopup.destroy();
|
2015-01-02 12:27:52 -05:00
|
|
|
|
this._resizePopup = null;
|
|
|
|
|
}
|
2014-12-29 20:30:38 -05:00
|
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
|
}
|
|
|
|
|
};
|