1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2017 The Qt Company Ltd. 4 ** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB). 5 ** Contact: https://www.qt.io/licensing/ 6 ** 7 ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. 8 ** 9 ** $QT_BEGIN_LICENSE:GPL$ 10 ** Commercial License Usage 11 ** Licensees holding valid commercial Qt licenses may use this file in 12 ** accordance with the commercial license agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and The Qt Company. For licensing terms 15 ** and conditions see https://www.qt.io/terms-conditions. For further 16 ** information use the contact form at https://www.qt.io/contact-us. 17 ** 18 ** GNU General Public License Usage 19 ** Alternatively, this file may be used under the terms of the GNU 20 ** General Public License version 3 or (at your option) any later version 21 ** approved by the KDE Free Qt Foundation. The licenses are as published by 22 ** the Free Software Foundation and appearing in the file LICENSE.GPL3 23 ** included in the packaging of this file. Please review the following 24 ** information to ensure the GNU General Public License requirements will 25 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 26 ** 27 ** $QT_END_LICENSE$ 28 ** 29 ****************************************************************************/ 30 31 #ifndef QWAYLANDPOINTER_P_H 32 #define QWAYLANDPOINTER_P_H 33 34 // 35 // W A R N I N G 36 // ------------- 37 // 38 // This file is not part of the Qt API. It exists purely as an 39 // implementation detail. This header file may change from version to 40 // version without notice, or even be removed. 41 // 42 // We mean it. 43 // 44 45 #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> 46 #include <QtWaylandCompositor/QWaylandDestroyListener> 47 #include <QtWaylandCompositor/QWaylandPointer> 48 49 #include <QtCore/QList> 50 #include <QtCore/QPoint> 51 #include <QtCore/QObject> 52 #include <QtCore/private/qobject_p.h> 53 54 #include <QtWaylandCompositor/private/qwayland-server-wayland.h> 55 #include <QtWaylandCompositor/QWaylandView> 56 #include <QtWaylandCompositor/QWaylandSurface> 57 #include <QtWaylandCompositor/QWaylandSeat> 58 59 #include <stdint.h> 60 61 QT_BEGIN_NAMESPACE 62 63 class QWaylandView; 64 65 class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate 66 , public QtWaylandServer::wl_pointer 67 { 68 Q_DECLARE_PUBLIC(QWaylandPointer) 69 public: 70 QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat); 71 compositor()72 QWaylandCompositor *compositor() const { return seat->compositor(); } 73 74 protected: 75 void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) override; 76 void pointer_release(Resource *resource) override; 77 78 private: 79 uint sendButton(Qt::MouseButton button, uint32_t state); 80 void sendMotion(); 81 void sendEnter(QWaylandSurface *surface); 82 void sendLeave(); 83 void ensureEntered(QWaylandSurface *surface); 84 85 QWaylandSeat *seat = nullptr; 86 QWaylandOutput *output = nullptr; 87 QPointer<QWaylandSurface> enteredSurface; 88 89 QPointF localPosition; 90 QPointF spacePosition; 91 92 uint enterSerial = 0; 93 94 int buttonCount = 0; 95 96 QWaylandDestroyListener enteredSurfaceDestroyListener; 97 98 static QWaylandSurfaceRole s_role; 99 }; 100 101 QT_END_NAMESPACE 102 103 #endif // QWAYLANDPOINTER_P_H 104