File indexing completed on 2024-05-19 05:32:46

0001 /*
0002     SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
0003     SPDX-FileCopyrightText: 2020 Adrien Faveraux <ad1rie3@hotmail.fr>
0004     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 #pragma once
0009 
0010 #include "kwin_export.h"
0011 
0012 #include <QObject>
0013 #include <memory>
0014 
0015 namespace KWin
0016 {
0017 class SeatInterface;
0018 class SurfaceInterface;
0019 class TouchInterfacePrivate;
0020 
0021 /**
0022  * The TouchInterface class repserents a touchscreen associated with a wl_seat. It
0023  * corresponds to the Wayland interface @c wl_touch.
0024  */
0025 class KWIN_EXPORT TouchInterface : public QObject
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     ~TouchInterface() override;
0031 
0032     SurfaceInterface *focusedSurface() const;
0033 
0034     void sendDown(qint32 id, quint32 serial, const QPointF &localPos, SurfaceInterface *surface);
0035     void sendUp(qint32 id, quint32 serial);
0036     void sendFrame();
0037     void sendCancel();
0038     void sendMotion(qint32 id, const QPointF &localPos);
0039 
0040 private:
0041     explicit TouchInterface(SeatInterface *seat);
0042     std::unique_ptr<TouchInterfacePrivate> d;
0043 
0044     friend class SeatInterfacePrivate;
0045     friend class TouchInterfacePrivate;
0046 };
0047 
0048 } // namespace KWin