Skip to content

Commit d0c4e07

Browse files
committed
main.js: _stageEventHandler - only track and eat a modifier release
when a keybinding has actually been invoked off of it. Fixes regression in alt-tab caused by a64cefd.
1 parent 14dac8d commit d0c4e07

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

js/ui/main.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,10 +1304,10 @@ function _shouldFilterKeybinding(entry) {
13041304
*/
13051305
let _modifierOnlyAction = 0;
13061306

1307-
// Tracks whether a non-modifier key has been pressed since the most recent
1308-
// modifier-key press while in a modal state. Used to tell a bare modifier tap
1309-
// apart from a modifier used as part of a shortcut.
1310-
let _nonModifierPressedSinceModifier = false;
1307+
// Tracks whether a keybinding shortcut has actually been invoked through this
1308+
// handler since the most recent modifier-key press while in a modal state. Used
1309+
// to tell a bare modifier tap apart from a modifier used as part of a shortcut.
1310+
let _shortcutInvokedSinceModifier = false;
13111311

13121312
function _isModifierKeyval(symbol) {
13131313
return symbol === Clutter.KEY_Super_L || symbol === Clutter.KEY_Super_R ||
@@ -1340,7 +1340,7 @@ function _stageEventHandler(actor, event) {
13401340

13411341
if (eventType === Clutter.EventType.KEY_PRESS) {
13421342
if (_isModifierKeyval(event.get_key_symbol())) {
1343-
_nonModifierPressedSinceModifier = false;
1343+
_shortcutInvokedSinceModifier = false;
13441344
let action = global.display.get_keybinding_action(keyCode, modifierState);
13451345
if (action > 0) {
13461346
let entry = keybindingManager.getBindingById(action);
@@ -1353,7 +1353,6 @@ function _stageEventHandler(actor, event) {
13531353
}
13541354

13551355
_modifierOnlyAction = 0;
1356-
_nonModifierPressedSinceModifier = true;
13571356

13581357
// During modal, muffin's process_iso_next_group doesn't run, handle xkb 'grp'
13591358
// here.
@@ -1366,6 +1365,7 @@ function _stageEventHandler(actor, event) {
13661365
if (action > 0) {
13671366
let entry = keybindingManager.getBindingById(action);
13681367
if (!_shouldFilterKeybinding(entry)) {
1368+
_shortcutInvokedSinceModifier = true;
13691369
keybindingManager.invoke_keybinding_action_by_id(action);
13701370
return Clutter.EVENT_STOP;
13711371
}
@@ -1384,11 +1384,10 @@ function _stageEventHandler(actor, event) {
13841384
return Clutter.EVENT_STOP;
13851385
}
13861386

1387-
// If the modifier was used as part of a shortcut (a non-modifier key was
1388-
// pressed while it was held), consume its release so it isn't mistaken for
1389-
// a bare tap. A clean tap falls through to consumers like the run dialog's
1390-
// key-release-event handler.
1391-
if (_nonModifierPressedSinceModifier)
1387+
// If the modifier was used as part of a shortcut (a keybinding was invoked
1388+
// here while it was held), consume its release so it isn't mistaken for a
1389+
// bare tap.
1390+
if (_shortcutInvokedSinceModifier)
13921391
return Clutter.EVENT_STOP;
13931392
}
13941393

@@ -1405,7 +1404,7 @@ function _findModal(actor) {
14051404

14061405
function _completeModalSetup(actor, mode, onDismiss) {
14071406
_modifierOnlyAction = 0;
1408-
_nonModifierPressedSinceModifier = false;
1407+
_shortcutInvokedSinceModifier = false;
14091408

14101409
if (modalCount == 0)
14111410
Meta.disable_unredirect_for_display(global.display);

0 commit comments

Comments
 (0)