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

Key injection fails in QML test

    XMLWordPrintable

Details

    • Linux/Wayland, Linux/X11
    • fee9011f8 (dev), b8eff8bab (6.6), 31264d90f (6.5)

    Description

      The keyinput QML auto test fails in qtapplicationmanager in multi-process mode when a debug build is used with ASSERT: "nativeScanCode >= offset" in file qtwayland/src/compositor/compositor_api/qwaylandkeyboard.cpp (the test has been disabled for now). The problem was introduced with https://codereview.qt-project.org/c/qt/qtbase/+/454426. With this patch the injected key events by the TestCase type take a different code path (through QWindowSystemInterfacePrivate::eventHandler->sendEvent instead of QGuiApplicationPrivate::processWindowSystemEvent directly). Hence the key events don't got through QWaylandSeat::sendFullKeyEvent any more that would call keyToScanCode which calculates a proper scanCode.

      This would fix the problem:

      --- a/src/compositor/compositor_api/qwaylandcompositor.cpp
      +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
      @@ -101,6 +101,8 @@ public:
               ke->nativeScanCode += offset;
       #endif
               uint32_t code = ke->nativeScanCode;
      +        if (code == 0)
      +            code = seat->keyboard()->keyToScanCode(ke->key);
               bool isDown = ke->keyType == QEvent::KeyPress;
       
       #if QT_CONFIG(xkbcommon)
      

      The issue can be reproduced more easily with qmltestrunner and the attached test (though might hang on Wayland desktops as a subsequent problem). The question is, how this should properly be solved.

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            bweimer Bernd Weimer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes