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

tuiotouch: tokens no longer tracked after cursor pressed

XMLWordPrintable

    • macOS

      The cursor fseq message seems to break the tracking of already placed tokens, only if a new token is added the already placed tokens will be tracked again.

      This was tested against the TUIO simulator and sending messages per hand.

      I think that the issue is not directly in the tuiotouch plugin, but rather somewhere in the event handling of the already placed tokens, as these tokens will be delivered to QWindowSystemInterface::handleTouchEvent(...) when moved in the simulator, but don't arrive in the MultiPointTouchArea where they are supposed to be further processed.
      A hacky workaround would be to also handle all tokens whenever a cursor fseq message is received, but this seems to bring downsides of its own (at least in my application), i.e.

      void QTuioHandler::process2DCurFseq(const QOscMessage &message)
      {
          Q_UNUSED(message); // TODO: do we need to do anything with the frame id?
       
          QWindow *win = QGuiApplication::focusWindow();
          if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery)
                win = QGuiApplication::topLevelWindows().at(0);
       
          if (!win)
              return;
       
          QList<QWindowSystemInterface::TouchPoint> tpl;
          tpl.reserve(m_activeCursors.size() + m_deadCursors.size());
       
          for (const QTuioCursor &tc : std::as_const(m_activeCursors)) {
              QWindowSystemInterface::TouchPoint tp = cursorToTouchPoint(tc, win);
              tpl.append(tp);
          }
       
          for (const QTuioCursor &tc : std::as_const(m_deadCursors)) {
              QWindowSystemInterface::TouchPoint tp = cursorToTouchPoint(tc, win);
              tp.state = QEventPoint::State::Released;
              tpl.append(tp);
          }
       
          /// NEW ----------------------------------------------------------------------------------------
          for (const QTuioToken & t : std::as_const(m_activeTokens)) {
              QWindowSystemInterface::TouchPoint tp = tokenToTouchPoint(t, win);
              tpl.append(tp);
          }
       
          for (const QTuioToken & t : std::as_const(m_deadTokens)) {
              QWindowSystemInterface::TouchPoint tp = tokenToTouchPoint(t, win);
              tp.state = QEventPoint::State::Released;
              tp.velocity = QVector2D();
              tpl.append(tp);
          }
          /// --------------------------------------------------------------------------------------------
       
          QWindowSystemInterface::handleTouchEvent(win, m_device, tpl);
       
          m_deadCursors.clear();
      } 

      qtuiohandler.cpp seems to be working as intended, I had a hard time following the path from received messages to the MPTAs, anyone has an idea where to look further?

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

            srutledg Shawn Rutledge
            jirauser72357 user-ecd14 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes