sessionMode: Add allowKeybindingsWhenModal property
Add a sessionMode.allowKeybindingsWhenModal property, which determines whether keybindings should still be handled while a modal dialog is up or not. https://bugzilla.gnome.org/show_bug.cgi?id=676156
This commit is contained in:
parent
ab3173487d
commit
de69c719fb
@ -563,6 +563,11 @@ function _globalKeyPressHandler(actor, event) {
|
|||||||
if (event.type() != Clutter.EventType.KEY_PRESS)
|
if (event.type() != Clutter.EventType.KEY_PRESS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!sessionMode.allowKeybindingsWhenModal) {
|
||||||
|
if (modalCount > (overview.visible ? 1 : 0))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
let keyCode = event.get_key_code();
|
let keyCode = event.get_key_code();
|
||||||
let ignoredModifiers = global.display.get_ignored_modifier_mask();
|
let ignoredModifiers = global.display.get_ignored_modifier_mask();
|
||||||
@ -571,11 +576,6 @@ function _globalKeyPressHandler(actor, event) {
|
|||||||
// This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
|
// This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
|
||||||
let action = global.display.get_keybinding_action(keyCode, modifierState);
|
let action = global.display.get_keybinding_action(keyCode, modifierState);
|
||||||
|
|
||||||
// Other bindings are only available to the user session when the overview is up and
|
|
||||||
// no modal dialog is present.
|
|
||||||
if (sessionMode.sessionType == Shell.SessionType.USER && (!overview.visible || modalCount > 1))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// This isn't a Meta.KeyBindingAction yet
|
// This isn't a Meta.KeyBindingAction yet
|
||||||
if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
|
if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
|
||||||
overview.hide();
|
overview.hide();
|
||||||
|
@ -13,6 +13,7 @@ const _modes = {
|
|||||||
showCalendarEvents: false,
|
showCalendarEvents: false,
|
||||||
allowSettings: false,
|
allowSettings: false,
|
||||||
allowExtensions: false,
|
allowExtensions: false,
|
||||||
|
allowKeybindingsWhenModal: true,
|
||||||
sessionType: Shell.SessionType.GDM },
|
sessionType: Shell.SessionType.GDM },
|
||||||
|
|
||||||
'user': { hasOverview: true,
|
'user': { hasOverview: true,
|
||||||
@ -20,6 +21,7 @@ const _modes = {
|
|||||||
showCalendarEvents: true,
|
showCalendarEvents: true,
|
||||||
allowSettings: true,
|
allowSettings: true,
|
||||||
allowExtensions: true,
|
allowExtensions: true,
|
||||||
|
allowKeybindingsWhenModal: false,
|
||||||
sessionType: Shell.SessionType.USER }
|
sessionType: Shell.SessionType.USER }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user