Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-134107

Qt WebEngine NumLock detection broken using KeyboardDriver::Xkb

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.4, 6.9.1, 6.10.0 FF
    • 6.8.2
    • WebEngine
    • None
    • Linux/Wayland, Linux/X11
    • e4785c85d (dev), 885c26379 (6.9), 2b231fe3f (6.8)

    Description

      Commit 2dc642d3f97bf457d7cf57265a35eb8b1bd83a8d introduced support for CapsLock, NumLock, and ScrollLock on the main platforms to solve https://bugreports.qt.io/browse/QTBUG-89001

       

      However the implementation used for the Xkb keyboard driver (xcb and wayland platforms) is incorrect:

      if (keyboardDriver() == KeyboardDriver::Xkb) {
              if (nativeModifiers & 0x42) /* Caps_Lock */
                  result |= WebInputEvent::kCapsLockOn;
              if (nativeModifiers & 0x4d) /* Num_Lock */
                  result |= WebInputEvent::kNumLockOn;

      (web_event_factory.cpp:lockKeyModifiers())

      0x42 and 0x4d are respectively the keycodes of the CapsLock and NumLock keys, not a modifier bit. By luck, the CapsLock state bit seems to be 0x02, and 0x40 doesn't seems to match a common modifier. However the NumLock state bit seems to be 0x10, and even worse, 0x4d matches the state bits of Shift (0x01), Control (0x04), and Alt (0x08).

       

      This can be reproduced for example using qutebrowser on https://w3c.github.io/uievents/tools/key-event-viewer.html and looking at the "getModifierState" field: pressing NumLock will have no effect on this column, however, pressing one of Shift, Control, or Alt, will toggle the "NumLock" state on key release.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pvarga Peter Varga
            lkc-rc Lara Kermarec
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes