Skip to content

Commit 7190db1

Browse files
committed
main.js: Don't drop key-release events in the captured-event handler
if there's no matching keybinding action. This is needed for listeners to key-release-event, like AppSwitcher, to activate the selected window.
1 parent bd770e1 commit 7190db1

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

js/ui/main.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,9 +1345,7 @@ function _stageEventHandler(actor, event) {
13451345
return false;
13461346
}
13471347

1348-
// A non-modifier key was pressed while a modifier was held.
1349-
// Use -1 to indicate the modifier release should be consumed.
1350-
_modifierOnlyAction = -1;
1348+
_modifierOnlyAction = 0;
13511349

13521350
let action = global.display.get_keybinding_action(keyCode, modifierState);
13531351
if (action > 0) {
@@ -1361,20 +1359,12 @@ function _stageEventHandler(actor, event) {
13611359
return false;
13621360
}
13631361

1364-
// Release event - activate the single-key keybinding, or eat the release if
1365-
// a multi-key combo was used.
1366-
if (_isModifierKeyval(event.get_key_symbol())) {
1367-
if (_modifierOnlyAction > 0) {
1368-
let action = _modifierOnlyAction;
1369-
_modifierOnlyAction = 0;
1370-
keybindingManager.invoke_keybinding_action_by_id(action);
1371-
return true;
1372-
}
1373-
1374-
if (_modifierOnlyAction === -1) {
1375-
_modifierOnlyAction = 0;
1376-
return true;
1377-
}
1362+
// Release event - activate the single-key modifier keybinding if one was stored.
1363+
if (_isModifierKeyval(event.get_key_symbol()) && _modifierOnlyAction > 0) {
1364+
let action = _modifierOnlyAction;
1365+
_modifierOnlyAction = 0;
1366+
keybindingManager.invoke_keybinding_action_by_id(action);
1367+
return true;
13781368
}
13791369

13801370
return false;

0 commit comments

Comments
 (0)