Rename KeyBindingMode to ActionMode

The keybinding mode is no longer used exclusively for actions triggered
by keybindings, so reflect this by a more generic name.

https://bugzilla.gnome.org/show_bug.cgi?id=740237
This commit is contained in:
Florian Müllner 2014-12-11 15:35:40 +01:00
parent ddeac2386f
commit e0eebc90e0
17 changed files with 175 additions and 174 deletions

View File

@ -1155,7 +1155,7 @@ const LoginDialog = new Lang.Class({
this.actor.show(); this.actor.show();
this.actor.opacity = 0; this.actor.opacity = 0;
Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOGIN_SCREEN }); Main.pushModal(this.actor, { actionMode: Shell.ActionMode.LOGIN_SCREEN });
Tweener.addTween(this.actor, Tweener.addTween(this.actor,
{ opacity: 255, { opacity: 255,

View File

@ -37,7 +37,7 @@ const EdgeDragAction = new Lang.Class({
if (this.get_n_current_points() == 0) if (this.get_n_current_points() == 0)
return false; return false;
if (!(this._allowedModes & Main.keybindingMode)) if (!(this._allowedModes & Main.actionMode))
return false; return false;
let [x, y] = this.get_press_coords(0); let [x, y] = this.get_press_coords(0);

View File

@ -458,8 +458,8 @@ const LayoutManager = new Lang.Class({
_setupTrayPressure: function() { _setupTrayPressure: function() {
this._trayPressure = new PressureBarrier(MESSAGE_TRAY_PRESSURE_THRESHOLD, this._trayPressure = new PressureBarrier(MESSAGE_TRAY_PRESSURE_THRESHOLD,
MESSAGE_TRAY_PRESSURE_TIMEOUT, MESSAGE_TRAY_PRESSURE_TIMEOUT,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW); Shell.ActionMode.OVERVIEW);
this._trayPressure.setEventFilter(this._trayBarrierEventFilter); this._trayPressure.setEventFilter(this._trayBarrierEventFilter);
this._trayPressure.connect('trigger', function(barrier) { this._trayPressure.connect('trigger', function(barrier) {
if (Main.layoutManager.bottomMonitor.inFullscreen) if (Main.layoutManager.bottomMonitor.inFullscreen)
@ -1067,8 +1067,8 @@ const HotCorner = new Lang.Class({
this._pressureBarrier = new PressureBarrier(HOT_CORNER_PRESSURE_THRESHOLD, this._pressureBarrier = new PressureBarrier(HOT_CORNER_PRESSURE_THRESHOLD,
HOT_CORNER_PRESSURE_TIMEOUT, HOT_CORNER_PRESSURE_TIMEOUT,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW); Shell.ActionMode.OVERVIEW);
this._pressureBarrier.connect('trigger', Lang.bind(this, this._toggleOverview)); this._pressureBarrier.connect('trigger', Lang.bind(this, this._toggleOverview));
// Cache the three ripples instead of dynamically creating and destroying them. // Cache the three ripples instead of dynamically creating and destroying them.
@ -1245,10 +1245,10 @@ const HotCorner = new Lang.Class({
const PressureBarrier = new Lang.Class({ const PressureBarrier = new Lang.Class({
Name: 'PressureBarrier', Name: 'PressureBarrier',
_init: function(threshold, timeout, keybindingMode) { _init: function(threshold, timeout, actionMode) {
this._threshold = threshold; this._threshold = threshold;
this._timeout = timeout; this._timeout = timeout;
this._keybindingMode = keybindingMode; this._actionMode = actionMode;
this._barriers = []; this._barriers = [];
this._eventFilter = null; this._eventFilter = null;
@ -1351,7 +1351,7 @@ const PressureBarrier = new Lang.Class({
return; return;
// Throw out all events not in the proper keybinding mode // Throw out all events not in the proper keybinding mode
if (!(this._keybindingMode & Main.keybindingMode)) if (!(this._actionMode & Main.actionMode))
return; return;
let slide = this._getDistanceAlongBarrier(barrier, event); let slide = this._getDistanceAlongBarrier(barrier, event);

View File

@ -1086,7 +1086,7 @@ const LookingGlass = new Lang.Class({
if (this._open) if (this._open)
return; return;
if (!Main.pushModal(this._entry, { keybindingMode: Shell.KeyBindingMode.LOOKING_GLASS })) if (!Main.pushModal(this._entry, { actionMode: Shell.ActionMode.LOOKING_GLASS }))
return; return;
this._notebook.selectIndex(0); this._notebook.selectIndex(0);

View File

@ -63,7 +63,7 @@ let shellMountOpDBusService = null;
let screenSaverDBus = null; let screenSaverDBus = null;
let screencastService = null; let screencastService = null;
let modalCount = 0; let modalCount = 0;
let keybindingMode = Shell.KeyBindingMode.NONE; let actionMode = Shell.ActionMode.NONE;
let modalActorFocusStack = []; let modalActorFocusStack = [];
let uiGroup = null; let uiGroup = null;
let magnifier = null; let magnifier = null;
@ -80,15 +80,15 @@ function _sessionUpdated() {
_loadDefaultStylesheet(); _loadDefaultStylesheet();
wm.setCustomKeybindingHandler('panel-main-menu', wm.setCustomKeybindingHandler('panel-main-menu',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null); sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null);
wm.allowKeybinding('overlay-key', Shell.KeyBindingMode.NORMAL | wm.allowKeybinding('overlay-key', Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW); Shell.ActionMode.OVERVIEW);
wm.setCustomKeybindingHandler('panel-run-dialog', wm.setCustomKeybindingHandler('panel-run-dialog',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
sessionMode.hasRunDialog ? openRunDialog : null); sessionMode.hasRunDialog ? openRunDialog : null);
if (!sessionMode.hasRunDialog) { if (!sessionMode.hasRunDialog) {
@ -209,8 +209,8 @@ function _initializeUI() {
} }
layoutManager.connect('startup-complete', function() { layoutManager.connect('startup-complete', function() {
if (keybindingMode == Shell.KeyBindingMode.NONE) { if (actionMode == Shell.ActionMode.NONE) {
keybindingMode = Shell.KeyBindingMode.NORMAL; actionMode = Shell.ActionMode.NORMAL;
} }
if (screenShield) { if (screenShield) {
screenShield.lockIfWasLocked(); screenShield.lockIfWasLocked();
@ -372,7 +372,7 @@ function _findModal(actor) {
* - options: Meta.ModalOptions flags to indicate that the pointer is * - options: Meta.ModalOptions flags to indicate that the pointer is
* already grabbed * already grabbed
* *
* - keybindingMode: used to set the current Shell.KeyBindingMode to filter * - actionMode: used to set the current Shell.ActionMode to filter
* global keybindings; the default of NONE will filter * global keybindings; the default of NONE will filter
* out all keybindings * out all keybindings
* *
@ -381,7 +381,7 @@ function _findModal(actor) {
function pushModal(actor, params) { function pushModal(actor, params) {
params = Params.parse(params, { timestamp: global.get_current_time(), params = Params.parse(params, { timestamp: global.get_current_time(),
options: 0, options: 0,
keybindingMode: Shell.KeyBindingMode.NONE }); actionMode: Shell.ActionMode.NONE });
if (modalCount == 0) { if (modalCount == 0) {
if (!global.begin_modal(params.timestamp, params.options)) { if (!global.begin_modal(params.timestamp, params.options)) {
@ -411,9 +411,9 @@ function pushModal(actor, params) {
destroyId: actorDestroyId, destroyId: actorDestroyId,
prevFocus: prevFocus, prevFocus: prevFocus,
prevFocusDestroyId: prevFocusDestroyId, prevFocusDestroyId: prevFocusDestroyId,
keybindingMode: keybindingMode }); actionMode: actionMode });
keybindingMode = params.keybindingMode; actionMode = params.actionMode;
global.stage.set_key_focus(actor); global.stage.set_key_focus(actor);
return true; return true;
} }
@ -439,7 +439,7 @@ function popModal(actor, timestamp) {
if (focusIndex < 0) { if (focusIndex < 0) {
global.stage.set_key_focus(null); global.stage.set_key_focus(null);
global.end_modal(timestamp); global.end_modal(timestamp);
keybindingMode = Shell.KeyBindingMode.NORMAL; actionMode = Shell.ActionMode.NORMAL;
throw new Error('incorrect pop'); throw new Error('incorrect pop');
} }
@ -452,7 +452,7 @@ function popModal(actor, timestamp) {
if (focusIndex == modalActorFocusStack.length - 1) { if (focusIndex == modalActorFocusStack.length - 1) {
if (record.prevFocus) if (record.prevFocus)
record.prevFocus.disconnect(record.prevFocusDestroyId); record.prevFocus.disconnect(record.prevFocusDestroyId);
keybindingMode = record.keybindingMode; actionMode = record.actionMode;
global.stage.set_key_focus(record.prevFocus); global.stage.set_key_focus(record.prevFocus);
} else { } else {
// If we have: // If we have:
@ -477,7 +477,7 @@ function popModal(actor, timestamp) {
for (let i = modalActorFocusStack.length - 1; i > focusIndex; i--) { for (let i = modalActorFocusStack.length - 1; i > focusIndex; i--) {
modalActorFocusStack[i].prevFocus = modalActorFocusStack[i - 1].prevFocus; modalActorFocusStack[i].prevFocus = modalActorFocusStack[i - 1].prevFocus;
modalActorFocusStack[i].prevFocusDestroyId = modalActorFocusStack[i - 1].prevFocusDestroyId; modalActorFocusStack[i].prevFocusDestroyId = modalActorFocusStack[i - 1].prevFocusDestroyId;
modalActorFocusStack[i].keybindingMode = modalActorFocusStack[i - 1].keybindingMode; modalActorFocusStack[i].actionMode = modalActorFocusStack[i - 1].actionMode;
} }
} }
modalActorFocusStack.splice(focusIndex, 1); modalActorFocusStack.splice(focusIndex, 1);
@ -488,7 +488,7 @@ function popModal(actor, timestamp) {
layoutManager.modalEnded(); layoutManager.modalEnded();
global.end_modal(timestamp); global.end_modal(timestamp);
Meta.enable_unredirect_for_screen(global.screen); Meta.enable_unredirect_for_screen(global.screen);
keybindingMode = Shell.KeyBindingMode.NORMAL; actionMode = Shell.ActionMode.NORMAL;
} }
function createLookingGlass() { function createLookingGlass() {

View File

@ -1852,7 +1852,7 @@ const MessageTray = new Lang.Class({
this.idleMonitor = Meta.IdleMonitor.get_core(); this.idleMonitor = Meta.IdleMonitor.get_core();
this._grabHelper = new GrabHelper.GrabHelper(this.actor, this._grabHelper = new GrabHelper.GrabHelper(this.actor,
{ keybindingMode: Shell.KeyBindingMode.MESSAGE_TRAY }); { actionMode: Shell.ActionMode.MESSAGE_TRAY });
this._grabHelper.addActor(this._summaryBoxPointer.actor); this._grabHelper.addActor(this._summaryBoxPointer.actor);
this._grabHelper.addActor(this.actor); this._grabHelper.addActor(this.actor);
@ -1916,16 +1916,16 @@ const MessageTray = new Lang.Class({
Main.wm.addKeybinding('toggle-message-tray', Main.wm.addKeybinding('toggle-message-tray',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.MESSAGE_TRAY | Shell.ActionMode.MESSAGE_TRAY |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this.toggleAndNavigate)); Lang.bind(this, this.toggleAndNavigate));
Main.wm.addKeybinding('focus-active-notification', Main.wm.addKeybinding('focus-active-notification',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.MESSAGE_TRAY | Shell.ActionMode.MESSAGE_TRAY |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._expandActiveNotification)); Lang.bind(this, this._expandActiveNotification));
this._sources = new Map(); this._sources = new Map();
@ -1952,8 +1952,8 @@ const MessageTray = new Lang.Class({
Lang.bind(this, this._onTrayButtonKeyPress)); Lang.bind(this, this._onTrayButtonKeyPress));
let gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, let gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW); Shell.ActionMode.OVERVIEW);
gesture.connect('activated', Lang.bind(this, this.toggle)); gesture.connect('activated', Lang.bind(this, this.toggle));
global.stage.add_action(gesture); global.stage.add_action(gesture);
}, },

View File

@ -41,14 +41,14 @@ const ModalDialog = new Lang.Class({
_init: function(params) { _init: function(params) {
params = Params.parse(params, { shellReactive: false, params = Params.parse(params, { shellReactive: false,
styleClass: null, styleClass: null,
keybindingMode: Shell.KeyBindingMode.SYSTEM_MODAL, actionMode: Shell.ActionMode.SYSTEM_MODAL,
shouldFadeIn: true, shouldFadeIn: true,
shouldFadeOut: true, shouldFadeOut: true,
destroyOnClose: true }); destroyOnClose: true });
this.state = State.CLOSED; this.state = State.CLOSED;
this._hasModal = false; this._hasModal = false;
this._keybindingMode = params.keybindingMode; this._actionMode = params.actionMode;
this._shellReactive = params.shellReactive; this._shellReactive = params.shellReactive;
this._shouldFadeIn = params.shouldFadeIn; this._shouldFadeIn = params.shouldFadeIn;
this._shouldFadeOut = params.shouldFadeOut; this._shouldFadeOut = params.shouldFadeOut;
@ -362,7 +362,7 @@ const ModalDialog = new Lang.Class({
if (this._hasModal) if (this._hasModal)
return true; return true;
if (!Main.pushModal(this._group, { timestamp: timestamp, if (!Main.pushModal(this._group, { timestamp: timestamp,
keybindingMode: this._keybindingMode })) actionMode: this._actionMode }))
return false; return false;
this._hasModal = true; this._hasModal = true;

View File

@ -509,7 +509,7 @@ const Overview = new Lang.Class({
if (shouldBeModal) { if (shouldBeModal) {
if (!this._modal) { if (!this._modal) {
if (Main.pushModal(this._overview, if (Main.pushModal(this._overview,
{ keybindingMode: Shell.KeyBindingMode.OVERVIEW })) { { actionMode: Shell.ActionMode.OVERVIEW })) {
this._modal = true; this._modal = true;
} else { } else {
this.hide(); this.hide();

View File

@ -893,7 +893,7 @@ const Panel = new Lang.Class({
this.statusArea = {}; this.statusArea = {};
this.menuManager = new PopupMenu.PopupMenuManager(this, { keybindingMode: Shell.KeyBindingMode.TOPBAR_POPUP }); this.menuManager = new PopupMenu.PopupMenuManager(this, { actionMode: Shell.ActionMode.TOPBAR_POPUP });
this._leftBox = new St.BoxLayout({ name: 'panelLeft' }); this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
this.actor.add_actor(this._leftBox); this.actor.add_actor(this._leftBox);

View File

@ -647,14 +647,14 @@ const ScreenShield = new Lang.Class({
if (this._isModal) if (this._isModal)
return true; return true;
this._isModal = Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN }); this._isModal = Main.pushModal(this.actor, { actionMode: Shell.ActionMode.LOCK_SCREEN });
if (this._isModal) if (this._isModal)
return true; return true;
// We failed to get a pointer grab, it means that // We failed to get a pointer grab, it means that
// something else has it. Try with a keyboard grab only // something else has it. Try with a keyboard grab only
this._isModal = Main.pushModal(this.actor, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED, this._isModal = Main.pushModal(this.actor, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED,
keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN }); actionMode: Shell.ActionMode.LOCK_SCREEN });
return this._isModal; return this._isModal;
}, },

View File

@ -163,13 +163,13 @@ const InputSourceManager = new Lang.Class({
Main.wm.addKeybinding('switch-input-source', Main.wm.addKeybinding('switch-input-source',
new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }), new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.ALL, Shell.ActionMode.ALL,
Lang.bind(this, this._switchInputSource)); Lang.bind(this, this._switchInputSource));
this._keybindingActionBackward = this._keybindingActionBackward =
Main.wm.addKeybinding('switch-input-source-backward', Main.wm.addKeybinding('switch-input-source-backward',
new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }), new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }),
Meta.KeyBindingFlags.IS_REVERSED, Meta.KeyBindingFlags.IS_REVERSED,
Shell.KeyBindingMode.ALL, Shell.ActionMode.ALL,
Lang.bind(this, this._switchInputSource)); Lang.bind(this, this._switchInputSource));
this._settings = new Gio.Settings({ schema_id: DESKTOP_INPUT_SOURCES_SCHEMA }); this._settings = new Gio.Settings({ schema_id: DESKTOP_INPUT_SOURCES_SCHEMA });
this._settings.connect('changed::' + KEY_INPUT_SOURCES, Lang.bind(this, this._inputSourcesChanged)); this._settings.connect('changed::' + KEY_INPUT_SOURCES, Lang.bind(this, this._inputSourcesChanged));
@ -239,8 +239,8 @@ const InputSourceManager = new Lang.Class({
// effect without considerable work to consolidate the usage // effect without considerable work to consolidate the usage
// of pushModal/popModal and grabHelper. See // of pushModal/popModal and grabHelper. See
// https://bugzilla.gnome.org/show_bug.cgi?id=695143 . // https://bugzilla.gnome.org/show_bug.cgi?id=695143 .
if (Main.keybindingMode == Shell.KeyBindingMode.MESSAGE_TRAY || if (Main.actionMode == Shell.ActionMode.MESSAGE_TRAY ||
Main.keybindingMode == Shell.KeyBindingMode.TOPBAR_POPUP) { Main.actionMode == Shell.ActionMode.TOPBAR_POPUP) {
this._modifiersSwitcher(); this._modifiersSwitcher();
return; return;
} }

View File

@ -154,7 +154,7 @@ const UnlockDialog = new Lang.Class({
return true; return true;
if (!Main.pushModal(this.actor, { timestamp: timestamp, if (!Main.pushModal(this.actor, { timestamp: timestamp,
keybindingMode: Shell.KeyBindingMode.UNLOCK_SCREEN })) actionMode: Shell.ActionMode.UNLOCK_SCREEN }))
return false; return false;
this._isModal = true; this._isModal = true;

View File

@ -65,7 +65,7 @@ const ShowOverviewAction = new Lang.Class({
}, },
vfunc_gesture_prepare : function(action, actor) { vfunc_gesture_prepare : function(action, actor) {
return Main.keybindingMode == Shell.KeyBindingMode.NORMAL && return Main.actionMode == Shell.ActionMode.NORMAL &&
this.get_n_current_points() == this.get_n_touch_points(); this.get_n_current_points() == this.get_n_touch_points();
}, },
@ -203,21 +203,21 @@ const ViewSelector = new Lang.Class({
Main.wm.addKeybinding('toggle-application-view', Main.wm.addKeybinding('toggle-application-view',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._toggleAppsPage)); Lang.bind(this, this._toggleAppsPage));
Main.wm.addKeybinding('toggle-overview', Main.wm.addKeybinding('toggle-overview',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(Main.overview, Main.overview.toggle)); Lang.bind(Main.overview, Main.overview.toggle));
let gesture; let gesture;
gesture = new EdgeDragAction.EdgeDragAction(St.Side.LEFT, gesture = new EdgeDragAction.EdgeDragAction(St.Side.LEFT,
Shell.KeyBindingMode.NORMAL); Shell.ActionMode.NORMAL);
gesture.connect('activated', Lang.bind(this, function() { gesture.connect('activated', Lang.bind(this, function() {
if (Main.overview.visible) if (Main.overview.visible)
Main.overview.hide(); Main.overview.hide();

View File

@ -478,9 +478,9 @@ const WorkspaceSwitchAction = new Lang.Class({
}, },
vfunc_gesture_prepare : function(action, actor) { vfunc_gesture_prepare : function(action, actor) {
let allowedModes = Shell.KeyBindingMode.NORMAL | Shell.KeyBindingMode.OVERVIEW; let allowedModes = Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW;
return this.get_n_current_points() == this.get_n_touch_points() && return this.get_n_current_points() == this.get_n_touch_points() &&
(allowedModes & Main.keybindingMode); (allowedModes & Main.actionMode);
}, },
vfunc_gesture_end : function(action, actor) { vfunc_gesture_end : function(action, actor) {
@ -528,7 +528,7 @@ const AppSwitchAction = new Lang.Class({
}, },
vfunc_gesture_prepare : function(action, actor) { vfunc_gesture_prepare : function(action, actor) {
if (Main.keybindingMode != Shell.KeyBindingMode.NORMAL) { if (Main.actionMode != Shell.ActionMode.NORMAL) {
this.cancel(); this.cancel();
return false; return false;
} }
@ -623,172 +623,172 @@ const WindowManager = new Lang.Class({
this._tilePreview = null; this._tilePreview = null;
this.setCustomKeybindingHandler('switch-to-workspace-left', this.setCustomKeybindingHandler('switch-to-workspace-left',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-right', this.setCustomKeybindingHandler('switch-to-workspace-right',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-up', this.setCustomKeybindingHandler('switch-to-workspace-up',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-down', this.setCustomKeybindingHandler('switch-to-workspace-down',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-last', this.setCustomKeybindingHandler('switch-to-workspace-last',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-left', this.setCustomKeybindingHandler('move-to-workspace-left',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-right', this.setCustomKeybindingHandler('move-to-workspace-right',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-up', this.setCustomKeybindingHandler('move-to-workspace-up',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-down', this.setCustomKeybindingHandler('move-to-workspace-down',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-1', this.setCustomKeybindingHandler('switch-to-workspace-1',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-2', this.setCustomKeybindingHandler('switch-to-workspace-2',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-3', this.setCustomKeybindingHandler('switch-to-workspace-3',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-4', this.setCustomKeybindingHandler('switch-to-workspace-4',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-5', this.setCustomKeybindingHandler('switch-to-workspace-5',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-6', this.setCustomKeybindingHandler('switch-to-workspace-6',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-7', this.setCustomKeybindingHandler('switch-to-workspace-7',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-8', this.setCustomKeybindingHandler('switch-to-workspace-8',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-9', this.setCustomKeybindingHandler('switch-to-workspace-9',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-10', this.setCustomKeybindingHandler('switch-to-workspace-10',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-11', this.setCustomKeybindingHandler('switch-to-workspace-11',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-12', this.setCustomKeybindingHandler('switch-to-workspace-12',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW, Shell.ActionMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-1', this.setCustomKeybindingHandler('move-to-workspace-1',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-2', this.setCustomKeybindingHandler('move-to-workspace-2',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-3', this.setCustomKeybindingHandler('move-to-workspace-3',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-4', this.setCustomKeybindingHandler('move-to-workspace-4',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-5', this.setCustomKeybindingHandler('move-to-workspace-5',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-6', this.setCustomKeybindingHandler('move-to-workspace-6',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-7', this.setCustomKeybindingHandler('move-to-workspace-7',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-8', this.setCustomKeybindingHandler('move-to-workspace-8',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-9', this.setCustomKeybindingHandler('move-to-workspace-9',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-10', this.setCustomKeybindingHandler('move-to-workspace-10',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-11', this.setCustomKeybindingHandler('move-to-workspace-11',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-12', this.setCustomKeybindingHandler('move-to-workspace-12',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-last', this.setCustomKeybindingHandler('move-to-workspace-last',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._showWorkspaceSwitcher)); Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-applications', this.setCustomKeybindingHandler('switch-applications',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._startAppSwitcher)); Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-group', this.setCustomKeybindingHandler('switch-group',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._startAppSwitcher)); Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-applications-backward', this.setCustomKeybindingHandler('switch-applications-backward',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._startAppSwitcher)); Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-group-backward', this.setCustomKeybindingHandler('switch-group-backward',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._startAppSwitcher)); Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-windows', this.setCustomKeybindingHandler('switch-windows',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._startWindowSwitcher)); Lang.bind(this, this._startWindowSwitcher));
this.setCustomKeybindingHandler('switch-windows-backward', this.setCustomKeybindingHandler('switch-windows-backward',
Shell.KeyBindingMode.NORMAL, Shell.ActionMode.NORMAL,
Lang.bind(this, this._startWindowSwitcher)); Lang.bind(this, this._startWindowSwitcher));
this.setCustomKeybindingHandler('switch-panels', this.setCustomKeybindingHandler('switch-panels',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW | Shell.ActionMode.OVERVIEW |
Shell.KeyBindingMode.LOCK_SCREEN | Shell.ActionMode.LOCK_SCREEN |
Shell.KeyBindingMode.UNLOCK_SCREEN | Shell.ActionMode.UNLOCK_SCREEN |
Shell.KeyBindingMode.LOGIN_SCREEN, Shell.ActionMode.LOGIN_SCREEN,
Lang.bind(this, this._startA11ySwitcher)); Lang.bind(this, this._startA11ySwitcher));
this.setCustomKeybindingHandler('switch-panels-backward', this.setCustomKeybindingHandler('switch-panels-backward',
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.OVERVIEW | Shell.ActionMode.OVERVIEW |
Shell.KeyBindingMode.LOCK_SCREEN | Shell.ActionMode.LOCK_SCREEN |
Shell.KeyBindingMode.UNLOCK_SCREEN | Shell.ActionMode.UNLOCK_SCREEN |
Shell.KeyBindingMode.LOGIN_SCREEN, Shell.ActionMode.LOGIN_SCREEN,
Lang.bind(this, this._startA11ySwitcher)); Lang.bind(this, this._startA11ySwitcher));
this.addKeybinding('pause-resume-tweens', this.addKeybinding('pause-resume-tweens',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.ALL, Shell.ActionMode.ALL,
Lang.bind(this, this._toggleTweens)); Lang.bind(this, this._toggleTweens));
this.addKeybinding('open-application-menu', this.addKeybinding('open-application-menu',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE, Meta.KeyBindingFlags.NONE,
Shell.KeyBindingMode.NORMAL | Shell.ActionMode.NORMAL |
Shell.KeyBindingMode.TOPBAR_POPUP, Shell.ActionMode.TOPBAR_POPUP,
Lang.bind(this, this._toggleAppMenu)); Lang.bind(this, this._toggleAppMenu));
Main.overview.connect('showing', Lang.bind(this, function() { Main.overview.connect('showing', Lang.bind(this, function() {
@ -877,7 +877,7 @@ const WindowManager = new Lang.Class({
removeKeybinding: function(name) { removeKeybinding: function(name) {
if (global.display.remove_keybinding(name)) if (global.display.remove_keybinding(name))
this.allowKeybinding(name, Shell.KeyBindingMode.NONE); this.allowKeybinding(name, Shell.ActionMode.NONE);
}, },
allowKeybinding: function(name, modes) { allowKeybinding: function(name, modes) {
@ -1234,18 +1234,18 @@ const WindowManager = new Lang.Class({
}, },
_filterKeybinding: function(shellwm, binding) { _filterKeybinding: function(shellwm, binding) {
if (Main.keybindingMode == Shell.KeyBindingMode.NONE) if (Main.actionMode == Shell.ActionMode.NONE)
return true; return true;
// There's little sense in implementing a keybinding in mutter and // There's little sense in implementing a keybinding in mutter and
// not having it work in NORMAL mode; handle this case generically // not having it work in NORMAL mode; handle this case generically
// so we don't have to explicitly allow all builtin keybindings in // so we don't have to explicitly allow all builtin keybindings in
// NORMAL mode. // NORMAL mode.
if (Main.keybindingMode == Shell.KeyBindingMode.NORMAL && if (Main.actionMode == Shell.ActionMode.NORMAL &&
binding.is_builtin()) binding.is_builtin())
return false; return false;
return !(this._allowedKeybindings[binding.get_name()] & Main.keybindingMode); return !(this._allowedKeybindings[binding.get_name()] & Main.actionMode);
}, },
_switchWorkspace : function(shellwm, from, to, direction) { _switchWorkspace : function(shellwm, from, to, direction) {

View File

@ -99,7 +99,7 @@ shell_public_headers_h = \
shell-gtk-embed.h \ shell-gtk-embed.h \
shell-global.h \ shell-global.h \
shell-invert-lightness-effect.h \ shell-invert-lightness-effect.h \
shell-keybinding-modes.h \ shell-action-modes.h \
shell-mount-operation.h \ shell-mount-operation.h \
shell-perf-log.h \ shell-perf-log.h \
shell-screenshot.h \ shell-screenshot.h \

39
src/shell-action-modes.h Normal file
View File

@ -0,0 +1,39 @@
/**
* ShellActionMode:
* @SHELL_ACTION_MODE_NONE: block action
* @SHELL_ACTION_MODE_NORMAL: allow action when in window mode,
* e.g. when the focus is in an application window
* @SHELL_ACTION_MODE_OVERVIEW: allow action while the overview
* is active
* @SHELL_ACTION_MODE_LOCK_SCREEN: allow action when the screen
* is locked, e.g. when the screen shield is shown
* @SHELL_ACTION_MODE_UNLOCK_SCREEN: allow action in the unlock
* dialog
* @SHELL_ACTION_MODE_LOGIN_SCREEN: allow action in the login screen
* @SHELL_ACTION_MODE_MESSAGE_TRAY: allow action while the message
* tray is popped up
* @SHELL_ACTION_MODE_SYSTEM_MODAL: allow action when a system modal
* dialog (e.g. authentification or session dialogs) is open
* @SHELL_ACTION_MODE_LOOKING_GLASS: allow action in looking glass
* @SHELL_ACTION_MODE_TOPBAR_POPUP: allow action while a top bar menu
* is open
* @SHELL_ACTION_MODE_ALL: always allow action
*
* Controls in which GNOME Shell states an action (like keybindings and gestures)
* should be handled.
*/
typedef enum {
SHELL_ACTION_MODE_NONE = 0,
SHELL_ACTION_MODE_NORMAL = 1 << 0,
SHELL_ACTION_MODE_OVERVIEW = 1 << 1,
SHELL_ACTION_MODE_LOCK_SCREEN = 1 << 2,
SHELL_ACTION_MODE_UNLOCK_SCREEN = 1 << 3,
SHELL_ACTION_MODE_LOGIN_SCREEN = 1 << 4,
SHELL_ACTION_MODE_MESSAGE_TRAY = 1 << 5,
SHELL_ACTION_MODE_SYSTEM_MODAL = 1 << 6,
SHELL_ACTION_MODE_LOOKING_GLASS = 1 << 7,
SHELL_ACTION_MODE_TOPBAR_POPUP = 1 << 8,
SHELL_ACTION_MODE_ALL = ~0,
} ShellActionMode;

View File

@ -1,38 +0,0 @@
/**
* ShellKeyBindingMode:
* @SHELL_KEYBINDING_MODE_NONE: block keybinding
* @SHELL_KEYBINDING_MODE_NORMAL: allow keybinding when in window mode,
* e.g. when the focus is in an application window
* @SHELL_KEYBINDING_MODE_OVERVIEW: allow keybinding while the overview
* is active
* @SHELL_KEYBINDING_MODE_LOCK_SCREEN: allow keybinding when the screen
* is locked, e.g. when the screen shield is shown
* @SHELL_KEYBINDING_MODE_UNLOCK_SCREEN: allow keybinding in the unlock
* dialog
* @SHELL_KEYBINDING_MODE_LOGIN_SCREEN: allow keybinding in the login screen
* @SHELL_KEYBINDING_MODE_MESSAGE_TRAY: allow keybinding while the message
* tray is popped up
* @SHELL_KEYBINDING_MODE_SYSTEM_MODAL: allow keybinding when a system modal
* dialog (e.g. authentification or session dialogs) is open
* @SHELL_KEYBINDING_MODE_LOOKING_GLASS: allow keybinding in looking glass
* @SHELL_KEYBINDING_MODE_TOPBAR_POPUP: allow keybinding while a top bar menu
* is open
* @SHELL_KEYBINDING_MODE_ALL: always allow keybinding
*
* Controls in which GNOME Shell states a keybinding should be handled.
*/
typedef enum {
SHELL_KEYBINDING_MODE_NONE = 0,
SHELL_KEYBINDING_MODE_NORMAL = 1 << 0,
SHELL_KEYBINDING_MODE_OVERVIEW = 1 << 1,
SHELL_KEYBINDING_MODE_LOCK_SCREEN = 1 << 2,
SHELL_KEYBINDING_MODE_UNLOCK_SCREEN = 1 << 3,
SHELL_KEYBINDING_MODE_LOGIN_SCREEN = 1 << 4,
SHELL_KEYBINDING_MODE_MESSAGE_TRAY = 1 << 5,
SHELL_KEYBINDING_MODE_SYSTEM_MODAL = 1 << 6,
SHELL_KEYBINDING_MODE_LOOKING_GLASS = 1 << 7,
SHELL_KEYBINDING_MODE_TOPBAR_POPUP = 1 << 8,
SHELL_KEYBINDING_MODE_ALL = ~0,
} ShellKeyBindingMode;