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

Using scanner input IRcode will result in an error when second character is uppercase

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Fixed
    • Affects Version/s: 5.15, 6.2
    • Fix Version/s: 6.4.0 RC1, 6.5
    • Component/s: QPA: X11/XCB
    • Labels:
      None
    • Environment:
      ubuntu 19.04 deepin 20
      xorg-server 1.20.4 libxkbcommon 0.8.2-1
    • Platform/s:
      Linux/X11
    • Commits:
      ef94aeef649f832bb201cb752407ce3ea5e66562(dev) 379198828c (qt/qtbase/6.4) 379198828c (qt/tqtc-qtbase/6.4)

      Description

      I have a scanner, When using a Qt program to input, if the second character is uppercase, the first lowercase character will be converted to a character with shift during the first scan.

      On my computer, using xdotool I can also reproduce this phenomenon. see error.mp4 and xdotool.sh

      the video show the reproduce step:

      1. open a Qt program and type some character to make sure the keyboard is master device;
      2. then run xdotool.sh and active Qt window, select QLineEdit all text, wait xdotool input;
      3. you will see the first character is error.

      note:

      a. reproduce this bug to make sure the second character is uppercase;

      b. xdotool sometime maybe can't reproduce,but scanner always exist.

       

      Process analysis:

      1. when use xdotool or scanner input, first of all, xorg-server will call CopyKeyClass and send XkbSendNewKeyboardNotify event to Qt program;
      2. when Qt program recvice this event, Qt will call updateKeymap, see Qt code: qtbase/src/plugins/platforms/xcb/qxcbkeyboard.cpp updateKeymap function;
      3. in the updateKeymap function, Qt will call libxkbcommon to reset xkbState, and this time, libxkbcommon will return Qt a new xkbState, but the value base_mods of xkbState's is not right;

      note:

      If you switch input between the keyboard and the scanner, this bug will reappear immediately

       

      My guess:

      1. When xorg-server send XkbSendNewKeyboardNotify event, Qt and libxkbcommon communicate will spend some time;
      2. If Qt didn't initialized yet, and shift if pressed, and this time xorg-server will give libxkbcommon a error base_mods value of xkbState's.

       

      note:

      a. If you increase the scanner input delay between characters, the probability of recurrence will decrease;

      b. If xorg-server not send XkbSendNewKeyboardNotify event, this bug don't reproduce;

      c. if xorg-server send XkbSendNewKeyboardNotify event, but Qt do nothing, this bug don't reproduce too;

        Attachments

        1. 1027.zip
          45 kB
        2. error.mp4
          4.12 MB
        3. ircode.png
          ircode.png
          4 kB
        4. xdotool.sh
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            liaqi Liang Qi
            Reporter:
            kingderzhang kingderzhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: