Warning, /graphics/krita/3rdparty/ext_qt/0029-Android-Handle-the-ACTION_CANCEL-Event-from-Android.patch is written in an unsupported language. File is not indexed.

0001 From 0ce217bf9ff4a2d7a95d607cdd5dc2e974d5a796 Mon Sep 17 00:00:00 2001
0002 From: Sharaf Zaman <sharafzaz121@gmail.com>
0003 Date: Tue, 10 Nov 2020 18:24:32 +0000
0004 Subject: [PATCH 29/46] Android: Handle the ACTION_CANCEL Event from Android
0005 
0006 Prior to this actions from weren't handled explicity, this made events
0007 after the ACTION_CANCEL was sent to continue from previous state, rather
0008 than starting over.
0009 ---
0010  .../src/org/qtproject/qt5/android/QtNative.java    | 14 +-------------
0011  src/plugins/platforms/android/androidjniinput.cpp  | 14 ++++++++++++--
0012  2 files changed, 13 insertions(+), 15 deletions(-)
0013 
0014 diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
0015 index 287502a645..d76b7c9008 100644
0016 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
0017 +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
0018 @@ -692,19 +692,7 @@ public class QtNative
0019                               event.getOrientation(i),
0020                               event.getPressure(i));
0021              }
0022 -
0023 -            switch (event.getAction()) {
0024 -                case MotionEvent.ACTION_DOWN:
0025 -                    touchEnd(id, 0);
0026 -                    break;
0027 -
0028 -                case MotionEvent.ACTION_UP:
0029 -                    touchEnd(id, 2);
0030 -                    break;
0031 -
0032 -                default:
0033 -                    touchEnd(id, 1);
0034 -            }
0035 +            touchEnd(id, event.getAction());
0036          }
0037      }
0038  
0039 diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
0040 index 83553deacd..870b22e15e 100644
0041 --- a/src/plugins/platforms/android/androidjniinput.cpp
0042 +++ b/src/plugins/platforms/android/androidjniinput.cpp
0043 @@ -38,6 +38,8 @@
0044  **
0045  ****************************************************************************/
0046  
0047 +#include <android/input.h>
0048 +
0049  #include <QtGui/qtguiglobal.h>
0050  
0051  #include "androidjniinput.h"
0052 @@ -303,7 +305,7 @@ namespace QtAndroidInput
0053          }
0054      }
0055  
0056 -    static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint /*action*/)
0057 +    static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint action)
0058      {
0059          if (m_touchPoints.isEmpty())
0060              return;
0061 @@ -326,7 +328,15 @@ namespace QtAndroidInput
0062          }
0063  
0064          QWindow *window = QtAndroid::topLevelWindowAt(m_touchPoints.at(0).area.center().toPoint());
0065 -        QWindowSystemInterface::handleTouchEvent(window, touchDevice, m_touchPoints);
0066 +
0067 +        switch (action) {
0068 +        case AMOTION_EVENT_ACTION_CANCEL:
0069 +            QWindowSystemInterface::handleTouchCancelEvent(window, touchDevice);
0070 +            break;
0071 +        default:
0072 +            QWindowSystemInterface::handleTouchEvent(window, touchDevice, m_touchPoints);
0073 +            break;
0074 +        }
0075      }
0076  
0077      static bool isTabletEventSupported(JNIEnv */*env*/, jobject /*thiz*/)
0078 -- 
0079 2.33.0
0080