2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2021-02-13 15:40:56 +00:00
|
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 16:08:30 +00:00
|
|
|
#pragma once
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2021-02-13 15:40:56 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QPoint>
|
2015-12-07 10:45:34 +00:00
|
|
|
#include <QMatrix4x4>
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2014-09-18 15:14:50 +00:00
|
|
|
struct wl_client;
|
|
|
|
struct wl_resource;
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-09-02 07:34:31 +00:00
|
|
|
{
|
|
|
|
|
2020-05-12 11:26:48 +00:00
|
|
|
class AbstractDataSource;
|
2021-02-13 15:40:56 +00:00
|
|
|
class DataDeviceInterface;
|
2014-09-02 07:34:31 +00:00
|
|
|
class Display;
|
2021-02-13 15:40:56 +00:00
|
|
|
class KeyboardInterface;
|
|
|
|
class PointerInterface;
|
|
|
|
class SeatInterfacePrivate;
|
2014-09-02 07:34:31 +00:00
|
|
|
class SurfaceInterface;
|
2020-07-28 15:39:13 +00:00
|
|
|
class TextInputV2Interface;
|
2020-09-15 07:27:46 +00:00
|
|
|
class TextInputV3Interface;
|
2021-02-13 15:40:56 +00:00
|
|
|
class TouchInterface;
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2019-02-11 16:35:23 +00:00
|
|
|
/**
|
|
|
|
* Describes the source types for axis events. This indicates to the
|
|
|
|
* client how an axis event was physically generated; a client may
|
|
|
|
* adjust the user interface accordingly. For example, scroll events
|
|
|
|
* from a "finger" source may be in a smooth coordinate space with
|
|
|
|
* kinetic scrolling whereas a "wheel" source may be in discrete steps
|
|
|
|
* of a number of lines.
|
|
|
|
*
|
|
|
|
* The "continuous" axis source is a device generating events in a
|
|
|
|
* continuous coordinate space, but using something other than a
|
|
|
|
* finger. One example for this source is button-based scrolling where
|
|
|
|
* the vertical motion of a device is converted to scroll events while
|
|
|
|
* a button is held down.
|
|
|
|
*
|
|
|
|
* The "wheel tilt" axis source indicates that the actual device is a
|
|
|
|
* wheel but the scroll event is not caused by a rotation but a
|
|
|
|
* (usually sideways) tilt of the wheel.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2019-02-11 16:35:23 +00:00
|
|
|
enum class PointerAxisSource {
|
|
|
|
Unknown,
|
|
|
|
Wheel,
|
|
|
|
Finger,
|
|
|
|
Continuous,
|
|
|
|
WheelTilt
|
|
|
|
};
|
|
|
|
|
2021-03-15 17:58:39 +00:00
|
|
|
/**
|
|
|
|
* This enum type is used to describe the state of a pointer button. It
|
|
|
|
* is equivalent to the @c wl_pointer.button_state enum.
|
|
|
|
*/
|
|
|
|
enum class PointerButtonState : quint32 {
|
|
|
|
Released = 0,
|
|
|
|
Pressed = 1,
|
|
|
|
};
|
|
|
|
|
2021-03-24 09:50:52 +00:00
|
|
|
/**
|
|
|
|
* This enum type is used to describe the state of a keyboard key. It is
|
|
|
|
* equivalent to the @c wl_keyboard.key_state enum.
|
|
|
|
*/
|
|
|
|
enum class KeyboardKeyState : quint32 {
|
|
|
|
Released = 0,
|
|
|
|
Pressed = 1,
|
|
|
|
};
|
|
|
|
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @brief Represents a Seat on the Wayland Display.
|
|
|
|
*
|
|
|
|
* A Seat is a set of input devices (e.g. Keyboard, Pointer and Touch) the client can connect
|
|
|
|
* to. The server needs to announce which input devices are supported and passes dedicated input
|
|
|
|
* focus to a SurfaceInterface. Only the focused surface receives input events.
|
|
|
|
*
|
|
|
|
* The SeatInterface internally handles enter and release events when setting a focused surface.
|
|
|
|
* Also it handles input translation from global to the local coordination, removing the need from
|
|
|
|
* the user of the API to track the focused surfaces and can just interact with this class.
|
|
|
|
*
|
|
|
|
* To create a SeatInterface use @link Display::createSeat @endlink. Then one can set up what is
|
|
|
|
* supported. Last but not least create needs to be called.
|
|
|
|
*
|
|
|
|
* @code
|
|
|
|
* SeatInterface *seat = display->createSeat();
|
|
|
|
* // set up
|
|
|
|
* seat->setName(QStringLiteral("seat0"));
|
|
|
|
* seat->setHasPointer(true);
|
|
|
|
* seat->setHasKeyboard(true);
|
|
|
|
* seat->setHasTouch(false);
|
|
|
|
* // now fully create
|
|
|
|
* seat->create();
|
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* To forward input events one needs to set the focused surface, update time stamp and then
|
|
|
|
* forward the actual events:
|
|
|
|
*
|
|
|
|
* @code
|
|
|
|
* // example for pointer
|
|
|
|
* seat->setFocusedPointerSurface(surface, QPointF(100, 200)); // surface at it's global position
|
|
|
|
* seat->setTimestamp(100);
|
2021-03-11 08:24:47 +00:00
|
|
|
* seat->notifyPointerMotion(QPointF(350, 210)); // global pos, local pos in surface: 250,10
|
|
|
|
* seat->notifyPointerFrame();
|
2015-09-09 15:31:13 +00:00
|
|
|
* seat->setTimestamp(110);
|
2021-03-15 17:58:39 +00:00
|
|
|
* seat->notifyPointerButton(Qt::LeftButton, PointerButtonState::Pressed);
|
2021-03-11 08:24:47 +00:00
|
|
|
* seat->notifyPointerFrame();
|
2015-09-09 15:31:13 +00:00
|
|
|
* seat->setTimestamp(120);
|
2021-03-15 17:58:39 +00:00
|
|
|
* seat->notifyPointerButton(Qt::LeftButton, PointerButtonState::Released);
|
2021-03-11 08:24:47 +00:00
|
|
|
* seat->notifyPointerFrame();
|
2015-09-09 15:31:13 +00:00
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* @see KeyboardInterface
|
|
|
|
* @see PointerInterface
|
|
|
|
* @see TouchInterface
|
|
|
|
* @see SurfaceInterface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-02-13 15:40:56 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT SeatInterface : public QObject
|
2014-09-02 07:34:31 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* The name of the Seat
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-09-02 07:34:31 +00:00
|
|
|
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Whether the SeatInterface supports a pointer device.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-09-02 07:34:31 +00:00
|
|
|
Q_PROPERTY(bool pointer READ hasPointer WRITE setHasPointer NOTIFY hasPointerChanged)
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Whether the SeatInterface supports a keyboard device.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-09-02 07:34:31 +00:00
|
|
|
Q_PROPERTY(bool keyboard READ hasKeyboard WRITE setHasKeyboard NOTIFY hasKeyboardChanged)
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Whether the SeatInterface supports a touch device.
|
2019-10-15 12:59:08 +00:00
|
|
|
* @deprecated Since 5.5, use touch
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-09-02 07:34:31 +00:00
|
|
|
Q_PROPERTY(bool tourch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Whether the SeatInterface supports a touch device.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-09-09 15:31:13 +00:00
|
|
|
Q_PROPERTY(bool touch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
|
|
|
|
/**
|
|
|
|
* The global pointer position.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-03-11 08:24:47 +00:00
|
|
|
Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE notifyPointerMotion NOTIFY pointerPosChanged)
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* The current timestamp passed to the input events.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-25 14:29:01 +00:00
|
|
|
Q_PROPERTY(quint32 timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
|
2014-09-02 07:34:31 +00:00
|
|
|
public:
|
2020-12-09 20:13:19 +00:00
|
|
|
explicit SeatInterface(Display *display, QObject *parent = nullptr);
|
2014-09-02 07:34:31 +00:00
|
|
|
virtual ~SeatInterface();
|
|
|
|
|
2021-02-13 15:40:56 +00:00
|
|
|
Display *display() const;
|
2014-09-18 14:35:28 +00:00
|
|
|
QString name() const;
|
|
|
|
bool hasPointer() const;
|
|
|
|
bool hasKeyboard() const;
|
|
|
|
bool hasTouch() const;
|
2014-09-02 07:34:31 +00:00
|
|
|
|
|
|
|
void setName(const QString &name);
|
|
|
|
void setHasPointer(bool has);
|
|
|
|
void setHasKeyboard(bool has);
|
|
|
|
void setHasTouch(bool has);
|
|
|
|
|
2014-11-25 14:29:01 +00:00
|
|
|
void setTimestamp(quint32 time);
|
|
|
|
quint32 timestamp() const;
|
|
|
|
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* @name Drag'n'Drop related methods
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
///@{
|
|
|
|
/**
|
|
|
|
* @returns whether there is currently a drag'n'drop going on.
|
|
|
|
* @see isDragPointer
|
|
|
|
* @see isDragTouch
|
|
|
|
* @see dragStarted
|
|
|
|
* @see dragEnded
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
bool isDrag() const;
|
|
|
|
/**
|
|
|
|
* @returns whether the drag'n'drop is operated through the pointer device
|
|
|
|
* @see isDrag
|
|
|
|
* @see isDragTouch
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
bool isDragPointer() const;
|
|
|
|
/**
|
|
|
|
* @returns whether the drag'n'drop is operated through the touch device
|
|
|
|
* @see isDrag
|
|
|
|
* @see isDragPointer
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
bool isDragTouch() const;
|
|
|
|
/**
|
|
|
|
* @returns The transformation applied to go from global to local coordinates for drag motion events.
|
|
|
|
* @see dragSurfaceTransformation
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
QMatrix4x4 dragSurfaceTransformation() const;
|
|
|
|
/**
|
|
|
|
* @returns The currently focused Surface for drag motion events.
|
|
|
|
* @see dragSurfaceTransformation
|
|
|
|
* @see dragSurfaceChanged
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
SurfaceInterface *dragSurface() const;
|
|
|
|
/**
|
|
|
|
* @returns The DataDeviceInterface which started the drag and drop operation.
|
|
|
|
* @see isDrag
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
DataDeviceInterface *dragSource() const;
|
|
|
|
/**
|
|
|
|
* Sets the current drag target to @p surface.
|
|
|
|
*
|
|
|
|
* Sends a drag leave event to the current target and an enter event to @p surface.
|
|
|
|
* The enter position is derived from @p globalPosition and transformed by @p inputTransformation.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
void setDragTarget(SurfaceInterface *surface, const QPointF &globalPosition, const QMatrix4x4 &inputTransformation);
|
|
|
|
/**
|
|
|
|
* Sets the current drag target to @p surface.
|
|
|
|
*
|
|
|
|
* Sends a drag leave event to the current target and an enter event to @p surface.
|
|
|
|
* The enter position is derived from current global position and transformed by @p inputTransformation.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
void setDragTarget(SurfaceInterface *surface, const QMatrix4x4 &inputTransformation = QMatrix4x4());
|
|
|
|
///@}
|
|
|
|
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @name Pointer related methods
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-09-09 15:31:13 +00:00
|
|
|
///@{
|
|
|
|
/**
|
|
|
|
* Updates the global pointer @p pos.
|
|
|
|
*
|
|
|
|
* Sends a pointer motion event to the focused pointer surface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-03-11 08:24:47 +00:00
|
|
|
void notifyPointerMotion(const QPointF &pos);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns the global pointer position
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-25 13:24:52 +00:00
|
|
|
QPointF pointerPos() const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Sets the focused pointer @p surface.
|
|
|
|
* All pointer events will be sent to the @p surface till a new focused pointer surface gets
|
|
|
|
* installed. When the focus pointer surface changes a leave event is sent to the previous
|
|
|
|
* focused surface.
|
|
|
|
*
|
|
|
|
* To unset the focused pointer surface pass @c nullptr as @p surface.
|
|
|
|
*
|
|
|
|
* Pointer motion events are adjusted to the local position based on the @p surfacePosition.
|
|
|
|
* If the surface changes it's position in the global coordinate system
|
|
|
|
* use setFocusedPointerSurfacePosition to update.
|
2015-12-07 10:45:34 +00:00
|
|
|
* The surface position is used to create the base transformation matrix to go from global
|
|
|
|
* to surface local coordinates. The default generated matrix is a translation with
|
|
|
|
* negative @p surfacePosition.
|
2015-09-09 15:31:13 +00:00
|
|
|
*
|
|
|
|
* @param surface The surface which should become the new focused pointer surface.
|
|
|
|
* @param surfacePosition The position of the surface in the global coordinate system
|
|
|
|
*
|
|
|
|
* @see setPointerPos
|
|
|
|
* @see focucedPointerSurface
|
|
|
|
* @see focusedPointer
|
|
|
|
* @see setFocusedPointerSurfacePosition
|
|
|
|
* @see focusedPointerSurfacePosition
|
2015-12-07 10:45:34 +00:00
|
|
|
* @see setFocusedPointerSurfaceTransformation
|
|
|
|
* @see focusedPointerSurfaceTransformation
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 09:34:23 +00:00
|
|
|
void setFocusedPointerSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPoint());
|
2015-12-07 10:45:34 +00:00
|
|
|
/**
|
|
|
|
* Sets the focused pointer @p surface.
|
|
|
|
* All pointer events will be sent to the @p surface till a new focused pointer surface gets
|
|
|
|
* installed. When the focus pointer surface changes a leave event is sent to the previous
|
|
|
|
* focused surface.
|
|
|
|
*
|
|
|
|
* To unset the focused pointer surface pass @c nullptr as @p surface.
|
|
|
|
*
|
|
|
|
* Pointer motion events are adjusted to the local position based on the @p transformation.
|
|
|
|
* If the surface changes it's position in the global coordinate system
|
|
|
|
* use setFocusedPointerSurfaceTransformation to update.
|
|
|
|
*
|
|
|
|
* @param surface The surface which should become the new focused pointer surface.
|
|
|
|
* @param transformation The transformation to transform global into local coordinates
|
|
|
|
*
|
|
|
|
* @see setPointerPos
|
|
|
|
* @see focucedPointerSurface
|
|
|
|
* @see focusedPointer
|
|
|
|
* @see setFocusedPointerSurfacePosition
|
|
|
|
* @see focusedPointerSurfacePosition
|
|
|
|
* @see setFocusedPointerSurfaceTransformation
|
|
|
|
* @see focusedPointerSurfaceTransformation
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-07 10:45:34 +00:00
|
|
|
void setFocusedPointerSurface(SurfaceInterface *surface, const QMatrix4x4 &transformation);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns The currently focused pointer surface, that is the surface receiving pointer events.
|
|
|
|
* @see setFocusedPointerSurface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-25 14:54:28 +00:00
|
|
|
SurfaceInterface *focusedPointerSurface() const;
|
2021-02-12 22:29:45 +00:00
|
|
|
PointerInterface *pointer() const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
2015-12-07 10:45:34 +00:00
|
|
|
* Updates the global position of the currently focused pointer surface.
|
|
|
|
*
|
|
|
|
* Updating the focused surface position also generates a new transformation matrix.
|
|
|
|
* The default generated matrix is a translation with negative @p surfacePosition.
|
|
|
|
* If a different transformation is required a dedicated call to
|
|
|
|
* @link setFocusedPointerSurfaceTransformation is required.
|
2015-09-09 15:31:13 +00:00
|
|
|
*
|
|
|
|
* @param surfacePosition The new global position of the focused pointer surface
|
|
|
|
* @see focusedPointerSurface
|
|
|
|
* @see setFocusedPointerSurface
|
2015-12-07 10:45:34 +00:00
|
|
|
* @see focusedPointerSurfaceTransformation
|
|
|
|
* @see setFocusedPointerSurfaceTransformation
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 09:34:23 +00:00
|
|
|
void setFocusedPointerSurfacePosition(const QPointF &surfacePosition);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns The position of the focused pointer surface in global coordinates.
|
|
|
|
* @see setFocusedPointerSurfacePosition
|
|
|
|
* @see setFocusedPointerSurface
|
2015-12-07 10:45:34 +00:00
|
|
|
* @see focusedPointerSurfaceTransformation
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 09:34:23 +00:00
|
|
|
QPointF focusedPointerSurfacePosition() const;
|
2015-12-07 10:45:34 +00:00
|
|
|
/**
|
|
|
|
* Sets the @p transformation for going from global to local coordinates.
|
|
|
|
*
|
|
|
|
* The default transformation gets generated from the surface position and reset whenever
|
|
|
|
* the surface position changes.
|
|
|
|
*
|
|
|
|
* @see focusedPointerSurfaceTransformation
|
|
|
|
* @see focusedPointerSurfacePosition
|
|
|
|
* @see setFocusedPointerSurfacePosition
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-07 10:45:34 +00:00
|
|
|
void setFocusedPointerSurfaceTransformation(const QMatrix4x4 &transformation);
|
|
|
|
/**
|
|
|
|
* @returns The transformation applied to pointer position to go from global to local coordinates.
|
|
|
|
* @see setFocusedPointerSurfaceTransformation
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-12-07 10:45:34 +00:00
|
|
|
QMatrix4x4 focusedPointerSurfaceTransformation() const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
2021-03-15 17:58:39 +00:00
|
|
|
* Marks the specified @a button as pressed or released based on @a state.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-03-15 17:58:39 +00:00
|
|
|
void notifyPointerButton(quint32 button, PointerButtonState state);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @overload
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-03-15 17:58:39 +00:00
|
|
|
void notifyPointerButton(Qt::MouseButton button, PointerButtonState state);
|
2021-03-11 08:24:47 +00:00
|
|
|
void notifyPointerFrame();
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns whether the @p button is pressed
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 10:50:52 +00:00
|
|
|
bool isPointerButtonPressed(quint32 button) const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns whether the @p button is pressed
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 10:50:52 +00:00
|
|
|
bool isPointerButtonPressed(Qt::MouseButton button) const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns the last serial for @p button.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 10:50:52 +00:00
|
|
|
quint32 pointerButtonSerial(quint32 button) const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns the last serial for @p button.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 10:50:52 +00:00
|
|
|
quint32 pointerButtonSerial(Qt::MouseButton button) const;
|
2019-02-11 16:35:23 +00:00
|
|
|
/**
|
|
|
|
* Sends axis events to the currently focused pointer surface.
|
|
|
|
*
|
|
|
|
* @param orientation The scroll axis.
|
|
|
|
* @param delta The length of a vector along the specified axis @p orientation.
|
|
|
|
* @param discreteDelta The number of discrete steps, e.g. mouse wheel clicks.
|
|
|
|
* @param source Describes how the axis event was physically generated.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-03-11 08:24:47 +00:00
|
|
|
void notifyPointerAxis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* @returns true if there is a pressed button with the given @p serial
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
bool hasImplicitPointerGrab(quint32 serial) const;
|
2016-10-07 07:07:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A relative motion is in the same dimension as regular motion events,
|
|
|
|
* except they do not represent an absolute position. For example,
|
|
|
|
* moving a pointer from (x, y) to (x', y') would have the equivalent
|
|
|
|
* relative motion (x' - x, y' - y). If a pointer motion caused the
|
|
|
|
* absolute pointer position to be clipped by for example the edge of the
|
|
|
|
* monitor, the relative motion is unaffected by the clipping and will
|
|
|
|
* represent the unclipped motion.
|
|
|
|
*
|
|
|
|
* This method also contains non-accelerated motion deltas (@p deltaNonAccelerated).
|
|
|
|
* The non-accelerated delta is, when applicable, the regular pointer motion
|
|
|
|
* delta as it was before having applied motion acceleration and other
|
|
|
|
* transformations such as normalization.
|
|
|
|
*
|
|
|
|
* Note that the non-accelerated delta does not represent 'raw' events as
|
|
|
|
* they were read from some device. Pointer motion acceleration is device-
|
|
|
|
* and configuration-specific and non-accelerated deltas and accelerated
|
|
|
|
* deltas may have the same value on some devices.
|
|
|
|
*
|
2017-05-26 00:57:20 +00:00
|
|
|
* Relative motions are not coupled to wl_pointer.motion events (see {@link setPointerPos},
|
2016-10-07 07:07:34 +00:00
|
|
|
* and can be sent in combination with such events, but also independently. There may
|
|
|
|
* also be scenarios where wl_pointer.motion is sent, but there is no
|
|
|
|
* relative motion. The order of an absolute and relative motion event
|
|
|
|
* originating from the same physical motion is not guaranteed.
|
|
|
|
*
|
|
|
|
* Sending relative pointer events only makes sense if the RelativePointerManagerInterface
|
|
|
|
* is created on the Display.
|
|
|
|
*
|
|
|
|
* @param delta Motion vector
|
|
|
|
* @param deltaNonAccelerated non-accelerated motion vector
|
|
|
|
* @param microseconds timestamp with microseconds granularity
|
|
|
|
* @see setPointerPos
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-07 07:07:34 +00:00
|
|
|
void relativePointerMotion(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 microseconds);
|
2016-10-26 08:27:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts a multi-finger swipe gesture for the currently focused pointer surface.
|
|
|
|
*
|
|
|
|
* Such gestures are normally reported through dedicated input devices such as touchpads.
|
|
|
|
*
|
|
|
|
* The gesture is usually initiated by multiple fingers moving in the
|
|
|
|
* same direction but once initiated the direction may change.
|
|
|
|
* The precise conditions of when such a gesture is detected are
|
|
|
|
* implementation-dependent.
|
|
|
|
*
|
|
|
|
* Only one gesture (either swipe or pinch) can be active at a given time.
|
|
|
|
*
|
|
|
|
* @param fingerCount The number of fingers involved in this multi-finger touchpad gesture
|
|
|
|
*
|
|
|
|
* @see PointerGesturesInterface
|
|
|
|
* @see focusedPointerSurface
|
|
|
|
* @see updatePointerSwipeGesture
|
|
|
|
* @see endPointerSwipeGesture
|
|
|
|
* @see cancelPointerSwipeGesture
|
|
|
|
* @see startPointerPinchGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void startPointerSwipeGesture(quint32 fingerCount);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The position of the logical center of the currently active multi-finger swipe gesture changes.
|
|
|
|
*
|
|
|
|
* @param delta coordinates are relative coordinates of the logical center of the gesture compared to the previous event.
|
|
|
|
* @see startPointerSwipeGesture
|
|
|
|
* @see endPointerSwipeGesture
|
|
|
|
* @see cancelPointerSwipeGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void updatePointerSwipeGesture(const QSizeF &delta);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The multi-finger swipe gesture ended. This may happen when one or more fingers are lifted.
|
|
|
|
* @see startPointerSwipeGesture
|
|
|
|
* @see updatePointerSwipeGesture
|
|
|
|
* @see cancelPointerSwipeGesture
|
|
|
|
* @see 5.29
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void endPointerSwipeGesture();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The multi-finger swipe gestures ended and got cancelled by the Wayland compositor.
|
|
|
|
* @see startPointerSwipeGesture
|
|
|
|
* @see updatePointerSwipeGesture
|
|
|
|
* @see endPointerSwipeGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void cancelPointerSwipeGesture();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts a multi-finch pinch gesture for the currently focused pointer surface.
|
|
|
|
*
|
|
|
|
* Such gestures are normally reported through dedicated input devices such as touchpads.
|
|
|
|
*
|
|
|
|
* The gesture is usually initiated by multiple fingers moving towards
|
|
|
|
* each other or away from each other, or by two or more fingers rotating
|
|
|
|
* around a logical center of gravity. The precise conditions of when
|
|
|
|
* such a gesture is detected are implementation-dependent.
|
|
|
|
*
|
|
|
|
* Only one gesture (either swipe or pinch) can be active at a given time.
|
|
|
|
*
|
|
|
|
* @param fingerCount The number of fingers involved in this multi-touch touchpad gesture
|
|
|
|
*
|
|
|
|
* @see PointerGesturesInterface
|
|
|
|
* @see focusedPointerSurface
|
|
|
|
* @see updatePointerPinchGesture
|
|
|
|
* @see endPointerPinchGesture
|
|
|
|
* @see cancelPointerPinchGesture
|
|
|
|
* @see startPointerSwipeGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void startPointerPinchGesture(quint32 fingerCount);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The position of the logical center, the rotation or the relative scale of this
|
|
|
|
* multi-finger pinch gesture changes.
|
|
|
|
*
|
|
|
|
* @param delta coordinates are relative coordinates of the logical center of the gesture compared to the previous event.
|
|
|
|
* @param scale an absolute scale compared to the gesture start
|
|
|
|
* @param rotation relative angle in degrees clockwise compared to the previous start of update
|
|
|
|
* @see startPointerPinchGesture
|
|
|
|
* @see endPointerPinchGesture
|
|
|
|
* @see cancelPointerPinchGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void updatePointerPinchGesture(const QSizeF &delta, qreal scale, qreal rotation);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see startPointerPinchGesture
|
|
|
|
* @see updatePointerPinchGesture
|
|
|
|
* @see cancelPointerPinchGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void endPointerPinchGesture();
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see startPointerPinchGesture
|
|
|
|
* @see updatePointerPinchGesture
|
|
|
|
* @see endPointerPinchGesture
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-10-26 08:27:14 +00:00
|
|
|
void cancelPointerPinchGesture();
|
2015-09-09 15:31:13 +00:00
|
|
|
///@}
|
2014-11-25 13:24:52 +00:00
|
|
|
|
2016-05-02 12:28:26 +00:00
|
|
|
/**
|
|
|
|
* Passes keyboard focus to @p surface.
|
|
|
|
*
|
|
|
|
* If the SeatInterface has the keyboard capability, also the focused
|
|
|
|
* text input surface will be set to @p surface.
|
|
|
|
*
|
|
|
|
* @see focusedKeyboardSurface
|
|
|
|
* @see hasKeyboard
|
|
|
|
* @see setFocusedTextInputSurface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-26 14:00:44 +00:00
|
|
|
void setFocusedKeyboardSurface(SurfaceInterface *surface);
|
|
|
|
SurfaceInterface *focusedKeyboardSurface() const;
|
2020-10-02 14:22:59 +00:00
|
|
|
KeyboardInterface *keyboard() const;
|
2021-03-24 09:50:52 +00:00
|
|
|
void notifyKeyboardKey(quint32 keyCode, KeyboardKeyState state);
|
|
|
|
void notifyKeyboardModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
|
2015-09-09 15:31:13 +00:00
|
|
|
///@}
|
2014-11-26 14:00:44 +00:00
|
|
|
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @name touch related methods
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-09-09 15:31:13 +00:00
|
|
|
///@{
|
2015-03-25 12:31:38 +00:00
|
|
|
void setFocusedTouchSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPointF());
|
|
|
|
SurfaceInterface *focusedTouchSurface() const;
|
2021-02-12 23:53:06 +00:00
|
|
|
TouchInterface *touch() const;
|
2015-03-25 12:31:38 +00:00
|
|
|
void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
|
|
|
|
QPointF focusedTouchSurfacePosition() const;
|
2021-03-11 08:24:47 +00:00
|
|
|
void notifyTouchDown(qint32 id, const QPointF &globalPosition);
|
|
|
|
void notifyTouchUp(qint32 id);
|
|
|
|
void notifyTouchMotion(qint32 id, const QPointF &globalPosition);
|
|
|
|
void notifyTouchFrame();
|
|
|
|
void notifyTouchCancel();
|
2015-03-25 12:31:38 +00:00
|
|
|
bool isTouchSequence() const;
|
2018-09-12 01:33:07 +00:00
|
|
|
/**
|
|
|
|
* @returns true if there is a touch sequence going on associated with a touch
|
|
|
|
* down of the given @p serial.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2018-09-12 01:33:07 +00:00
|
|
|
bool hasImplicitTouchGrab(quint32 serial) const;
|
2015-09-09 15:31:13 +00:00
|
|
|
///@}
|
2015-03-25 12:31:38 +00:00
|
|
|
|
2016-05-02 12:28:26 +00:00
|
|
|
/**
|
|
|
|
* @name Text input related methods.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-05-02 12:28:26 +00:00
|
|
|
///@{
|
|
|
|
/**
|
|
|
|
* Passes text input focus to @p surface.
|
|
|
|
*
|
|
|
|
* If the SeatInterface has the keyboard capability this method will
|
|
|
|
* be invoked automatically when setting the focused keyboard surface.
|
|
|
|
*
|
2020-07-28 15:39:13 +00:00
|
|
|
* In case there is a TextInputV2Interface for the @p surface, the enter
|
|
|
|
* event will be triggered on the TextInputV2Interface for @p surface.
|
|
|
|
* The focusedTextInput will be set to that TextInputV2Interface. If there
|
|
|
|
* is no TextInputV2Interface for that @p surface, it might get updated later on.
|
2016-05-02 12:28:26 +00:00
|
|
|
* In both cases the signal focusedTextInputChanged will be emitted.
|
|
|
|
*
|
|
|
|
* @see focusedTextInputSurface
|
|
|
|
* @see focusedTextInput
|
|
|
|
* @see focusedTextInputChanged
|
|
|
|
* @see setFocusedKeyboardSurface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-05-02 12:28:26 +00:00
|
|
|
void setFocusedTextInputSurface(SurfaceInterface *surface);
|
|
|
|
/**
|
|
|
|
* @returns The SurfaceInterface which is currently focused for text input.
|
|
|
|
* @see setFocusedTextInputSurface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-05-02 12:28:26 +00:00
|
|
|
SurfaceInterface *focusedTextInputSurface() const;
|
|
|
|
/**
|
|
|
|
* The currently focused text input, may be @c null even if there is a
|
|
|
|
* focused text input surface set.
|
|
|
|
*
|
2017-05-26 00:57:20 +00:00
|
|
|
* The focused text input might not be enabled for the {@link focusedTextInputSurface}.
|
2016-05-02 12:28:26 +00:00
|
|
|
* It is recommended to check the enabled state before interacting with the
|
2020-07-28 15:39:13 +00:00
|
|
|
* TextInputV2Interface.
|
2016-05-02 12:28:26 +00:00
|
|
|
*
|
|
|
|
* @see focusedTextInputChanged
|
|
|
|
* @see focusedTextInputSurface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-07-28 15:39:13 +00:00
|
|
|
TextInputV2Interface *textInputV2() const;
|
2020-09-15 07:27:46 +00:00
|
|
|
|
|
|
|
TextInputV3Interface *textInputV3() const;
|
2016-05-02 12:28:26 +00:00
|
|
|
///@}
|
|
|
|
|
2016-06-21 09:14:46 +00:00
|
|
|
/**
|
|
|
|
* @returns The DataDeviceInterface holding the current clipboard selection.
|
2019-02-06 08:23:56 +00:00
|
|
|
* @see selectionChanged
|
2016-06-21 09:14:46 +00:00
|
|
|
* @see setSelection
|
2020-05-18 13:43:38 +00:00
|
|
|
* This may be null
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-05-12 11:26:48 +00:00
|
|
|
KWaylandServer::AbstractDataSource *selection() const;
|
2020-05-18 13:43:38 +00:00
|
|
|
|
2016-06-21 09:14:46 +00:00
|
|
|
/**
|
|
|
|
* This method allows to manually set the @p dataDevice for the current clipboard selection.
|
|
|
|
* The clipboard selection is handled automatically in SeatInterface.
|
|
|
|
* If a DataDeviceInterface belonging to the current focused KeyboardInterface
|
|
|
|
* sets a selection, the current clipboard selection will be updated automatically.
|
|
|
|
* With this method it's possible to override the automatic clipboard update for
|
|
|
|
* e.g. the case of a clipboard manager.
|
|
|
|
*
|
|
|
|
* @param dataDevice Sets the current clipboard selection.
|
|
|
|
* @see selection
|
2019-02-06 08:23:56 +00:00
|
|
|
* @see selectionChanged
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-05-12 11:26:48 +00:00
|
|
|
void setSelection(AbstractDataSource *selection);
|
2016-06-21 09:14:46 +00:00
|
|
|
|
2020-06-01 22:29:53 +00:00
|
|
|
void setPrimarySelection(AbstractDataSource *selection);
|
|
|
|
|
2014-11-05 14:29:18 +00:00
|
|
|
static SeatInterface *get(wl_resource *native);
|
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void nameChanged(const QString&);
|
|
|
|
void hasPointerChanged(bool);
|
|
|
|
void hasKeyboardChanged(bool);
|
|
|
|
void hasTouchChanged(bool);
|
2014-11-25 13:24:52 +00:00
|
|
|
void pointerPosChanged(const QPointF &pos);
|
2018-09-12 01:33:07 +00:00
|
|
|
void touchMoved(qint32 id, quint32 serial, const QPointF &globalPosition);
|
2014-11-25 14:29:01 +00:00
|
|
|
void timestampChanged(quint32);
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2019-02-06 08:23:56 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the selection changes
|
|
|
|
* @see selection
|
|
|
|
* @see setSelection
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-05-12 11:26:48 +00:00
|
|
|
void selectionChanged(KWaylandServer::AbstractDataSource*);
|
2019-02-06 08:23:56 +00:00
|
|
|
|
2020-06-01 22:29:53 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the primary selection changes
|
|
|
|
* @see primarySelection
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-06-01 22:29:53 +00:00
|
|
|
void primarySelectionChanged(KWaylandServer::AbstractDataSource*);
|
|
|
|
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* Emitted when a drag'n'drop operation is started
|
|
|
|
* @see dragEnded
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
void dragStarted();
|
|
|
|
/**
|
|
|
|
* Emitted when a drag'n'drop operation ended, either by dropping or canceling.
|
|
|
|
* @see dragStarted
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
void dragEnded();
|
|
|
|
/**
|
|
|
|
* Emitted whenever the drag surface for motion events changed.
|
|
|
|
* @see dragSurface
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-01 06:49:04 +00:00
|
|
|
void dragSurfaceChanged();
|
2016-05-02 12:28:26 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the focused text input changed.
|
|
|
|
* @see focusedTextInput
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-07-28 15:39:13 +00:00
|
|
|
void focusedTextInputSurfaceChanged();
|
2016-03-01 06:49:04 +00:00
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
private:
|
2021-02-13 15:40:56 +00:00
|
|
|
QScopedPointer<SeatInterfacePrivate> d;
|
|
|
|
friend class SeatInterfacePrivate;
|
2014-09-02 07:34:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::SeatInterface*)
|