Holding Caps Lock key toggles Caps Lock continuously
Reported by
p...@earth2me.com,
Mar 12 2017
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; CrOS x86_64 9000.91.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.110 Safari/537.36 Platform: 9000.91.0 (Official Build) stable-channel gnawty Steps to reproduce the problem: 1. Map any key to Caps Lock in Settings 2. Hold down the Caps Lock key What is the expected behavior? - Caps Lock toggles on key down - Nothing happens on key press (while the key is held) - Nothing happens on key up What went wrong? - Caps Lock toggles on key down (seemingly) - Caps Lock toggles on key press (repeats rapidly) - Nothing happens on key up Did this work before? N/A Chrome version: 56.0.2924.110 Channel: stable OS Version: 9000.91.0 Flash Version: Shockwave Flash 24.0 r0 This is a pretty minor issue, but it's a bit unintuitive and serves no purpose. It'd be pretty awesome if holding Caps Lock allowed it to act as a Search key.
,
Mar 17 2017
,
Mar 17 2017
weidongg, here's another shortcut-related bug. please take a look. Thanks.
,
Mar 18 2017
The logic is handled by RewriteModifierKeys (https://cs.chromium.org/chromium/src/ui/chromeos/events/event_rewriter_chromeos.cc?l=808-824). The input parameter key_event only includes two types of key event: ET_KEY_PRESSED and ET_KEY_RELEASED. IMO, use a static variable to record the previous key_evennt: Press->Press: ignore Press->Release: ignore Null/Release->Press: Toggle CAPS_LOCK
,
Mar 20 2017
Try checking for the flag EF_IS_REPEAT [1]. What do you get? [1]: https://cs.chromium.org/chromium/src/ui/events/event_constants.h?l=124
,
Mar 21 2017
This flag is set at the constructor of KeyEvent (https://cs.chromium.org/chromium/src/ui/events/event.cc?l=1138).And it's decided by IsRepeated (https://cs.chromium.org/chromium/src/ui/events/event.cc?l=1098) which always returns false when Caps Lock is held down.
,
Mar 22 2017
,
Mar 22 2017
I don't think ignoring keys with REPEAT turned on is the right fix. For example, if you keep holding down the volume up/down keys, you should expect the repeat-keys to actually continue to change the volume level, right?
,
Mar 23 2017
When a key is pressed, KeyboardEvdev::DispatchKey will receive the key along with a 'repeat[1]'. Why KeyEvent[2] does not use this repeat in its constructor, rather than use its own IsRepeat? [1] https://cs.chromium.org/chromium/src/ui/events/ozone/evdev/keyboard_evdev.cc?l=225&gsn=repeat [2] https://cs.chromium.org/chromium/src/ui/events/ozone/evdev/keyboard_evdev.cc?gsn=modifier_flags_&l=242 [3] https://cs.chromium.org/chromium/src/ui/events/event.cc?gsn=KeyEvent&l=1098
,
Mar 23 2017
Initial State: Caps Lock is disabled Action: Hold down ESC which is remapped to Caps Lock Flow: 1. KeyBoardEvdev[1] use received ESC key and modifier_flags_(a static variable) to create KeyEvent (flags_=modifier_flags_, key_code_=VKEY_ESCAPE). 2. In KeyEvent constructor, It check if itself is repeated. If the flags_ of current KeyEvent is the same as previous one, then EF_IS_REPEAT bit of flags_ is set. 3. KeyEvent is dispatched to RewriteKeyEvent which discards the KeyEvent if its EF_IS_REPEAT bit of flags_ is set. 4. If KeyEvent is not discarded, RewriteKeyEvent sends KeyEvent to RewriteModifierKeys which rewrite ESC key to Caps Lock key. 5. RewriteModifierKeys toggles Caps Lock and toggles modifier_flags_ Problem: 1. When I hold down ESC, KeyBoardEvdev keeps creating KeyEvent. 2. Before the first KeyEvent, modifier_flags_ is 0x0 which means the first KeyEvent’s flags_ is 0x0. But there’s no previous KeyEvent, so EF_IS_REPEAT is not set. So RewriteKeyEvent doesn't discard the KeyEvent. 3. RewriteModifierKeys turns on Caps Lock and set modifier_flags_ to 0x100 4. The second KeyEvent’s flag_ is set to 0x100 in the constructor. It’s different from the first KeyEvent’s flag_ which is 0x0, so EF_IS_REPEAT is not set. 5. RewriteModifierKeys turns off Caps Lock and set modifier_flags_ to 0x0 6. The third KeyEvent’s flag_ is set to 0x0 in the constructor. It’s different from the second KeyEvent’s flag_ which is 0x100, so EF_IS_REPEAT is not set. 7. RewriteModifierKeys turns on Caps Lock and set modifier_flags_ to 0x100 …… So on so forth, that’s why Caps Lock keeps toggling. [1]https://cs.chromium.org/chromium/src/ui/events/ozone/evdev/keyboard_evdev.cc?gsn=modifier_flags_&l=223
,
Mar 24 2017
Besides Caps Lock, Num Lock and Scroll Lock also has this problem. IMO, potential solutions include: 1. Treat Caps Lock/ Num Lock/Scroll Lock as special case in IsRepeat function of KeyEvent, but the problem is that Caps Lock is possibly remapped. The remapping occurs at RewriteModifierKeys which happens after IsRepeat, so IsRepeat doesn't recognize Caps Lock key. 2. Self-maintain a flag to record the previous Caps Lock press in RewriteModifierKeys, like the first patch of https://codereview.chromium.org/2763483002/#ps1. 3. Or KeyEvent maintains and expose a last_key_event, so that RewriteModifierKeys can use it to track the previous key event. What do you think @sadrul?
,
Apr 13 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/863b0d4dbe21b493e2dfa59c6d52e02a1af73565 commit 863b0d4dbe21b493e2dfa59c6d52e02a1af73565 Author: weidongg <weidongg@chromium.org> Date: Thu Apr 13 19:23:10 2017 Fix Caps Lock bug Move the handling of Caps Lock key event to accelerator controller and trigger toggling on key-release. Remove the handling code of Caps Lock for X11 from InputMethodChromeOS::DispatchKeyEvent, because it is now handled only in accelerator controller. This should also work for both x11+ozone environment and x11 environment on desktop. BUG= 700705 Review-Url: https://codereview.chromium.org/2763483002 Cr-Commit-Position: refs/heads/master@{#464499} [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/ash/accelerators/accelerator_controller.cc [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/ash/accelerators/accelerator_controller_unittest.cc [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/ash/accelerators/accelerator_table.cc [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/ash/accelerators/accelerator_table_unittest.cc [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/chrome/browser/chromeos/events/event_rewriter_unittest.cc [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/ui/base/ime/input_method_chromeos.cc [modify] https://crrev.com/863b0d4dbe21b493e2dfa59c6d52e02a1af73565/ui/chromeos/events/event_rewriter_chromeos.cc
,
Apr 13 2017
,
May 9 2017
9534.0.0, 60.0.3092.0 |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by rookrishna@chromium.org
, Mar 14 2017Status: Untriaged (was: Unconfirmed)