diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-19 11:22:54 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-28 13:10:33 +0200 |
commit | 9c88f97492959025f7433c9a379b474095efc0dd (patch) | |
tree | d4168230e7ca4d8e4322b20cc925113e7c729e14 /src/compositor/wayland_wrapper | |
parent | b4a796f3c15f4fc47957aa2f3dd2a87c45e151fc (diff) |
Move qwltouch_p.h into qwaylandtouch_p.h
Change-Id: Id93b3d70fa97307d905300dc4fc842bcf5ce5f1d
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r-- | src/compositor/wayland_wrapper/qwltouch.cpp | 159 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwltouch_p.h | 108 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/wayland_wrapper.pri | 2 |
3 files changed, 0 insertions, 269 deletions
diff --git a/src/compositor/wayland_wrapper/qwltouch.cpp b/src/compositor/wayland_wrapper/qwltouch.cpp deleted file mode 100644 index 226f68b6a..000000000 --- a/src/compositor/wayland_wrapper/qwltouch.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwltouch_p.h" - -#include <QtCompositor/QWaylandCompositor> -#include "qwaylandview.h" -#include "qwlqttouch_p.h" - -QT_BEGIN_NAMESPACE - -QWaylandTouchPrivate::QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDevice *seat) - : wl_touch() - , m_seat(seat) - , m_focusResource() - , m_defaultGrab() - , m_grab(&m_defaultGrab) -{ - m_grab->touch = touch; -} - -void QWaylandTouchPrivate::startGrab(QWaylandTouchGrabber *grab) -{ - Q_Q(QWaylandTouch); - m_grab = grab; - grab->touch = q; -} - -void QWaylandTouchPrivate::endGrab() -{ - m_grab = &m_defaultGrab; -} - -void QWaylandTouchPrivate::resetFocusState() -{ - m_focusDestroyListener.reset(); - m_focusResource = 0; -} - -void QWaylandTouchPrivate::touch_destroy_resource(Resource *resource) -{ - if (m_focusResource == resource) { - resetFocusState(); - } -} - -void QWaylandTouchPrivate::touch_release(Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -void QWaylandTouchPrivate::sendCancel() -{ - if (m_focusResource) - send_cancel(m_focusResource->handle); -} - -void QWaylandTouchPrivate::sendFrame() -{ - if (m_focusResource) - send_frame(m_focusResource->handle); -} - -void QWaylandTouchPrivate::sendTouchPoint(int id, const QPointF &point, Qt::TouchPointState state) -{ - switch (state) { - case Qt::TouchPointPressed: - sendDown(id, point); - break; - case Qt::TouchPointMoved: - sendMotion(id, point); - break; - case Qt::TouchPointReleased: - sendUp(id); - break; - case Qt::TouchPointStationary: - // stationary points are not sent through wayland, the client must cache them - break; - default: - break; - } -} - -void QWaylandTouchPrivate::sendDown(int touch_id, const QPointF &position) -{ - m_grab->down(compositor()->currentTimeMsecs(), touch_id, position); -} - -void QWaylandTouchPrivate::sendMotion(int touch_id, const QPointF &position) -{ - m_grab->motion(compositor()->currentTimeMsecs(), touch_id, position); -} - -void QWaylandTouchPrivate::sendUp(int touch_id) -{ - m_grab->up(compositor()->currentTimeMsecs(), touch_id); -} - -void QWaylandTouchPrivate::sendFullTouchEvent(QTouchEvent *event) -{ - if (event->type() == QEvent::TouchCancel) { - sendCancel(); - return; - } - - QtWayland::TouchExtensionGlobal *ext = QtWayland::TouchExtensionGlobal::findIn(compositor()); - if (ext && ext->postTouchEvent(event, m_seat->mouseFocus())) - return; - - const QList<QTouchEvent::TouchPoint> points = event->touchPoints(); - if (points.isEmpty()) - return; - - const int pointCount = points.count(); - QPointF pos = m_seat->mouseFocus()->requestedPosition(); - for (int i = 0; i < pointCount; ++i) { - const QTouchEvent::TouchPoint &tp(points.at(i)); - // Convert the local pos in the compositor window to surface-relative. - QPointF p = tp.pos() - pos; - sendTouchPoint(tp.id(), p, tp.state()); - } - sendFrame(); -} - -QT_END_NAMESPACE diff --git a/src/compositor/wayland_wrapper/qwltouch_p.h b/src/compositor/wayland_wrapper/qwltouch_p.h deleted file mode 100644 index c970d1c87..000000000 --- a/src/compositor/wayland_wrapper/qwltouch_p.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTWAYLAND_QWLTOUCH_P_H -#define QTWAYLAND_QWLTOUCH_P_H - -#include <QtCompositor/qwaylandexport.h> -#include <QtCompositor/QWaylandDestroyListener> -#include <QtCompositor/QWaylandTouch> -#include <QtCompositor/QWaylandInputDevice> -#include <QtCompositor/QWaylandClient> -#include <QtCompositor/QWaylandView> - -#include <QtCore/QPoint> -#include <QtCore/private/qobject_p.h> - -#include <QtCompositor/private/qwayland-server-wayland.h> - -QT_BEGIN_NAMESPACE - -class QWaylandView; -class QWaylandCompositor; - -class Q_COMPOSITOR_EXPORT QWaylandTouchPrivate : public QObjectPrivate, public QtWaylandServer::wl_touch -{ - Q_DECLARE_PUBLIC(QWaylandTouch) -public: - explicit QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDevice *seat); - - QWaylandCompositor *compositor() const { return m_seat->compositor(); } - - void startGrab(QWaylandTouchGrabber *grab); - void endGrab(); - - void sendCancel(); - void sendFrame(); - - void sendTouchPoint(int id, const QPointF &point, Qt::TouchPointState state); - void sendDown(int touch_id, const QPointF &position); - void sendMotion(int touch_id, const QPointF &position); - void sendUp(int touch_id); - - void sendFullTouchEvent(QTouchEvent *event); - - Resource *focusResource() const { return m_focusResource; } - - void setFocusResource() - { - if (m_focusResource) - return; - - QWaylandView *mouseFocus = m_seat->mouseFocus(); - if (!mouseFocus || !mouseFocus->surface()) - return; - - m_focusResource = resourceMap().value(mouseFocus->surface()->waylandClient()); - } -private: - void resetFocusState(); - void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - void touch_release(Resource *resource) Q_DECL_OVERRIDE; - - QWaylandInputDevice *m_seat; - - Resource *m_focusResource; - QWaylandDestroyListener m_focusDestroyListener; - - QWaylandDefaultTouchGrabber m_defaultGrab; - QWaylandTouchGrabber *m_grab; -}; - -QT_END_NAMESPACE - -#endif // QTWAYLAND_QWLTOUCH_P_H diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri index 6355bbb2c..0de06a94a 100644 --- a/src/compositor/wayland_wrapper/wayland_wrapper.pri +++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri @@ -13,7 +13,6 @@ HEADERS += \ wayland_wrapper/qwlinputmethodcontext_p.h \ wayland_wrapper/qwlregion_p.h \ wayland_wrapper/qwlsurfacebuffer_p.h \ - wayland_wrapper/qwltouch_p.h \ ../shared/qwaylandxkb.h \ SOURCES += \ @@ -25,7 +24,6 @@ SOURCES += \ wayland_wrapper/qwlinputmethodcontext.cpp \ wayland_wrapper/qwlregion.cpp \ wayland_wrapper/qwlsurfacebuffer.cpp \ - wayland_wrapper/qwltouch.cpp \ ../shared/qwaylandxkb.cpp \ INCLUDEPATH += wayland_wrapper |