summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/libinput
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/input/libinput')
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp46
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler_p.h41
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard.cpp42
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard_p.h40
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp56
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer_p.h41
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp84
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch_p.h41
8 files changed, 79 insertions, 312 deletions
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 95dfb46d16..ef45533f1a 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputhandler_p.h"
#include "qlibinputpointer_p.h"
@@ -115,7 +79,7 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
m_touch.reset(new QLibInputTouch);
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
- connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
+ connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, this, [this](const QPoint &pos) {
m_pointer->setPos(pos);
});
@@ -208,7 +172,11 @@ void QLibInputHandler::processEvent(libinput_event *ev)
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
m_pointer->processAbsMotion(libinput_event_get_pointer_event(ev));
break;
+#if QT_CONFIG(libinput_hires_wheel_support)
+ case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL:
+#else
case LIBINPUT_EVENT_POINTER_AXIS:
+#endif
m_pointer->processAxis(libinput_event_get_pointer_event(ev));
break;
case LIBINPUT_EVENT_KEYBOARD_KEY:
diff --git a/src/platformsupport/input/libinput/qlibinputhandler_p.h b/src/platformsupport/input/libinput/qlibinputhandler_p.h
index ac7a267a4d..ca7926bae6 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler_p.h
+++ b/src/platformsupport/input/libinput/qlibinputhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTHANDLER_P_H
#define QLIBINPUTHANDLER_P_H
@@ -43,6 +7,7 @@
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
#include <QtCore/QMap>
+#include <QtCore/private/qglobal_p.h>
//
// W A R N I N G
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index aebd18a1a7..25939cd510 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputkeyboard_p.h"
#include <QtCore/QLoggingCategory>
@@ -115,7 +79,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
xkb_state_update_key(m_state, keycode, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
- Qt::KeyboardModifiers modifiersAfterStateChange = QXkbCommon::modifiers(m_state);
+ Qt::KeyboardModifiers modifiersAfterStateChange = QXkbCommon::modifiers(m_state, sym);
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(modifiersAfterStateChange);
QWindowSystemInterface::handleExtendedKeyEvent(nullptr,
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
index 7521902e02..fecbca34aa 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTKEYBOARD_P_H
#define QLIBINPUTKEYBOARD_P_H
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index db9e81b5df..03351397b5 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputpointer_p.h"
#include <libinput.h>
@@ -133,16 +97,28 @@ void QLibInputPointer::processAxis(libinput_event_pointer *e)
angleDelta.setX(qRound(value));
#else
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
+#if QT_CONFIG(libinput_hires_wheel_support)
+ value = libinput_event_pointer_get_scroll_value_v120(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+#else
value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+#endif
angleDelta.setY(qRound(value));
}
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
+#if QT_CONFIG(libinput_hires_wheel_support)
+ value = libinput_event_pointer_get_scroll_value_v120(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+#else
value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+#endif
angleDelta.setX(qRound(value));
}
#endif
- const int factor = 8;
- angleDelta *= -factor;
+#if QT_CONFIG(libinput_hires_wheel_support)
+ const int factor = -1;
+#else
+ const int factor = -8;
+#endif
+ angleDelta *= factor;
Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, QPoint(), angleDelta, mods);
}
diff --git a/src/platformsupport/input/libinput/qlibinputpointer_p.h b/src/platformsupport/input/libinput/qlibinputpointer_p.h
index 55d4a5f919..f1709eaa34 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer_p.h
+++ b/src/platformsupport/input/libinput/qlibinputpointer_p.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTPOINTER_P_H
#define QLIBINPUTPOINTER_P_H
#include <QtCore/QPoint>
+#include <QtCore/private/qglobal_p.h>
//
// W A R N I N G
diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index ed531f5773..e3a483dc84 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputtouch_p.h"
#include "qoutputmapping_p.h"
@@ -50,12 +14,13 @@
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcLibInput)
+Q_LOGGING_CATEGORY(qLcLibInputEvents, "qt.qpa.input.events")
QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t slot)
{
const int id = qMax(0, slot);
- for (int i = 0; i < m_points.count(); ++i)
+ for (int i = 0; i < m_points.size(); ++i)
if (m_points.at(i).id == id)
return &m_points[i];
@@ -84,7 +49,7 @@ QRect QLibInputTouch::screenGeometry(DeviceState *state)
if (m_screen)
screen = m_screen;
}
- return QHighDpi::toNativePixels(screen->geometry(), screen);
+ return screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect();
}
QPointF QLibInputTouch::getPos(libinput_event_touch *e)
@@ -96,6 +61,33 @@ QPointF QLibInputTouch::getPos(libinput_event_touch *e)
return geom.topLeft() + QPointF(x, y);
}
+static void setMatrix(libinput_device *dev)
+{
+ if (libinput_device_config_calibration_has_matrix(dev)) {
+ QByteArray env = qgetenv("QT_QPA_LIBINPUT_TOUCH_MATRIX");
+ env = env.simplified();
+ if (env.size()) {
+ float matrix[6];
+ QList<QByteArray> list = env.split(' ');
+ if (list.length() != 6) {
+ qCWarning(qLcLibInput, "matrix length %lld wrong, should be 6", list.length());
+ return;
+ }
+ for (int i = 0; i < 6; i++) {
+ bool ok = true;
+ matrix[i] = list[i].toFloat(&ok);
+ if (!ok) {
+ qCWarning(qLcLibInput, "Invalid matrix entry %d %s ", i, list[i].constData());
+ return;
+ }
+ }
+ if (libinput_device_config_calibration_set_matrix(dev, matrix) != LIBINPUT_CONFIG_STATUS_SUCCESS)
+ qCWarning(qLcLibInput, "Failed to set libinput calibration matrix ");
+ }
+ } else {
+ qCWarning(qLcLibInput, "Touch device doesn't support matrix");
+ }
+}
void QLibInputTouch::registerDevice(libinput_device *dev)
{
struct udev_device *udev_device;
@@ -127,6 +119,7 @@ void QLibInputTouch::registerDevice(libinput_device *dev)
if (!geom.isNull())
devPriv->setAvailableVirtualGeometry(geom);
QWindowSystemInterface::registerInputDevice(td);
+ setMatrix(dev);
}
void QLibInputTouch::unregisterDevice(libinput_device *dev)
@@ -149,6 +142,7 @@ void QLibInputTouch::processTouchDown(libinput_event_touch *e)
newTp.area = QRect(0, 0, 8, 8);
newTp.area.moveCenter(getPos(e));
state->m_points.append(newTp);
+ qCDebug(qLcLibInputEvents) << "touch down" << newTp;
}
}
@@ -168,6 +162,7 @@ void QLibInputTouch::processTouchMotion(libinput_event_touch *e)
// Handle this by compressing and keeping the Pressed state until the 'frame'.
if (tp->state != QEventPoint::State::Pressed && tp->state != QEventPoint::State::Released)
tp->state = tmpState;
+ qCDebug(qLcLibInputEvents) << "touch move" << tp;
} else {
qWarning("Inconsistent touch state (got 'motion' without 'down')");
}
@@ -182,10 +177,13 @@ void QLibInputTouch::processTouchUp(libinput_event_touch *e)
tp->state = QEventPoint::State::Released;
// There may not be a Frame event after the last Up. Work this around.
QEventPoint::States s;
- for (int i = 0; i < state->m_points.count(); ++i)
+ for (int i = 0; i < state->m_points.size(); ++i)
s |= state->m_points.at(i).state;
+ qCDebug(qLcLibInputEvents) << "touch up" << s << tp;
if (s == QEventPoint::State::Released)
processTouchFrame(e);
+ else
+ qCDebug(qLcLibInputEvents, "waiting for all points to be released");
} else {
qWarning("Inconsistent touch state (got 'up' without 'down')");
}
@@ -194,6 +192,7 @@ void QLibInputTouch::processTouchUp(libinput_event_touch *e)
void QLibInputTouch::processTouchCancel(libinput_event_touch *e)
{
DeviceState *state = deviceState(e);
+ qCDebug(qLcLibInputEvents) << "touch cancel" << state->m_points;
if (state->m_touchDevice)
QWindowSystemInterface::handleTouchCancelEvent(nullptr, state->m_touchDevice, QGuiApplication::keyboardModifiers());
else
@@ -207,13 +206,14 @@ void QLibInputTouch::processTouchFrame(libinput_event_touch *e)
qWarning("TouchFrame without registered device");
return;
}
+ qCDebug(qLcLibInputEvents) << "touch frame" << state->m_points;
if (state->m_points.isEmpty())
return;
QWindowSystemInterface::handleTouchEvent(nullptr, state->m_touchDevice, state->m_points,
QGuiApplication::keyboardModifiers());
- for (int i = 0; i < state->m_points.count(); ++i) {
+ for (int i = 0; i < state->m_points.size(); ++i) {
QWindowSystemInterface::TouchPoint &tp(state->m_points[i]);
if (tp.state == QEventPoint::State::Released)
state->m_points.removeAt(i--);
diff --git a/src/platformsupport/input/libinput/qlibinputtouch_p.h b/src/platformsupport/input/libinput/qlibinputtouch_p.h
index 67c20b9af6..174795b140 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch_p.h
+++ b/src/platformsupport/input/libinput/qlibinputtouch_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTTOUCH_P_H
#define QLIBINPUTTOUCH_P_H
@@ -44,6 +8,7 @@
#include <QtCore/QList>
#include <QtCore/QPointer>
#include <qpa/qwindowsysteminterface.h>
+#include <private/qglobal_p.h>
//
// W A R N I N G