2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@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
|
|
|
|
*/
|
2014-09-17 14:20:56 +00:00
|
|
|
#ifndef WAYLAND_SERVER_SEAT_INTERFACE_H
|
|
|
|
#define WAYLAND_SERVER_SEAT_INTERFACE_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
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2014-11-13 14:07:31 +00:00
|
|
|
#include "global.h"
|
2014-11-26 14:00:44 +00:00
|
|
|
#include "keyboard_interface.h"
|
2014-11-26 09:34:23 +00:00
|
|
|
#include "pointer_interface.h"
|
2015-03-25 12:31:38 +00:00
|
|
|
#include "touch_interface.h"
|
2014-09-17 13:10:43 +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
|
|
|
{
|
|
|
|
|
2016-03-01 06:49:04 +00:00
|
|
|
class DataDeviceInterface;
|
2020-05-12 11:26:48 +00:00
|
|
|
class AbstractDataSource;
|
2014-09-02 07:34:31 +00:00
|
|
|
class Display;
|
|
|
|
class SurfaceInterface;
|
2016-05-02 12:28:26 +00:00
|
|
|
class TextInputInterface;
|
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.
|
|
|
|
*
|
|
|
|
* @since 5.59
|
|
|
|
**/
|
|
|
|
enum class PointerAxisSource {
|
|
|
|
Unknown,
|
|
|
|
Wheel,
|
|
|
|
Finger,
|
|
|
|
Continuous,
|
|
|
|
WheelTilt
|
|
|
|
};
|
|
|
|
|
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);
|
|
|
|
* seat->setPointerPos(QPointF(350, 210)); // global pos, local pos in surface: 250,10
|
|
|
|
* seat->setTimestamp(110);
|
|
|
|
* seat->pointerButtonPressed(Qt::LeftButton);
|
|
|
|
* seat->setTimestamp(120);
|
|
|
|
* seat->pointerButtonReleased(Qt::LeftButton);
|
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* @see KeyboardInterface
|
|
|
|
* @see PointerInterface
|
|
|
|
* @see TouchInterface
|
|
|
|
* @see SurfaceInterface
|
|
|
|
**/
|
2014-11-13 14:07:31 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT SeatInterface : public Global
|
2014-09-02 07:34:31 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* The name of the Seat
|
|
|
|
**/
|
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.
|
|
|
|
**/
|
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.
|
|
|
|
**/
|
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
|
2015-09-09 15:31:13 +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.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool touch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
|
|
|
|
/**
|
|
|
|
* The global pointer position.
|
|
|
|
**/
|
2014-11-25 13:24:52 +00:00
|
|
|
Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE setPointerPos NOTIFY pointerPosChanged)
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* The current timestamp passed to the input events.
|
|
|
|
**/
|
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:
|
|
|
|
virtual ~SeatInterface();
|
|
|
|
|
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
|
|
|
|
**/
|
|
|
|
///@{
|
|
|
|
/**
|
|
|
|
* @returns whether there is currently a drag'n'drop going on.
|
|
|
|
* @since 5.6
|
|
|
|
* @see isDragPointer
|
|
|
|
* @see isDragTouch
|
|
|
|
* @see dragStarted
|
|
|
|
* @see dragEnded
|
|
|
|
**/
|
|
|
|
bool isDrag() const;
|
|
|
|
/**
|
|
|
|
* @returns whether the drag'n'drop is operated through the pointer device
|
|
|
|
* @since 5.6
|
|
|
|
* @see isDrag
|
|
|
|
* @see isDragTouch
|
|
|
|
**/
|
|
|
|
bool isDragPointer() const;
|
|
|
|
/**
|
|
|
|
* @returns whether the drag'n'drop is operated through the touch device
|
|
|
|
* @since 5.6
|
|
|
|
* @see isDrag
|
|
|
|
* @see isDragPointer
|
|
|
|
**/
|
|
|
|
bool isDragTouch() const;
|
|
|
|
/**
|
|
|
|
* @returns The transformation applied to go from global to local coordinates for drag motion events.
|
|
|
|
* @see dragSurfaceTransformation
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
QMatrix4x4 dragSurfaceTransformation() const;
|
|
|
|
/**
|
|
|
|
* @returns The currently focused Surface for drag motion events.
|
|
|
|
* @since 5.6
|
|
|
|
* @see dragSurfaceTransformation
|
|
|
|
* @see dragSurfaceChanged
|
|
|
|
**/
|
|
|
|
SurfaceInterface *dragSurface() const;
|
|
|
|
/**
|
|
|
|
* @returns The PointerInterface which triggered the drag operation
|
|
|
|
* @since 5.6
|
|
|
|
* @see isDragPointer
|
|
|
|
**/
|
|
|
|
PointerInterface *dragPointer() const;
|
|
|
|
/**
|
|
|
|
* @returns The DataDeviceInterface which started the drag and drop operation.
|
|
|
|
* @see isDrag
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
void setDragTarget(SurfaceInterface *surface, const QMatrix4x4 &inputTransformation = QMatrix4x4());
|
|
|
|
///@}
|
|
|
|
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @name Pointer related methods
|
|
|
|
**/
|
|
|
|
///@{
|
|
|
|
/**
|
|
|
|
* Updates the global pointer @p pos.
|
|
|
|
*
|
|
|
|
* Sends a pointer motion event to the focused pointer surface.
|
|
|
|
**/
|
2014-11-25 13:24:52 +00:00
|
|
|
void setPointerPos(const QPointF &pos);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns the global pointer position
|
|
|
|
**/
|
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
|
2015-09-09 15:31:13 +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
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
**/
|
2014-11-25 14:54:28 +00:00
|
|
|
SurfaceInterface *focusedPointerSurface() const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns The PointerInterface belonging to the focused pointer surface, if any.
|
|
|
|
* @see setFocusedPointerSurface
|
|
|
|
**/
|
2014-11-25 15:04:07 +00:00
|
|
|
PointerInterface *focusedPointer() 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
|
2015-09-09 15:31:13 +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
|
2015-09-09 15:31:13 +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
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
void setFocusedPointerSurfaceTransformation(const QMatrix4x4 &transformation);
|
|
|
|
/**
|
|
|
|
* @returns The transformation applied to pointer position to go from global to local coordinates.
|
|
|
|
* @see setFocusedPointerSurfaceTransformation
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
QMatrix4x4 focusedPointerSurfaceTransformation() const;
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Marks the @p button as pressed.
|
|
|
|
*
|
|
|
|
* If there is a focused pointer surface a button pressed event is sent to it.
|
|
|
|
*
|
|
|
|
* @param button The Linux button code
|
|
|
|
**/
|
2014-11-26 10:50:52 +00:00
|
|
|
void pointerButtonPressed(quint32 button);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @overload
|
|
|
|
**/
|
2014-11-26 10:50:52 +00:00
|
|
|
void pointerButtonPressed(Qt::MouseButton button);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* Marks the @p button as released.
|
|
|
|
*
|
|
|
|
* If there is a focused pointer surface a button release event is sent to it.
|
|
|
|
*
|
|
|
|
* @param button The Linux button code
|
|
|
|
**/
|
2014-11-26 10:50:52 +00:00
|
|
|
void pointerButtonReleased(quint32 button);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @overload
|
|
|
|
**/
|
2014-11-26 10:50:52 +00:00
|
|
|
void pointerButtonReleased(Qt::MouseButton button);
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @returns whether the @p button is pressed
|
|
|
|
**/
|
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
|
|
|
|
**/
|
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.
|
|
|
|
**/
|
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.
|
|
|
|
**/
|
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.
|
|
|
|
* @since 5.59
|
|
|
|
* @todo Drop V5 suffix with KF6.
|
|
|
|
**/
|
|
|
|
void pointerAxisV5(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
|
|
|
|
/**
|
|
|
|
* @see pointerAxisV5
|
|
|
|
**/
|
2014-11-26 10:50:52 +00:00
|
|
|
void pointerAxis(Qt::Orientation orientation, quint32 delta);
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* @returns true if there is a pressed button with the given @p serial
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
* @since 5.28
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
**/
|
|
|
|
void endPointerSwipeGesture();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The multi-finger swipe gestures ended and got cancelled by the Wayland compositor.
|
|
|
|
* @see startPointerSwipeGesture
|
|
|
|
* @see updatePointerSwipeGesture
|
|
|
|
* @see endPointerSwipeGesture
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
void updatePointerPinchGesture(const QSizeF &delta, qreal scale, qreal rotation);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see startPointerPinchGesture
|
|
|
|
* @see updatePointerPinchGesture
|
|
|
|
* @see cancelPointerPinchGesture
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
void endPointerPinchGesture();
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see startPointerPinchGesture
|
|
|
|
* @see updatePointerPinchGesture
|
|
|
|
* @see endPointerPinchGesture
|
|
|
|
* @since 5.29
|
|
|
|
**/
|
|
|
|
void cancelPointerPinchGesture();
|
2015-09-09 15:31:13 +00:00
|
|
|
///@}
|
2014-11-25 13:24:52 +00:00
|
|
|
|
2015-09-09 15:31:13 +00:00
|
|
|
/**
|
|
|
|
* @name keyboard related methods
|
|
|
|
**/
|
|
|
|
///@{
|
2020-03-19 13:58:52 +00:00
|
|
|
#if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 69)
|
|
|
|
/**
|
|
|
|
* @deprecated since 5.69, use setKeymapData
|
|
|
|
**/
|
|
|
|
KWAYLANDSERVER_DEPRECATED_VERSION(5, 69, "Use SeatInterface::setKeymapData()")
|
2014-11-26 14:00:44 +00:00
|
|
|
void setKeymap(int fd, quint32 size);
|
2020-03-19 13:58:52 +00:00
|
|
|
#endif
|
|
|
|
/**
|
|
|
|
* Sets the xkb keymap with @p content for this Seat.
|
|
|
|
* The content gets sent to all registered KeyboardInterfaces
|
|
|
|
* @since 5.69
|
|
|
|
**/
|
|
|
|
void setKeymapData(const QByteArray &content);
|
2014-11-26 14:00:44 +00:00
|
|
|
void keyPressed(quint32 key);
|
|
|
|
void keyReleased(quint32 key);
|
|
|
|
void updateKeyboardModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
|
2015-09-02 14:00:11 +00:00
|
|
|
/**
|
|
|
|
* Sets the key repeat information to be forwarded to all bound keyboards.
|
|
|
|
*
|
|
|
|
* To disable key repeat set a @p charactersPerSecond of @c 0.
|
|
|
|
*
|
|
|
|
* Requires wl_seat version 4.
|
|
|
|
*
|
|
|
|
* @param charactersPerSecond The characters per second rate, value of @c 0 disables key repeating
|
|
|
|
* @param delay The delay on key press before starting repeating keys
|
|
|
|
*
|
|
|
|
* @since 5.5
|
|
|
|
***/
|
|
|
|
void setKeyRepeatInfo(qint32 charactersPerSecond, qint32 delay);
|
2014-11-26 14:00:44 +00:00
|
|
|
quint32 depressedModifiers() const;
|
|
|
|
quint32 latchedModifiers() const;
|
|
|
|
quint32 lockedModifiers() const;
|
|
|
|
quint32 groupModifiers() const;
|
|
|
|
quint32 lastModifiersSerial() const;
|
2020-03-19 13:58:52 +00:00
|
|
|
#if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 69)
|
|
|
|
/**
|
|
|
|
* @deprecated since 5.69
|
|
|
|
**/
|
|
|
|
int KWAYLANDSERVER_DEPRECATED keymapFileDescriptor() const;
|
|
|
|
/**
|
|
|
|
* @deprecated since 5.69
|
|
|
|
**/
|
|
|
|
quint32 KWAYLANDSERVER_DEPRECATED keymapSize() const;
|
|
|
|
#endif
|
2014-11-26 14:00:44 +00:00
|
|
|
bool isKeymapXkbCompatible() const;
|
|
|
|
QVector<quint32> pressedKeys() const;
|
2015-09-02 14:00:11 +00:00
|
|
|
/**
|
|
|
|
* @returns The key repeat in character per second
|
|
|
|
* @since 5.5
|
|
|
|
* @see setKeyRepeatInfo
|
|
|
|
* @see keyRepeatDelay
|
|
|
|
**/
|
|
|
|
qint32 keyRepeatRate() const;
|
|
|
|
/**
|
|
|
|
* @returns The delay on key press before starting repeating keys
|
|
|
|
* @since 5.5
|
|
|
|
* @see keyRepeatRate
|
|
|
|
* @see setKeyRepeatInfo
|
|
|
|
**/
|
|
|
|
qint32 keyRepeatDelay() const;
|
2014-11-26 14:00:44 +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
|
|
|
|
**/
|
2014-11-26 14:00:44 +00:00
|
|
|
void setFocusedKeyboardSurface(SurfaceInterface *surface);
|
|
|
|
SurfaceInterface *focusedKeyboardSurface() const;
|
|
|
|
KeyboardInterface *focusedKeyboard() const;
|
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
|
|
|
|
**/
|
|
|
|
///@{
|
2015-03-25 12:31:38 +00:00
|
|
|
void setFocusedTouchSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPointF());
|
|
|
|
SurfaceInterface *focusedTouchSurface() const;
|
|
|
|
TouchInterface *focusedTouch() const;
|
|
|
|
void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
|
|
|
|
QPointF focusedTouchSurfacePosition() const;
|
|
|
|
qint32 touchDown(const QPointF &globalPosition);
|
|
|
|
void touchUp(qint32 id);
|
|
|
|
void touchMove(qint32 id, const QPointF &globalPosition);
|
|
|
|
void touchFrame();
|
|
|
|
void cancelTouchSequence();
|
|
|
|
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.
|
|
|
|
* @since 5.XX
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
///@{
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* In case there is a TextInputInterface for the @p surface, the enter
|
|
|
|
* event will be triggered on the TextInputInterface for @p surface.
|
|
|
|
* The focusedTextInput will be set to that TextInputInterface. If there
|
|
|
|
* is no TextInputInterface for that @p surface, it might get updated later on.
|
|
|
|
* In both cases the signal focusedTextInputChanged will be emitted.
|
|
|
|
*
|
|
|
|
* @see focusedTextInputSurface
|
|
|
|
* @see focusedTextInput
|
|
|
|
* @see focusedTextInputChanged
|
|
|
|
* @see setFocusedKeyboardSurface
|
|
|
|
* @since 5.23
|
|
|
|
**/
|
|
|
|
void setFocusedTextInputSurface(SurfaceInterface *surface);
|
|
|
|
/**
|
|
|
|
* @returns The SurfaceInterface which is currently focused for text input.
|
|
|
|
* @see setFocusedTextInputSurface
|
|
|
|
* @since 5.23
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
* TextInputInterface.
|
|
|
|
*
|
|
|
|
* @see focusedTextInputChanged
|
|
|
|
* @see focusedTextInputSurface
|
|
|
|
* @since 5.23
|
|
|
|
**/
|
|
|
|
TextInputInterface *focusedTextInput() const;
|
|
|
|
///@}
|
|
|
|
|
2016-06-21 09:14:46 +00:00
|
|
|
/**
|
|
|
|
* @returns The DataDeviceInterface holding the current clipboard selection.
|
|
|
|
* @since 5.24
|
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
|
2016-06-21 09:14:46 +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
|
2016-06-21 09:14:46 +00:00
|
|
|
* @since 5.24
|
|
|
|
**/
|
2020-05-12 11:26:48 +00:00
|
|
|
void setSelection(AbstractDataSource *selection);
|
2016-06-21 09:14:46 +00:00
|
|
|
|
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
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
void pointerCreated(KWaylandServer::PointerInterface*);
|
|
|
|
void keyboardCreated(KWaylandServer::KeyboardInterface*);
|
|
|
|
void touchCreated(KWaylandServer::TouchInterface*);
|
2014-11-26 09:34:23 +00:00
|
|
|
|
2016-02-22 13:55:19 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the focused pointer changes
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
2020-04-29 14:56:38 +00:00
|
|
|
void focusedPointerChanged(KWaylandServer::PointerInterface*);
|
2016-02-22 13:55:19 +00:00
|
|
|
|
2019-02-06 08:23:56 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the selection changes
|
|
|
|
* @since 5.56
|
|
|
|
* @see selection
|
|
|
|
* @see setSelection
|
|
|
|
**/
|
2020-05-12 11:26:48 +00:00
|
|
|
void selectionChanged(KWaylandServer::AbstractDataSource*);
|
2019-02-06 08:23:56 +00:00
|
|
|
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* Emitted when a drag'n'drop operation is started
|
|
|
|
* @since 5.6
|
|
|
|
* @see dragEnded
|
|
|
|
**/
|
|
|
|
void dragStarted();
|
|
|
|
/**
|
|
|
|
* Emitted when a drag'n'drop operation ended, either by dropping or canceling.
|
|
|
|
* @since 5.6
|
|
|
|
* @see dragStarted
|
|
|
|
**/
|
|
|
|
void dragEnded();
|
|
|
|
/**
|
|
|
|
* Emitted whenever the drag surface for motion events changed.
|
|
|
|
* @since 5.6
|
|
|
|
* @see dragSurface
|
|
|
|
**/
|
|
|
|
void dragSurfaceChanged();
|
2016-05-02 12:28:26 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the focused text input changed.
|
|
|
|
* @see focusedTextInput
|
|
|
|
* @since 5.23
|
|
|
|
**/
|
|
|
|
void focusedTextInputChanged();
|
2016-03-01 06:49:04 +00:00
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
private:
|
|
|
|
friend class Display;
|
2014-11-27 12:38:24 +00:00
|
|
|
friend class DataDeviceManagerInterface;
|
2016-05-02 12:28:26 +00:00
|
|
|
friend class TextInputManagerUnstableV0Interface;
|
|
|
|
friend class TextInputManagerUnstableV2Interface;
|
2014-09-02 07:34:31 +00:00
|
|
|
explicit SeatInterface(Display *display, QObject *parent);
|
|
|
|
|
2014-09-18 14:35:28 +00:00
|
|
|
class Private;
|
2014-11-13 14:07:31 +00:00
|
|
|
Private *d_func() const;
|
2014-09-02 07:34:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::SeatInterface*)
|
2015-10-27 11:59:36 +00:00
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
#endif
|