PointerInterface is a "Server-managed multicasting resource". As in we have one QObject, managed by the server, but internally it represents multiple resources from various clients. We cannot control the lifespan of those resources, they may persist long after we stop having these capabilities on the seat. If we delete our pointer object when we stop advertising a pointer capability we have race conditions with clients calling release, or potentially even having a seat_get_pointer in flight. It's easier and safer just to have PointerInterface last as long as the Seat. If we don't have a mouse no-one should try to bind, and even if they did or remained bound long after we stop having a mouse it won't do any harm as there are no mouse events to broadcast.
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
|
SPDX-FileCopyrightText: 2020 Adrien Faveraux <ad1rie3@hotmail.fr>
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
*/
|
|
#pragma once
|
|
|
|
#include "kwin_export.h"
|
|
|
|
#include <QObject>
|
|
#include <memory>
|
|
|
|
namespace KWaylandServer
|
|
{
|
|
class SeatInterface;
|
|
class SurfaceInterface;
|
|
class TouchInterfacePrivate;
|
|
|
|
/**
|
|
* The TouchInterface class repserents a touchscreen associated with a wl_seat. It
|
|
* corresponds to the Wayland interface @c wl_touch.
|
|
*/
|
|
class KWIN_EXPORT TouchInterface : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
~TouchInterface() override;
|
|
|
|
SurfaceInterface *focusedSurface() const;
|
|
|
|
void sendDown(qint32 id, quint32 serial, const QPointF &localPos, SurfaceInterface *surface);
|
|
void sendUp(qint32 id, quint32 serial);
|
|
void sendFrame();
|
|
void sendCancel();
|
|
void sendMotion(qint32 id, const QPointF &localPos);
|
|
|
|
private:
|
|
explicit TouchInterface(SeatInterface *seat);
|
|
std::unique_ptr<TouchInterfacePrivate> d;
|
|
|
|
friend class SeatInterfacePrivate;
|
|
friend class TouchInterfacePrivate;
|
|
};
|
|
|
|
} // namespace KWaylandServer
|