File indexing completed on 2024-12-08 04:57:28

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 #pragma once
0008 
0009 #include "kwin_export.h"
0010 
0011 #include <QMatrix4x4>
0012 #include <QObject>
0013 #include <QPoint>
0014 
0015 struct wl_client;
0016 struct wl_resource;
0017 
0018 namespace KWin
0019 {
0020 class AbstractDataSource;
0021 class AbstractDropHandler;
0022 class DragAndDropIcon;
0023 class DataDeviceInterface;
0024 class Display;
0025 class KeyboardInterface;
0026 class PointerInterface;
0027 class SeatInterfacePrivate;
0028 class SurfaceInterface;
0029 class TextInputV1Interface;
0030 class TextInputV2Interface;
0031 class TextInputV3Interface;
0032 class TouchInterface;
0033 class XdgToplevelDragV1Interface;
0034 
0035 /**
0036  * Describes the source types for axis events. This indicates to the
0037  * client how an axis event was physically generated; a client may
0038  * adjust the user interface accordingly. For example, scroll events
0039  * from a "finger" source may be in a smooth coordinate space with
0040  * kinetic scrolling whereas a "wheel" source may be in discrete steps
0041  * of a number of lines.
0042  *
0043  * The "continuous" axis source is a device generating events in a
0044  * continuous coordinate space, but using something other than a
0045  * finger. One example for this source is button-based scrolling where
0046  * the vertical motion of a device is converted to scroll events while
0047  * a button is held down.
0048  *
0049  * The "wheel tilt" axis source indicates that the actual device is a
0050  * wheel but the scroll event is not caused by a rotation but a
0051  * (usually sideways) tilt of the wheel.
0052  */
0053 enum class PointerAxisSource {
0054     Unknown,
0055     Wheel,
0056     Finger,
0057     Continuous,
0058     WheelTilt,
0059 };
0060 
0061 /**
0062  * Maps to wl_pointer.axis_relative_direction. Currently used for y axis only
0063  */
0064 enum class PointerAxisRelativeDirection {
0065     Normal,
0066     Inverted
0067 };
0068 
0069 /**
0070  * This enum type is used to describe the state of a pointer button. It
0071  * is equivalent to the @c wl_pointer.button_state enum.
0072  */
0073 enum class PointerButtonState : quint32 {
0074     Released = 0,
0075     Pressed = 1,
0076 };
0077 
0078 /**
0079  * This enum type is used to describe the state of a keyboard key. It is
0080  * equivalent to the @c wl_keyboard.key_state enum.
0081  */
0082 enum class KeyboardKeyState : quint32 {
0083     Released = 0,
0084     Pressed = 1,
0085 };
0086 
0087 /**
0088  * @brief Represents a Seat on the Wayland Display.
0089  *
0090  * A Seat is a set of input devices (e.g. Keyboard, Pointer and Touch) the client can connect
0091  * to. The server needs to announce which input devices are supported and passes dedicated input
0092  * focus to a SurfaceInterface. Only the focused surface receives input events.
0093  *
0094  * The SeatInterface internally handles enter and release events when setting a focused surface.
0095  * Also it handles input translation from global to the local coordination, removing the need from
0096  * the user of the API to track the focused surfaces and can just interact with this class.
0097  *
0098  * To create a SeatInterface use @link Display::createSeat @endlink. Then one can set up what is
0099  * supported. Last but not least create needs to be called.
0100  *
0101  * @code
0102  * SeatInterface *seat = display->createSeat();
0103  * // set up
0104  * seat->setName(QStringLiteral("seat0"));
0105  * seat->setHasPointer(true);
0106  * seat->setHasKeyboard(true);
0107  * seat->setHasTouch(false);
0108  * // now fully create
0109  * seat->create();
0110  * @endcode
0111  *
0112  * To forward input events one needs to set the focused surface, update time stamp and then
0113  * forward the actual events:
0114  *
0115  * @code
0116  * // example for pointer
0117  * seat->setTimestamp(100);
0118  * seat->notifyPointerEnter(surface, QPointF(350, 210), QPointF(100, 200)); // surface at it's global position
0119  * seat->notifyPointerFrame();
0120  * seat->setTimestamp(110);
0121  * seat->notifyPointerButton(Qt::LeftButton, PointerButtonState::Pressed);
0122  * seat->notifyPointerFrame();
0123  * seat->setTimestamp(120);
0124  * seat->notifyPointerButton(Qt::LeftButton, PointerButtonState::Released);
0125  * seat->notifyPointerFrame();
0126  * @endcode
0127  *
0128  * @see KeyboardInterface
0129  * @see PointerInterface
0130  * @see TouchInterface
0131  * @see SurfaceInterface
0132  */
0133 class KWIN_EXPORT SeatInterface : public QObject
0134 {
0135     Q_OBJECT
0136 public:
0137     explicit SeatInterface(Display *display, QObject *parent = nullptr);
0138     virtual ~SeatInterface();
0139 
0140     Display *display() const;
0141     QString name() const;
0142     bool hasPointer() const;
0143     bool hasKeyboard() const;
0144     bool hasTouch() const;
0145 
0146     void setName(const QString &name);
0147     void setHasPointer(bool has);
0148     void setHasKeyboard(bool has);
0149     void setHasTouch(bool has);
0150 
0151     void setTimestamp(std::chrono::microseconds time);
0152     std::chrono::milliseconds timestamp() const;
0153 
0154     /**
0155      * @name Drag'n'Drop related methods
0156      */
0157     ///@{
0158     /**
0159      * @returns whether there is currently a drag'n'drop going on.
0160      * @see isDragPointer
0161      * @see isDragTouch
0162      * @see dragStarted
0163      * @see dragEnded
0164      */
0165     bool isDrag() const;
0166     /**
0167      * @returns whether the drag'n'drop is operated through the pointer device
0168      * @see isDrag
0169      * @see isDragTouch
0170      */
0171     bool isDragPointer() const;
0172     /**
0173      * @returns whether the drag'n'drop is operated through the touch device
0174      * @see isDrag
0175      * @see isDragPointer
0176      */
0177     bool isDragTouch() const;
0178     /**
0179      * @returns The transformation applied to go from global to local coordinates for drag motion events.
0180      * @see dragSurfaceTransformation
0181      */
0182     QMatrix4x4 dragSurfaceTransformation() const;
0183     /**
0184      * @returns The currently focused Surface for drag motion events.
0185      * @see dragSurfaceTransformation
0186      * @see dragSurfaceChanged
0187      */
0188     SurfaceInterface *dragSurface() const;
0189     /**
0190      * @returns The DataDeviceInterface which started the drag and drop operation.
0191      * @see isDrag
0192      */
0193     AbstractDataSource *dragSource() const;
0194     /**
0195      * @returns the toplevel drag if the current drag is a toplevel drag
0196      */
0197     XdgToplevelDragV1Interface *xdgTopleveldrag() const;
0198 
0199     /**
0200      * Sets the current drag target to @p surface.
0201      *
0202      * Sends a drag leave event to the current target and an enter event to @p surface.
0203      * The enter position is derived from @p globalPosition and transformed by @p inputTransformation.
0204      */
0205     void setDragTarget(AbstractDropHandler *dropTarget, SurfaceInterface *surface, const QPointF &globalPosition, const QMatrix4x4 &inputTransformation);
0206     /**
0207      * Sets the current drag target to @p surface.
0208      *
0209      * Sends a drag leave event to the current target and an enter event to @p surface.
0210      * The enter position is derived from current global position and transformed by @p inputTransformation.
0211      */
0212     void setDragTarget(AbstractDropHandler *dropTarget, SurfaceInterface *surface, const QMatrix4x4 &inputTransformation = QMatrix4x4());
0213     ///@}
0214 
0215     AbstractDropHandler *dropHandlerForSurface(SurfaceInterface *surface) const;
0216 
0217     /**
0218      * If there is a current drag in progress, force it to cancel
0219      */
0220     void cancelDrag();
0221 
0222     /**
0223      * @name Pointer related methods
0224      */
0225     ///@{
0226     /**
0227      * Updates the global pointer @p pos.
0228      *
0229      * Sends a pointer motion event to the focused pointer surface.
0230      */
0231     void notifyPointerMotion(const QPointF &pos);
0232     /**
0233      * @returns the global pointer position
0234      */
0235     QPointF pointerPos() const;
0236     /**
0237      * Sets the focused pointer @p surface.
0238      * All pointer events will be sent to the @p surface till a new focused pointer surface gets
0239      * installed. When the focus pointer surface changes a leave event is sent to the previous
0240      * focused surface.
0241      *
0242      * To unset the focused pointer surface pass @c nullptr as @p surface.
0243      *
0244      * Pointer motion events are adjusted to the local position based on the @p surfacePosition.
0245      * If the surface changes it's position in the global coordinate system
0246      * use setFocusedPointerSurfacePosition to update.
0247      * The surface position is used to create the base transformation matrix to go from global
0248      * to surface local coordinates. The default generated matrix is a translation with
0249      * negative @p surfacePosition.
0250      *
0251      * @param surface The surface which should become the new focused pointer surface.
0252      * @param surfacePosition The position of the surface in the global coordinate system
0253      *
0254      * @see setPointerPos
0255      * @see focucedPointerSurface
0256      * @see focusedPointer
0257      * @see setFocusedPointerSurfacePosition
0258      * @see focusedPointerSurfacePosition
0259      * @see setFocusedPointerSurfaceTransformation
0260      * @see focusedPointerSurfaceTransformation
0261      */
0262     void notifyPointerEnter(SurfaceInterface *surface, const QPointF &position, const QPointF &surfacePosition = QPointF());
0263     /**
0264      * Sets the focused pointer @p surface.
0265      * All pointer events will be sent to the @p surface till a new focused pointer surface gets
0266      * installed. When the focus pointer surface changes a leave event is sent to the previous
0267      * focused surface.
0268      *
0269      * To unset the focused pointer surface pass @c nullptr as @p surface.
0270      *
0271      * Pointer motion events are adjusted to the local position based on the @p transformation.
0272      * If the surface changes it's position in the global coordinate system
0273      * use setFocusedPointerSurfaceTransformation to update.
0274      *
0275      * @param surface The surface which should become the new focused pointer surface.
0276      * @param transformation The transformation to transform global into local coordinates
0277      *
0278      * @see setPointerPos
0279      * @see focucedPointerSurface
0280      * @see focusedPointer
0281      * @see setFocusedPointerSurfacePosition
0282      * @see focusedPointerSurfacePosition
0283      * @see setFocusedPointerSurfaceTransformation
0284      * @see focusedPointerSurfaceTransformation
0285      */
0286     void notifyPointerEnter(SurfaceInterface *surface, const QPointF &position, const QMatrix4x4 &transformation);
0287     void notifyPointerLeave();
0288     /**
0289      * @returns The currently focused pointer surface, that is the surface receiving pointer events.
0290      * @see notifyPointerEnter
0291      * @see notifyPointerLeave
0292      */
0293     SurfaceInterface *focusedPointerSurface() const;
0294     PointerInterface *pointer() const;
0295     /**
0296      * Updates the global position of the currently focused pointer surface.
0297      *
0298      * Updating the focused surface position also generates a new transformation matrix.
0299      * The default generated matrix is a translation with negative @p surfacePosition.
0300      * If a different transformation is required a dedicated call to
0301      * @link setFocusedPointerSurfaceTransformation is required.
0302      *
0303      * @param surfacePosition The new global position of the focused pointer surface
0304      * @see focusedPointerSurface
0305      * @see focusedPointerSurfaceTransformation
0306      * @see setFocusedPointerSurfaceTransformation
0307      */
0308     void setFocusedPointerSurfacePosition(const QPointF &surfacePosition);
0309     /**
0310      * @returns The position of the focused pointer surface in global coordinates.
0311      * @see setFocusedPointerSurfacePosition
0312      * @see focusedPointerSurfaceTransformation
0313      */
0314     QPointF focusedPointerSurfacePosition() const;
0315     /**
0316      * Sets the @p transformation for going from global to local coordinates.
0317      *
0318      * The default transformation gets generated from the surface position and reset whenever
0319      * the surface position changes.
0320      *
0321      * @see focusedPointerSurfaceTransformation
0322      * @see focusedPointerSurfacePosition
0323      * @see setFocusedPointerSurfacePosition
0324      */
0325     void setFocusedPointerSurfaceTransformation(const QMatrix4x4 &transformation);
0326     /**
0327      * @returns The transformation applied to pointer position to go from global to local coordinates.
0328      * @see setFocusedPointerSurfaceTransformation
0329      */
0330     QMatrix4x4 focusedPointerSurfaceTransformation() const;
0331     /**
0332      * Marks the specified @a button as pressed or released based on @a state.
0333      */
0334     void notifyPointerButton(quint32 button, PointerButtonState state);
0335     /**
0336      * @overload
0337      */
0338     void notifyPointerButton(Qt::MouseButton button, PointerButtonState state);
0339     void notifyPointerFrame();
0340     /**
0341      * @returns whether the @p button is pressed
0342      */
0343     bool isPointerButtonPressed(quint32 button) const;
0344     /**
0345      * @returns whether the @p button is pressed
0346      */
0347     bool isPointerButtonPressed(Qt::MouseButton button) const;
0348     /**
0349      * @returns the last serial for @p button.
0350      */
0351     quint32 pointerButtonSerial(quint32 button) const;
0352     /**
0353      * @returns the last serial for @p button.
0354      */
0355     quint32 pointerButtonSerial(Qt::MouseButton button) const;
0356     /**
0357      * Sends axis events to the currently focused pointer surface.
0358      *
0359      * @param orientation The scroll axis.
0360      * @param delta The length of a vector along the specified axis @p orientation.
0361      * @param deltaV120 The high-resolution scrolling axis value.
0362      * @param source Describes how the axis event was physically generated.
0363      */
0364     void notifyPointerAxis(Qt::Orientation orientation, qreal delta, qint32 deltaV120, PointerAxisSource source, PointerAxisRelativeDirection direction = PointerAxisRelativeDirection::Normal);
0365     /**
0366      * @returns true if there is a pressed button with the given @p serial
0367      */
0368     bool hasImplicitPointerGrab(quint32 serial) const;
0369 
0370     /**
0371      * A relative motion is in the same dimension as regular motion events,
0372      * except they do not represent an absolute position. For example,
0373      * moving a pointer from (x, y) to (x', y') would have the equivalent
0374      * relative motion (x' - x, y' - y). If a pointer motion caused the
0375      * absolute pointer position to be clipped by for example the edge of the
0376      * monitor, the relative motion is unaffected by the clipping and will
0377      * represent the unclipped motion.
0378      *
0379      * This method also contains non-accelerated motion deltas (@p deltaNonAccelerated).
0380      * The non-accelerated delta is, when applicable, the regular pointer motion
0381      * delta as it was before having applied motion acceleration and other
0382      * transformations such as normalization.
0383      *
0384      * Note that the non-accelerated delta does not represent 'raw' events as
0385      * they were read from some device. Pointer motion acceleration is device-
0386      * and configuration-specific and non-accelerated deltas and accelerated
0387      * deltas may have the same value on some devices.
0388      *
0389      * Relative motions are not coupled to wl_pointer.motion events (see {@link setPointerPos},
0390      * and can be sent in combination with such events, but also independently. There may
0391      * also be scenarios where wl_pointer.motion is sent, but there is no
0392      * relative motion. The order of an absolute and relative motion event
0393      * originating from the same physical motion is not guaranteed.
0394      *
0395      * Sending relative pointer events only makes sense if the RelativePointerManagerInterface
0396      * is created on the Display.
0397      *
0398      * @param delta Motion vector
0399      * @param deltaNonAccelerated non-accelerated motion vector
0400      * @param microseconds timestamp with microseconds granularity
0401      * @see setPointerPos
0402      */
0403     void relativePointerMotion(const QPointF &delta, const QPointF &deltaNonAccelerated, std::chrono::microseconds timestamp);
0404 
0405     /**
0406      * Starts a multi-finger swipe gesture for the currently focused pointer surface.
0407      *
0408      * Such gestures are normally reported through dedicated input devices such as touchpads.
0409      *
0410      * The gesture is usually initiated by multiple fingers moving in the
0411      * same direction but once initiated the direction may change.
0412      * The precise conditions of when such a gesture is detected are
0413      * implementation-dependent.
0414      *
0415      * Only one gesture (either swipe or pinch or hold) can be active at a given time.
0416      *
0417      * @param fingerCount The number of fingers involved in this multi-finger touchpad gesture
0418      *
0419      * @see PointerGesturesInterface
0420      * @see focusedPointerSurface
0421      * @see updatePointerSwipeGesture
0422      * @see endPointerSwipeGesture
0423      * @see cancelPointerSwipeGesture
0424      * @see startPointerPinchGesture
0425      */
0426     void startPointerSwipeGesture(quint32 fingerCount);
0427 
0428     /**
0429      * The position of the logical center of the currently active multi-finger swipe gesture changes.
0430      *
0431      * @param delta coordinates are relative coordinates of the logical center of the gesture compared to the previous event.
0432      * @see startPointerSwipeGesture
0433      * @see endPointerSwipeGesture
0434      * @see cancelPointerSwipeGesture
0435      */
0436     void updatePointerSwipeGesture(const QPointF &delta);
0437 
0438     /**
0439      * The multi-finger swipe gesture ended. This may happen when one or more fingers are lifted.
0440      * @see startPointerSwipeGesture
0441      * @see updatePointerSwipeGesture
0442      * @see cancelPointerSwipeGesture
0443      * @see 5.29
0444      */
0445     void endPointerSwipeGesture();
0446 
0447     /**
0448      * The multi-finger swipe gestures ended and got cancelled by the Wayland compositor.
0449      * @see startPointerSwipeGesture
0450      * @see updatePointerSwipeGesture
0451      * @see endPointerSwipeGesture
0452      */
0453     void cancelPointerSwipeGesture();
0454 
0455     /**
0456      * Starts a multi-finch pinch gesture for the currently focused pointer surface.
0457      *
0458      * Such gestures are normally reported through dedicated input devices such as touchpads.
0459      *
0460      * The gesture is usually initiated by multiple fingers moving towards
0461      * each other or away from each other, or by two or more fingers rotating
0462      * around a logical center of gravity. The precise conditions of when
0463      * such a gesture is detected are implementation-dependent.
0464      *
0465      * Only one gesture (either swipe or pinch or hold) can be active at a given time.
0466      *
0467      * @param fingerCount The number of fingers involved in this multi-touch touchpad gesture
0468      *
0469      * @see PointerGesturesInterface
0470      * @see focusedPointerSurface
0471      * @see updatePointerPinchGesture
0472      * @see endPointerPinchGesture
0473      * @see cancelPointerPinchGesture
0474      * @see startPointerSwipeGesture
0475      */
0476     void startPointerPinchGesture(quint32 fingerCount);
0477 
0478     /**
0479      * The position of the logical center, the rotation or the relative scale of this
0480      * multi-finger pinch gesture changes.
0481      *
0482      * @param delta coordinates are relative coordinates of the logical center of the gesture compared to the previous event.
0483      * @param scale an absolute scale compared to the gesture start
0484      * @param rotation relative angle in degrees clockwise compared to the previous start of update
0485      * @see startPointerPinchGesture
0486      * @see endPointerPinchGesture
0487      * @see cancelPointerPinchGesture
0488      */
0489     void updatePointerPinchGesture(const QPointF &delta, qreal scale, qreal rotation);
0490 
0491     /**
0492      *
0493      * @see startPointerPinchGesture
0494      * @see updatePointerPinchGesture
0495      * @see cancelPointerPinchGesture
0496      */
0497     void endPointerPinchGesture();
0498 
0499     /**
0500      *
0501      * @see startPointerPinchGesture
0502      * @see updatePointerPinchGesture
0503      * @see endPointerPinchGesture
0504      */
0505     void cancelPointerPinchGesture();
0506 
0507     /**
0508      * Starts a multi-finger hold gesture for the currently focused pointer surface.
0509      *
0510      * Such gestures are normally reported through dedicated input devices such as touchpads.
0511      *
0512      * The gesture is usually initiated by multiple fingers being held down on the touchpad.
0513      * The precise conditions of when such a gesture is detected are
0514      * implementation-dependent.
0515      *
0516      * Only one gesture (either swipe or pinch or hold) can be active at a given time.
0517      *
0518      * @param fingerCount The number of fingers involved in this multi-finger touchpad gesture
0519      *
0520      * @see PointerGesturesInterface
0521      * @see focusedPointerSurface
0522      * @see endPointerHoldeGesture
0523      * @see cancelPointerHoldGesture
0524      */
0525     void startPointerHoldGesture(quint32 fingerCount);
0526 
0527     /**
0528      * The multi-finger hold gesture ended. This may happen when one or more fingers are lifted.
0529      * @see startPointerHoldGesture
0530      * @see cancelPointerHoldGesture
0531      */
0532     void endPointerHoldGesture();
0533 
0534     /**
0535      * The multi-finger swipe gestures ended and got cancelled by the Wayland compositor.
0536      * @see startPointerHoldGesture
0537      * @see endPointerHoldGesture
0538      */
0539     void cancelPointerHoldGesture();
0540     ///@}
0541 
0542     /**
0543      * Passes keyboard focus to @p surface.
0544      *
0545      * If the SeatInterface has the keyboard capability, also the focused
0546      * text input surface will be set to @p surface.
0547      *
0548      * @see focusedKeyboardSurface
0549      * @see hasKeyboard
0550      * @see setFocusedTextInputSurface
0551      */
0552     void setFocusedKeyboardSurface(SurfaceInterface *surface);
0553     SurfaceInterface *focusedKeyboardSurface() const;
0554     KeyboardInterface *keyboard() const;
0555     void notifyKeyboardKey(quint32 keyCode, KeyboardKeyState state);
0556     void notifyKeyboardModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
0557     ///@}
0558 
0559     /**
0560      * @name  touch related methods
0561      */
0562     ///@{
0563     void setFocusedTouchSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPointF());
0564     SurfaceInterface *focusedTouchSurface() const;
0565     TouchInterface *touch() const;
0566     void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
0567     QPointF focusedTouchSurfacePosition() const;
0568     void notifyTouchDown(qint32 id, const QPointF &globalPosition);
0569     void notifyTouchUp(qint32 id);
0570     void notifyTouchMotion(qint32 id, const QPointF &globalPosition);
0571     void notifyTouchFrame();
0572     void notifyTouchCancel();
0573     bool isTouchSequence() const;
0574     QPointF firstTouchPointPosition() const;
0575     /**
0576      * @returns true if there is a touch sequence going on associated with a touch
0577      * down of the given @p serial.
0578      */
0579     bool hasImplicitTouchGrab(quint32 serial) const;
0580     ///@}
0581 
0582     /**
0583      * @name Text input related methods.
0584      */
0585     ///@{
0586     /**
0587      * Passes text input focus to @p surface.
0588      *
0589      * If the SeatInterface has the keyboard capability this method will
0590      * be invoked automatically when setting the focused keyboard surface.
0591      *
0592      * In case there is a TextInputV2Interface for the @p surface, the enter
0593      * event will be triggered on the TextInputV2Interface for @p surface.
0594      * The focusedTextInput will be set to that TextInputV2Interface. If there
0595      * is no TextInputV2Interface for that @p surface, it might get updated later on.
0596      * In both cases the signal focusedTextInputChanged will be emitted.
0597      *
0598      * @see focusedTextInputSurface
0599      * @see focusedTextInput
0600      * @see focusedTextInputChanged
0601      * @see setFocusedKeyboardSurface
0602      */
0603     void setFocusedTextInputSurface(SurfaceInterface *surface);
0604     /**
0605      * @returns The SurfaceInterface which is currently focused for text input.
0606      * @see setFocusedTextInputSurface
0607      */
0608     SurfaceInterface *focusedTextInputSurface() const;
0609 
0610     TextInputV1Interface *textInputV1() const;
0611 
0612     /**
0613      * The currently focused text input, may be @c null even if there is a
0614      * focused text input surface set.
0615      *
0616      * The focused text input might not be enabled for the {@link focusedTextInputSurface}.
0617      * It is recommended to check the enabled state before interacting with the
0618      * TextInputV2Interface.
0619      *
0620      * @see focusedTextInputChanged
0621      * @see focusedTextInputSurface
0622      */
0623     TextInputV2Interface *textInputV2() const;
0624 
0625     TextInputV3Interface *textInputV3() const;
0626     ///@}
0627 
0628     /**
0629      * @returns The DataDeviceInterface holding the current clipboard selection.
0630      * @see selectionChanged
0631      * @see setSelection
0632      * This may be null
0633      */
0634     AbstractDataSource *selection() const;
0635 
0636     /**
0637      * This method allows to manually set the @p dataDevice for the current clipboard selection.
0638      * The clipboard selection is handled automatically in SeatInterface.
0639      * If a DataDeviceInterface belonging to the current focused KeyboardInterface
0640      * sets a selection, the current clipboard selection will be updated automatically.
0641      * With this method it's possible to override the automatic clipboard update for
0642      * e.g. the case of a clipboard manager.
0643      *
0644      * @param dataDevice Sets the current clipboard selection.
0645      * @see selection
0646      * @see selectionChanged
0647      */
0648     void setSelection(AbstractDataSource *selection);
0649 
0650     AbstractDataSource *primarySelection() const;
0651     void setPrimarySelection(AbstractDataSource *selection);
0652 
0653     void startDrag(AbstractDataSource *source, SurfaceInterface *sourceSurface, int dragSerial = -1, DragAndDropIcon *dragIcon = nullptr);
0654 
0655     /**
0656      * Returns the additional icon attached to the cursor during a drag-and-drop operation.
0657      * This function returns @c null if no drag-and-drop is active or no icon has been attached.
0658      */
0659     DragAndDropIcon *dragIcon() const;
0660 
0661     static SeatInterface *get(wl_resource *native);
0662 
0663 Q_SIGNALS:
0664     void nameChanged(const QString &);
0665     void hasPointerChanged(bool);
0666     void hasKeyboardChanged(bool);
0667     void hasTouchChanged(bool);
0668     void pointerPosChanged(const QPointF &pos);
0669     void touchMoved(qint32 id, quint32 serial, const QPointF &globalPosition);
0670     void timestampChanged();
0671 
0672     /**
0673      * Emitted whenever the selection changes
0674      * @see selection
0675      * @see setSelection
0676      */
0677     void selectionChanged(KWin::AbstractDataSource *);
0678 
0679     /**
0680      * Emitted whenever the primary selection changes
0681      * @see primarySelection
0682      */
0683     void primarySelectionChanged(KWin::AbstractDataSource *);
0684 
0685     /**
0686      * Emitted when a drag'n'drop operation is started
0687      * @see dragEnded
0688      */
0689     void dragStarted();
0690     /**
0691      * Emitted when a drag'n'drop operation ended, either by dropping or canceling.
0692      * @see dragStarted
0693      */
0694     void dragEnded();
0695     /**
0696      * Emitted whenever the drag surface for motion events changed.
0697      * @see dragSurface
0698      */
0699     void dragSurfaceChanged();
0700 
0701     /** Emitted when a drop ocurrs in a drag'n'drop operation. This is emitted
0702      * before dragEnded
0703      */
0704     void dragDropped();
0705     /**
0706      * Emitted whenever the focused text input changed.
0707      * @see focusedTextInput
0708      */
0709     void focusedTextInputSurfaceChanged();
0710     /**
0711      * Emitted whenever the focused keyboard is about to change.
0712      * @see focusedKeyboardSurface
0713      */
0714     void focusedKeyboardSurfaceAboutToChange(SurfaceInterface *nextSurface);
0715 
0716 private:
0717     std::unique_ptr<SeatInterfacePrivate> d;
0718     friend class SeatInterfacePrivate;
0719 };
0720 
0721 }
0722 
0723 Q_DECLARE_METATYPE(KWin::SeatInterface *)