main: Move KeybindingMode into Shell
Having the definition in C instead of Javascript allows sharing the corresponding header with gnome-settings-daemon. https://bugzilla.gnome.org/show_bug.cgi?id=643111
This commit is contained in:
parent
d07c8dcd9c
commit
b682c8e052
@ -677,7 +677,7 @@ const LoginDialog = new Lang.Class({
|
|||||||
this.parent({ shellReactive: true,
|
this.parent({ shellReactive: true,
|
||||||
styleClass: 'login-dialog',
|
styleClass: 'login-dialog',
|
||||||
parentActor: parentActor,
|
parentActor: parentActor,
|
||||||
keybindingMode: Main.KeybindingMode.LOGIN_SCREEN,
|
keybindingMode: Shell.KeyBindingMode.LOGIN_SCREEN,
|
||||||
shouldFadeIn: false });
|
shouldFadeIn: false });
|
||||||
this.connect('destroy',
|
this.connect('destroy',
|
||||||
Lang.bind(this, this._onDestroy));
|
Lang.bind(this, this._onDestroy));
|
||||||
|
@ -20,8 +20,8 @@ const Recorder = new Lang.Class({
|
|||||||
Main.wm.addKeybinding('toggle-recording',
|
Main.wm.addKeybinding('toggle-recording',
|
||||||
this._bindingSettings,
|
this._bindingSettings,
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._toggleRecorder));
|
Lang.bind(this, this._toggleRecorder));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1133,7 +1133,7 @@ const LookingGlass = new Lang.Class({
|
|||||||
if (this._open)
|
if (this._open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Main.pushModal(this._entry, { keybindingMode: Main.KeybindingMode.LOOKING_GLASS }))
|
if (!Main.pushModal(this._entry, { keybindingMode: Shell.KeyBindingMode.LOOKING_GLASS }))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._notebook.selectIndex(0);
|
this._notebook.selectIndex(0);
|
||||||
|
@ -40,19 +40,6 @@ const Util = imports.misc.util;
|
|||||||
const OVERRIDES_SCHEMA = 'org.gnome.shell.overrides';
|
const OVERRIDES_SCHEMA = 'org.gnome.shell.overrides';
|
||||||
const DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
|
const DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
|
||||||
|
|
||||||
const KeybindingMode = {
|
|
||||||
NONE: 0, // block all keybindings
|
|
||||||
NORMAL: 1 << 0, // window mode
|
|
||||||
OVERVIEW: 1 << 1,
|
|
||||||
LOCK_SCREEN: 1 << 2,
|
|
||||||
UNLOCK_SCREEN: 1 << 3,
|
|
||||||
LOGIN_SCREEN: 1 << 4,
|
|
||||||
MESSAGE_TRAY: 1 << 5,
|
|
||||||
SYSTEM_MODAL: 1 << 6,
|
|
||||||
LOOKING_GLASS: 1 << 7,
|
|
||||||
ALL: ~0,
|
|
||||||
};
|
|
||||||
|
|
||||||
let componentManager = null;
|
let componentManager = null;
|
||||||
let panel = null;
|
let panel = null;
|
||||||
let overview = null;
|
let overview = null;
|
||||||
@ -69,7 +56,7 @@ let shellDBusService = null;
|
|||||||
let shellMountOpDBusService = null;
|
let shellMountOpDBusService = null;
|
||||||
let screenSaverDBus = null;
|
let screenSaverDBus = null;
|
||||||
let modalCount = 0;
|
let modalCount = 0;
|
||||||
let keybindingMode = KeybindingMode.NORMAL;
|
let keybindingMode = Shell.KeyBindingMode.NORMAL;
|
||||||
let modalActorFocusStack = [];
|
let modalActorFocusStack = [];
|
||||||
let uiGroup = null;
|
let uiGroup = null;
|
||||||
let magnifier = null;
|
let magnifier = null;
|
||||||
@ -83,15 +70,15 @@ let _overridesSettings = null;
|
|||||||
|
|
||||||
function _sessionUpdated() {
|
function _sessionUpdated() {
|
||||||
wm.setCustomKeybindingHandler('panel-main-menu',
|
wm.setCustomKeybindingHandler('panel-main-menu',
|
||||||
KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null);
|
sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null);
|
||||||
wm.allowKeybinding('overlay-key', KeybindingMode.NORMAL |
|
wm.allowKeybinding('overlay-key', Shell.KeyBindingMode.NORMAL |
|
||||||
KeybindingMode.OVERVIEW);
|
Shell.KeyBindingMode.OVERVIEW);
|
||||||
|
|
||||||
wm.setCustomKeybindingHandler('panel-run-dialog',
|
wm.setCustomKeybindingHandler('panel-run-dialog',
|
||||||
KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
sessionMode.hasRunDialog ? openRunDialog : null);
|
sessionMode.hasRunDialog ? openRunDialog : null);
|
||||||
if (sessionMode.isGreeter)
|
if (sessionMode.isGreeter)
|
||||||
screenShield.showDialog();
|
screenShield.showDialog();
|
||||||
@ -517,7 +504,7 @@ function isInModalStack(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 Main.KeybindingMode to filter
|
* - keybindingMode: used to set the current Shell.KeyBindingMode to filter
|
||||||
* global keybindings; the default of NONE will filter
|
* global keybindings; the default of NONE will filter
|
||||||
* out all keybindings
|
* out all keybindings
|
||||||
*
|
*
|
||||||
@ -526,7 +513,7 @@ function isInModalStack(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: KeybindingMode.NONE });
|
keybindingMode: Shell.KeyBindingMode.NONE });
|
||||||
|
|
||||||
if (modalCount == 0) {
|
if (modalCount == 0) {
|
||||||
if (!global.begin_modal(params.timestamp, params.options)) {
|
if (!global.begin_modal(params.timestamp, params.options)) {
|
||||||
@ -587,7 +574,7 @@ function popModal(actor, timestamp) {
|
|||||||
global.stage.set_key_focus(null);
|
global.stage.set_key_focus(null);
|
||||||
global.end_modal(timestamp);
|
global.end_modal(timestamp);
|
||||||
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
|
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
|
||||||
keybindingMode = KeybindingMode.NORMAL;
|
keybindingMode = Shell.KeyBindingMode.NORMAL;
|
||||||
|
|
||||||
throw new Error('incorrect pop');
|
throw new Error('incorrect pop');
|
||||||
}
|
}
|
||||||
@ -636,7 +623,7 @@ function popModal(actor, timestamp) {
|
|||||||
global.end_modal(timestamp);
|
global.end_modal(timestamp);
|
||||||
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
|
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
|
||||||
Meta.enable_unredirect_for_screen(global.screen);
|
Meta.enable_unredirect_for_screen(global.screen);
|
||||||
keybindingMode = KeybindingMode.NORMAL;
|
keybindingMode = Shell.KeyBindingMode.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLookingGlass() {
|
function createLookingGlass() {
|
||||||
|
@ -1535,7 +1535,7 @@ const MessageTray = new Lang.Class({
|
|||||||
this.idleMonitor = new GnomeDesktop.IdleMonitor();
|
this.idleMonitor = new GnomeDesktop.IdleMonitor();
|
||||||
|
|
||||||
this._grabHelper = new GrabHelper.GrabHelper(this.actor,
|
this._grabHelper = new GrabHelper.GrabHelper(this.actor,
|
||||||
{ keybindingMode: Main.KeybindingMode.MESSAGE_TRAY });
|
{ keybindingMode: Shell.KeyBindingMode.MESSAGE_TRAY });
|
||||||
this._grabHelper.addActor(this._summaryBoxPointer.actor);
|
this._grabHelper.addActor(this._summaryBoxPointer.actor);
|
||||||
this._grabHelper.addActor(this.actor);
|
this._grabHelper.addActor(this.actor);
|
||||||
if (Main.panel.statusArea.activities)
|
if (Main.panel.statusArea.activities)
|
||||||
@ -1603,16 +1603,16 @@ const MessageTray = new Lang.Class({
|
|||||||
Main.wm.addKeybinding('toggle-message-tray',
|
Main.wm.addKeybinding('toggle-message-tray',
|
||||||
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.MESSAGE_TRAY |
|
Shell.KeyBindingMode.MESSAGE_TRAY |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.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: SHELL_KEYBINDINGS_SCHEMA }),
|
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.MESSAGE_TRAY |
|
Shell.KeyBindingMode.MESSAGE_TRAY |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._expandActiveNotification));
|
Lang.bind(this, this._expandActiveNotification));
|
||||||
|
|
||||||
this._sources = new Hash.Map();
|
this._sources = new Hash.Map();
|
||||||
|
@ -37,7 +37,7 @@ const ModalDialog = new Lang.Class({
|
|||||||
params = Params.parse(params, { shellReactive: false,
|
params = Params.parse(params, { shellReactive: false,
|
||||||
styleClass: null,
|
styleClass: null,
|
||||||
parentActor: Main.uiGroup,
|
parentActor: Main.uiGroup,
|
||||||
keybindingMode: Main.KeybindingMode.SYSTEM_MODAL,
|
keybindingMode: Shell.KeyBindingMode.SYSTEM_MODAL,
|
||||||
shouldFadeIn: true });
|
shouldFadeIn: true });
|
||||||
|
|
||||||
this.state = State.CLOSED;
|
this.state = State.CLOSED;
|
||||||
|
@ -576,7 +576,7 @@ const Overview = new Lang.Class({
|
|||||||
if (this._shown) {
|
if (this._shown) {
|
||||||
if (!this._modal) {
|
if (!this._modal) {
|
||||||
if (Main.pushModal(this._overview,
|
if (Main.pushModal(this._overview,
|
||||||
{ keybindingMode: Main.KeybindingMode.OVERVIEW }))
|
{ keybindingMode: Shell.KeyBindingMode.OVERVIEW }))
|
||||||
this._modal = true;
|
this._modal = true;
|
||||||
else
|
else
|
||||||
this.hide();
|
this.hide();
|
||||||
|
@ -8,6 +8,7 @@ const GnomeDesktop = imports.gi.GnomeDesktop;
|
|||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const TweenerEquations = imports.tweener.equations;
|
const TweenerEquations = imports.tweener.equations;
|
||||||
@ -693,7 +694,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._isModal) {
|
if (!this._isModal) {
|
||||||
Main.pushModal(this.actor, { keybindingMode: Main.KeybindingMode.LOCK_SCREEN });
|
Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
|
||||||
this._isModal = true;
|
this._isModal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1101,7 +1102,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
|
|
||||||
lock: function(animate) {
|
lock: function(animate) {
|
||||||
if (!this._isModal) {
|
if (!this._isModal) {
|
||||||
Main.pushModal(this.actor, { keybindingMode: Main.KeybindingMode.LOCK_SCREEN });
|
Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
|
||||||
this._isModal = true;
|
this._isModal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,14 +337,14 @@ const InputSourceIndicator = new Lang.Class({
|
|||||||
Main.wm.addKeybinding('switch-input-source',
|
Main.wm.addKeybinding('switch-input-source',
|
||||||
new Gio.Settings({ schema: "org.gnome.desktop.wm.keybindings" }),
|
new Gio.Settings({ schema: "org.gnome.desktop.wm.keybindings" }),
|
||||||
Meta.KeyBindingFlags.REVERSES,
|
Meta.KeyBindingFlags.REVERSES,
|
||||||
Main.KeybindingMode.ALL,
|
Shell.KeyBindingMode.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: "org.gnome.desktop.wm.keybindings" }),
|
new Gio.Settings({ schema: "org.gnome.desktop.wm.keybindings" }),
|
||||||
Meta.KeyBindingFlags.REVERSES |
|
Meta.KeyBindingFlags.REVERSES |
|
||||||
Meta.KeyBindingFlags.REVERSED,
|
Meta.KeyBindingFlags.REVERSED,
|
||||||
Main.KeybindingMode.ALL,
|
Shell.KeyBindingMode.ALL,
|
||||||
Lang.bind(this, this._switchInputSource));
|
Lang.bind(this, this._switchInputSource));
|
||||||
this._settings = new Gio.Settings({ schema: DESKTOP_INPUT_SOURCES_SCHEMA });
|
this._settings = new Gio.Settings({ schema: DESKTOP_INPUT_SOURCES_SCHEMA });
|
||||||
this._settings.connect('changed::' + KEY_CURRENT_INPUT_SOURCE, Lang.bind(this, this._currentInputSourceChanged));
|
this._settings.connect('changed::' + KEY_CURRENT_INPUT_SOURCE, Lang.bind(this, this._currentInputSourceChanged));
|
||||||
|
@ -115,7 +115,7 @@ const UnlockDialog = new Lang.Class({
|
|||||||
_init: function(parentActor) {
|
_init: function(parentActor) {
|
||||||
this.parent({ shellReactive: true,
|
this.parent({ shellReactive: true,
|
||||||
styleClass: 'login-dialog',
|
styleClass: 'login-dialog',
|
||||||
keybindingMode: Main.KeybindingMode.UNLOCK_SCREEN,
|
keybindingMode: Shell.KeyBindingMode.UNLOCK_SCREEN,
|
||||||
parentActor: parentActor
|
parentActor: parentActor
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ const ViewSelector = new Lang.Class({
|
|||||||
Main.wm.addKeybinding('toggle-application-view',
|
Main.wm.addKeybinding('toggle-application-view',
|
||||||
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._toggleAppsPage));
|
Lang.bind(this, this._toggleAppsPage));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -105,74 +105,74 @@ const WindowManager = new Lang.Class({
|
|||||||
|
|
||||||
this._workspaceSwitcherPopup = null;
|
this._workspaceSwitcherPopup = null;
|
||||||
this.setCustomKeybindingHandler('switch-to-workspace-left',
|
this.setCustomKeybindingHandler('switch-to-workspace-left',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-to-workspace-right',
|
this.setCustomKeybindingHandler('switch-to-workspace-right',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-to-workspace-up',
|
this.setCustomKeybindingHandler('switch-to-workspace-up',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-to-workspace-down',
|
this.setCustomKeybindingHandler('switch-to-workspace-down',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('move-to-workspace-left',
|
this.setCustomKeybindingHandler('move-to-workspace-left',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('move-to-workspace-right',
|
this.setCustomKeybindingHandler('move-to-workspace-right',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('move-to-workspace-up',
|
this.setCustomKeybindingHandler('move-to-workspace-up',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('move-to-workspace-down',
|
this.setCustomKeybindingHandler('move-to-workspace-down',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW,
|
Shell.KeyBindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-applications',
|
this.setCustomKeybindingHandler('switch-applications',
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-group',
|
this.setCustomKeybindingHandler('switch-group',
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-applications-backward',
|
this.setCustomKeybindingHandler('switch-applications-backward',
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-group-backward',
|
this.setCustomKeybindingHandler('switch-group-backward',
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-windows',
|
this.setCustomKeybindingHandler('switch-windows',
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._startWindowSwitcher));
|
Lang.bind(this, this._startWindowSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-windows-backward',
|
this.setCustomKeybindingHandler('switch-windows-backward',
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._startWindowSwitcher));
|
Lang.bind(this, this._startWindowSwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-panels',
|
this.setCustomKeybindingHandler('switch-panels',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW |
|
Shell.KeyBindingMode.OVERVIEW |
|
||||||
Main.KeybindingMode.LOCK_SCREEN |
|
Shell.KeyBindingMode.LOCK_SCREEN |
|
||||||
Main.KeybindingMode.UNLOCK_SCREEN |
|
Shell.KeyBindingMode.UNLOCK_SCREEN |
|
||||||
Main.KeybindingMode.LOGIN_SCREEN,
|
Shell.KeyBindingMode.LOGIN_SCREEN,
|
||||||
Lang.bind(this, this._startA11ySwitcher));
|
Lang.bind(this, this._startA11ySwitcher));
|
||||||
this.setCustomKeybindingHandler('switch-panels-backward',
|
this.setCustomKeybindingHandler('switch-panels-backward',
|
||||||
Main.KeybindingMode.NORMAL |
|
Shell.KeyBindingMode.NORMAL |
|
||||||
Main.KeybindingMode.OVERVIEW |
|
Shell.KeyBindingMode.OVERVIEW |
|
||||||
Main.KeybindingMode.LOCK_SCREEN |
|
Shell.KeyBindingMode.LOCK_SCREEN |
|
||||||
Main.KeybindingMode.UNLOCK_SCREEN |
|
Shell.KeyBindingMode.UNLOCK_SCREEN |
|
||||||
Main.KeybindingMode.LOGIN_SCREEN,
|
Shell.KeyBindingMode.LOGIN_SCREEN,
|
||||||
Lang.bind(this, this._startA11ySwitcher));
|
Lang.bind(this, this._startA11ySwitcher));
|
||||||
|
|
||||||
this.addKeybinding('open-application-menu',
|
this.addKeybinding('open-application-menu',
|
||||||
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Main.KeybindingMode.NORMAL,
|
Shell.KeyBindingMode.NORMAL,
|
||||||
Lang.bind(this, this._openAppMenu));
|
Lang.bind(this, this._openAppMenu));
|
||||||
|
|
||||||
Main.overview.connect('showing', Lang.bind(this, function() {
|
Main.overview.connect('showing', Lang.bind(this, function() {
|
||||||
@ -199,7 +199,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, Main.KeybindingMode.NONE);
|
this.allowKeybinding(name, Shell.KeyBindingMode.NONE);
|
||||||
},
|
},
|
||||||
|
|
||||||
allowKeybinding: function(name, modes) {
|
allowKeybinding: function(name, modes) {
|
||||||
@ -502,14 +502,14 @@ const WindowManager = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_filterKeybinding: function(shellwm, binding) {
|
_filterKeybinding: function(shellwm, binding) {
|
||||||
if (Main.keybindingMode == Main.KeybindingMode.NONE)
|
if (Main.keybindingMode == Shell.KeyBindingMode.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 == Main.KeybindingMode.NORMAL &&
|
if (Main.keybindingMode == Shell.KeyBindingMode.NORMAL &&
|
||||||
binding.is_builtin())
|
binding.is_builtin())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -115,6 +115,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-mobile-providers.h \
|
shell-mobile-providers.h \
|
||||||
shell-mount-operation.h \
|
shell-mount-operation.h \
|
||||||
shell-network-agent.h \
|
shell-network-agent.h \
|
||||||
|
35
src/shell-keybinding-modes.h
Normal file
35
src/shell-keybinding-modes.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* 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_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_ALL = ~SHELL_KEYBINDING_MODE_NONE
|
||||||
|
} ShellKeyBindingMode;
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user