main: clean up handling of metacity keybindings during grabs
Although certain keys (like Ctrl-Alt-Tab and Alt-F2) should work in the overview, we generally don't want them to work from inside each others grabs. In particular, typing Left or Right from inside Ctrl-Alt-Tab should navigate among focus groups, not switch workspaces. https://bugzilla.gnome.org/show_bug.cgi?id=636971
This commit is contained in:
parent
ed83b5494c
commit
44f70646d3
@ -298,12 +298,6 @@ function _removeUnusedWorkspaces() {
|
||||
// are disabled with a global grab. (When there is a global grab, then
|
||||
// all key events will be delivered to the stage, so ::captured-event
|
||||
// on the stage can be used for global keybindings.)
|
||||
//
|
||||
// We expect to need to conditionally enable just a few keybindings
|
||||
// depending on circumstance; the main hackiness here is that we are
|
||||
// assuming that keybindings have their default values; really we
|
||||
// should be asking Mutter to resolve the key into an action and then
|
||||
// base our handling based on the action.
|
||||
function _globalKeyPressHandler(actor, event) {
|
||||
if (modalCount == 0)
|
||||
return false;
|
||||
@ -313,24 +307,14 @@ function _globalKeyPressHandler(actor, event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
let keyCode = event.get_key_code();
|
||||
let modifierState = Shell.get_event_state(event);
|
||||
// Check the overview key first, this isn't a Meta.KeyBindingAction yet
|
||||
if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
|
||||
// The super key is the default for triggering the overview, and should
|
||||
// get us out of the overview when we are already in it.
|
||||
if (overview.visible)
|
||||
overview.hide();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Whitelist some of the Metacity actions
|
||||
let display = global.screen.get_display();
|
||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||
|
||||
// This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
|
||||
let action = display.get_keybinding_action(keyCode, modifierState);
|
||||
switch (action) {
|
||||
case Meta.KeyBindingAction.COMMAND_SCREENSHOT:
|
||||
|
||||
// The screenshot action should always be available (even if a
|
||||
// modal dialog is present)
|
||||
if (action == Meta.KeyBindingAction.COMMAND_SCREENSHOT) {
|
||||
let gconf = GConf.Client.get_default();
|
||||
let command = gconf.get_string('/apps/metacity/keybinding_commands/command_screenshot');
|
||||
if (command != null && command != '') {
|
||||
@ -339,6 +323,20 @@ function _globalKeyPressHandler(actor, event) {
|
||||
p.run();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Other bindings are only available when the overview is up and
|
||||
// no modal dialog is present.
|
||||
if (!overview.visible || modalCount > 1)
|
||||
return false;
|
||||
|
||||
// This isn't a Meta.KeyBindingAction yet
|
||||
if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
|
||||
overview.hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case Meta.KeyBindingAction.WORKSPACE_LEFT:
|
||||
wm.actionMoveWorkspaceLeft();
|
||||
return true;
|
||||
@ -350,18 +348,12 @@ function _globalKeyPressHandler(actor, event) {
|
||||
getRunDialog().open();
|
||||
return true;
|
||||
case Meta.KeyBindingAction.PANEL_MAIN_MENU:
|
||||
if (overview.visible)
|
||||
overview.hide();
|
||||
return true;
|
||||
case Meta.KeyBindingAction.SWITCH_PANELS:
|
||||
// Only intercept this when we're in the overview, and don't
|
||||
// intercept it if something beyond that (like, say, the
|
||||
// ctrl-alt-tab popup!) is visible
|
||||
if (overview.visible && modalCount == 1) {
|
||||
ctrlAltTabManager.popup(modifierState & Clutter.ModifierType.SHIFT_MASK);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user