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

Qt does not handle the ACTION_POINTER_UP event on android

    XMLWordPrintable

Details

    • Android
    • 3ee57b838 (dev), 8e0bf6e05 (dev), c17a1432c (6.6), bd188231a (6.5)
    • Foundation Sprint 91, Foundation Sprint 92

    Description

      If the pen is tap up from the touch screen when there are still have a finger on it , android os will send the ACTION_POINTER_UP event to main activity but not a ACTION_UP event.But the tablet event processed code does not cover this case.So that we will lost the Tablet Release Event .

      // Issue occured code block

       static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action,
              jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure)
          {
              QPointF globalPosF(x, y);
              QPoint globalPos((int)x, (int)y);
              QWindow *tlw = topLevelWindowAt(globalPos);
              QPointF localPos = tlw ? (globalPosF - tlw->position()) : globalPosF;
              // when action == ACTION_UP (1) it's a release; otherwise we say which button is pressed
              Qt::MouseButtons buttons = Qt::NoButton;
      
      
      
              switch (action) {
              case 1:     // ACTION_UP
              case 212:   // stylus release while side-button held on Galaxy Note 4
                  buttons = Qt::NoButton;
                  break;
              default:    // action is press or drag
                  if (buttonState == 0)
                      buttons = Qt::LeftButton;
                  else // 2 means RightButton
                      buttons = Qt::MouseButtons(buttonState);
                  break;
              }
      
              QWindowSystemInterface::handleTabletEvent(tlw, ulong(time),
                  localPos, globalPosF, QTabletEvent::Stylus, pointerType,
                  buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier);
      
          }
      

      One way to fix it
      // add this line into QtNative.java at line 616.

       int actionType = event.getAction();
        if( actionType  == 6 ) Hanlde the ACTION_POINTER_UP
         {
            actionType  = 1;//Mark the ACTION_POINTER_UP as ACTION_UP 
         }
       tabletEvent(id, event.getDeviceId(), event.getEventTime(), actionType , pointerType,
                      event.getButtonState(), event.getX(), event.getY(), event.getPressure());
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-86297
          # Subject Branch Project Status CR V

          Activity

            People

              vuokko Juha Vuolle
              alex-m Alex Mao
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes