KWayland

seat_interface.h
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef WAYLAND_SERVER_SEAT_INTERFACE_H
7 #define WAYLAND_SERVER_SEAT_INTERFACE_H
8 
9 #include <QMatrix4x4>
10 #include <QObject>
11 #include <QPoint>
12 
13 #include "global.h"
14 #include "keyboard_interface.h"
15 #include "pointer_interface.h"
16 #include "touch_interface.h"
17 #include <KWayland/Server/kwaylandserver_export.h>
18 
19 struct wl_client;
20 struct wl_resource;
21 
22 namespace KWayland
23 {
24 namespace Server
25 {
26 class DataDeviceInterface;
27 class Display;
28 class SurfaceInterface;
29 class TextInputInterface;
30 
31 /**
32  * Describes the source types for axis events. This indicates to the
33  * client how an axis event was physically generated; a client may
34  * adjust the user interface accordingly. For example, scroll events
35  * from a "finger" source may be in a smooth coordinate space with
36  * kinetic scrolling whereas a "wheel" source may be in discrete steps
37  * of a number of lines.
38  *
39  * The "continuous" axis source is a device generating events in a
40  * continuous coordinate space, but using something other than a
41  * finger. One example for this source is button-based scrolling where
42  * the vertical motion of a device is converted to scroll events while
43  * a button is held down.
44  *
45  * The "wheel tilt" axis source indicates that the actual device is a
46  * wheel but the scroll event is not caused by a rotation but a
47  * (usually sideways) tilt of the wheel.
48  *
49  * @since 5.59
50  **/
51 enum class PointerAxisSource {
52  Unknown,
53  Wheel,
54  Finger,
55  Continuous,
56  WheelTilt,
57 };
58 
59 /**
60  * @brief Represents a Seat on the Wayland Display.
61  *
62  * A Seat is a set of input devices (e.g. Keyboard, Pointer and Touch) the client can connect
63  * to. The server needs to announce which input devices are supported and passes dedicated input
64  * focus to a SurfaceInterface. Only the focused surface receives input events.
65  *
66  * The SeatInterface internally handles enter and release events when setting a focused surface.
67  * Also it handles input translation from global to the local coordination, removing the need from
68  * the user of the API to track the focused surfaces and can just interact with this class.
69  *
70  * To create a SeatInterface use @link Display::createSeat @endlink. Then one can set up what is
71  * supported. Last but not least create needs to be called.
72  *
73  * @code
74  * SeatInterface *seat = display->createSeat();
75  * // set up
76  * seat->setName(QStringLiteral("seat0"));
77  * seat->setHasPointer(true);
78  * seat->setHasKeyboard(true);
79  * seat->setHasTouch(false);
80  * // now fully create
81  * seat->create();
82  * @endcode
83  *
84  * To forward input events one needs to set the focused surface, update time stamp and then
85  * forward the actual events:
86  *
87  * @code
88  * // example for pointer
89  * seat->setFocusedPointerSurface(surface, QPointF(100, 200)); // surface at it's global position
90  * seat->setTimestamp(100);
91  * seat->setPointerPos(QPointF(350, 210)); // global pos, local pos in surface: 250,10
92  * seat->setTimestamp(110);
93  * seat->pointerButtonPressed(Qt::LeftButton);
94  * seat->setTimestamp(120);
95  * seat->pointerButtonReleased(Qt::LeftButton);
96  * @endcode
97  *
98  * @see KeyboardInterface
99  * @see PointerInterface
100  * @see TouchInterface
101  * @see SurfaceInterface
102  **/
103 class KWAYLANDSERVER_EXPORT SeatInterface : public Global
104 {
105  Q_OBJECT
106  /**
107  * The name of the Seat
108  **/
109  Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
110  /**
111  * Whether the SeatInterface supports a pointer device.
112  **/
113  Q_PROPERTY(bool pointer READ hasPointer WRITE setHasPointer NOTIFY hasPointerChanged)
114  /**
115  * Whether the SeatInterface supports a keyboard device.
116  **/
117  Q_PROPERTY(bool keyboard READ hasKeyboard WRITE setHasKeyboard NOTIFY hasKeyboardChanged)
118  /**
119  * Whether the SeatInterface supports a touch device.
120  * @deprecated Since 5.5, use touch
121  **/
122  Q_PROPERTY(bool tourch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
123  /**
124  * Whether the SeatInterface supports a touch device.
125  **/
126  Q_PROPERTY(bool touch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
127  /**
128  * The global pointer position.
129  **/
130  Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE setPointerPos NOTIFY pointerPosChanged)
131  /**
132  * The current timestamp passed to the input events.
133  **/
134  Q_PROPERTY(quint32 timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
135 public:
136  virtual ~SeatInterface();
137 
138  QString name() const;
139  bool hasPointer() const;
140  bool hasKeyboard() const;
141  bool hasTouch() const;
142 
143  void setName(const QString &name);
144  void setHasPointer(bool has);
145  void setHasKeyboard(bool has);
146  void setHasTouch(bool has);
147 
148  void setTimestamp(quint32 time);
149  quint32 timestamp() const;
150 
151  /**
152  * @name Drag'n'Drop related methods
153  **/
154  ///@{
155  /**
156  * @returns whether there is currently a drag'n'drop going on.
157  * @since 5.6
158  * @see isDragPointer
159  * @see isDragTouch
160  * @see dragStarted
161  * @see dragEnded
162  **/
163  bool isDrag() const;
164  /**
165  * @returns whether the drag'n'drop is operated through the pointer device
166  * @since 5.6
167  * @see isDrag
168  * @see isDragTouch
169  **/
170  bool isDragPointer() const;
171  /**
172  * @returns whether the drag'n'drop is operated through the touch device
173  * @since 5.6
174  * @see isDrag
175  * @see isDragPointer
176  **/
177  bool isDragTouch() const;
178  /**
179  * @returns The transformation applied to go from global to local coordinates for drag motion events.
180  * @see dragSurfaceTransformation
181  * @since 5.6
182  **/
183  QMatrix4x4 dragSurfaceTransformation() const;
184  /**
185  * @returns The currently focused Surface for drag motion events.
186  * @since 5.6
187  * @see dragSurfaceTransformation
188  * @see dragSurfaceChanged
189  **/
190  SurfaceInterface *dragSurface() const;
191  /**
192  * @returns The PointerInterface which triggered the drag operation
193  * @since 5.6
194  * @see isDragPointer
195  **/
196  PointerInterface *dragPointer() const;
197  /**
198  * @returns The DataDeviceInterface which started the drag and drop operation.
199  * @see isDrag
200  * @since 5.6
201  **/
202  DataDeviceInterface *dragSource() const;
203  /**
204  * Sets the current drag target to @p surface.
205  *
206  * Sends a drag leave event to the current target and an enter event to @p surface.
207  * The enter position is derived from @p globalPosition and transformed by @p inputTransformation.
208  * @since 5.6
209  **/
210  void setDragTarget(SurfaceInterface *surface, const QPointF &globalPosition, const QMatrix4x4 &inputTransformation);
211  /**
212  * Sets the current drag target to @p surface.
213  *
214  * Sends a drag leave event to the current target and an enter event to @p surface.
215  * The enter position is derived from current global position and transformed by @p inputTransformation.
216  * @since 5.6
217  **/
218  void setDragTarget(SurfaceInterface *surface, const QMatrix4x4 &inputTransformation = QMatrix4x4());
219  ///@}
220 
221  /**
222  * @name Pointer related methods
223  **/
224  ///@{
225  /**
226  * Updates the global pointer @p pos.
227  *
228  * Sends a pointer motion event to the focused pointer surface.
229  **/
230  void setPointerPos(const QPointF &pos);
231  /**
232  * @returns the global pointer position
233  **/
234  QPointF pointerPos() const;
235  /**
236  * Sets the focused pointer @p surface.
237  * All pointer events will be sent to the @p surface till a new focused pointer surface gets
238  * installed. When the focus pointer surface changes a leave event is sent to the previous
239  * focused surface.
240  *
241  * To unset the focused pointer surface pass @c nullptr as @p surface.
242  *
243  * Pointer motion events are adjusted to the local position based on the @p surfacePosition.
244  * If the surface changes it's position in the global coordinate system
245  * use setFocusedPointerSurfacePosition to update.
246  * The surface position is used to create the base transformation matrix to go from global
247  * to surface local coordinates. The default generated matrix is a translation with
248  * negative @p surfacePosition.
249  *
250  * @param surface The surface which should become the new focused pointer surface.
251  * @param surfacePosition The position of the surface in the global coordinate system
252  *
253  * @see setPointerPos
254  * @see focucedPointerSurface
255  * @see focusedPointer
256  * @see setFocusedPointerSurfacePosition
257  * @see focusedPointerSurfacePosition
258  * @see setFocusedPointerSurfaceTransformation
259  * @see focusedPointerSurfaceTransformation
260  **/
261  void setFocusedPointerSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPoint());
262  /**
263  * Sets the focused pointer @p surface.
264  * All pointer events will be sent to the @p surface till a new focused pointer surface gets
265  * installed. When the focus pointer surface changes a leave event is sent to the previous
266  * focused surface.
267  *
268  * To unset the focused pointer surface pass @c nullptr as @p surface.
269  *
270  * Pointer motion events are adjusted to the local position based on the @p transformation.
271  * If the surface changes it's position in the global coordinate system
272  * use setFocusedPointerSurfaceTransformation to update.
273  *
274  * @param surface The surface which should become the new focused pointer surface.
275  * @param transformation The transformation to transform global into local coordinates
276  *
277  * @see setPointerPos
278  * @see focucedPointerSurface
279  * @see focusedPointer
280  * @see setFocusedPointerSurfacePosition
281  * @see focusedPointerSurfacePosition
282  * @see setFocusedPointerSurfaceTransformation
283  * @see focusedPointerSurfaceTransformation
284  * @since 5.6
285  **/
286  void setFocusedPointerSurface(SurfaceInterface *surface, const QMatrix4x4 &transformation);
287  /**
288  * @returns The currently focused pointer surface, that is the surface receiving pointer events.
289  * @see setFocusedPointerSurface
290  **/
291  SurfaceInterface *focusedPointerSurface() const;
292  /**
293  * @returns The PointerInterface belonging to the focused pointer surface, if any.
294  * @see setFocusedPointerSurface
295  **/
296  PointerInterface *focusedPointer() const;
297  /**
298  * Updates the global position of the currently focused pointer surface.
299  *
300  * Updating the focused surface position also generates a new transformation matrix.
301  * The default generated matrix is a translation with negative @p surfacePosition.
302  * If a different transformation is required a dedicated call to
303  * @link setFocusedPointerSurfaceTransformation is required.
304  *
305  * @param surfacePosition The new global position of the focused pointer surface
306  * @see focusedPointerSurface
307  * @see setFocusedPointerSurface
308  * @see focusedPointerSurfaceTransformation
309  * @see setFocusedPointerSurfaceTransformation
310  **/
311  void setFocusedPointerSurfacePosition(const QPointF &surfacePosition);
312  /**
313  * @returns The position of the focused pointer surface in global coordinates.
314  * @see setFocusedPointerSurfacePosition
315  * @see setFocusedPointerSurface
316  * @see focusedPointerSurfaceTransformation
317  **/
318  QPointF focusedPointerSurfacePosition() const;
319  /**
320  * Sets the @p transformation for going from global to local coordinates.
321  *
322  * The default transformation gets generated from the surface position and reset whenever
323  * the surface position changes.
324  *
325  * @see focusedPointerSurfaceTransformation
326  * @see focusedPointerSurfacePosition
327  * @see setFocusedPointerSurfacePosition
328  * @since 5.6
329  **/
330  void setFocusedPointerSurfaceTransformation(const QMatrix4x4 &transformation);
331  /**
332  * @returns The transformation applied to pointer position to go from global to local coordinates.
333  * @see setFocusedPointerSurfaceTransformation
334  * @since 5.6
335  **/
336  QMatrix4x4 focusedPointerSurfaceTransformation() const;
337  /**
338  * Marks the @p button as pressed.
339  *
340  * If there is a focused pointer surface a button pressed event is sent to it.
341  *
342  * @param button The Linux button code
343  **/
344  void pointerButtonPressed(quint32 button);
345  /**
346  * @overload
347  **/
348  void pointerButtonPressed(Qt::MouseButton button);
349  /**
350  * Marks the @p button as released.
351  *
352  * If there is a focused pointer surface a button release event is sent to it.
353  *
354  * @param button The Linux button code
355  **/
356  void pointerButtonReleased(quint32 button);
357  /**
358  * @overload
359  **/
360  void pointerButtonReleased(Qt::MouseButton button);
361  /**
362  * @returns whether the @p button is pressed
363  **/
364  bool isPointerButtonPressed(quint32 button) const;
365  /**
366  * @returns whether the @p button is pressed
367  **/
368  bool isPointerButtonPressed(Qt::MouseButton button) const;
369  /**
370  * @returns the last serial for @p button.
371  **/
372  quint32 pointerButtonSerial(quint32 button) const;
373  /**
374  * @returns the last serial for @p button.
375  **/
376  quint32 pointerButtonSerial(Qt::MouseButton button) const;
377  /**
378  * Sends axis events to the currently focused pointer surface.
379  *
380  * @param orientation The scroll axis.
381  * @param delta The length of a vector along the specified axis @p orientation.
382  * @param discreteDelta The number of discrete steps, e.g. mouse wheel clicks.
383  * @param source Describes how the axis event was physically generated.
384  * @since 5.59
385  * @todo Drop V5 suffix with KF6.
386  **/
387  void pointerAxisV5(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
388  /**
389  * @see pointerAxisV5
390  **/
391  void pointerAxis(Qt::Orientation orientation, quint32 delta);
392  /**
393  * @returns true if there is a pressed button with the given @p serial
394  * @since 5.6
395  **/
396  bool hasImplicitPointerGrab(quint32 serial) const;
397 
398  /**
399  * A relative motion is in the same dimension as regular motion events,
400  * except they do not represent an absolute position. For example,
401  * moving a pointer from (x, y) to (x', y') would have the equivalent
402  * relative motion (x' - x, y' - y). If a pointer motion caused the
403  * absolute pointer position to be clipped by for example the edge of the
404  * monitor, the relative motion is unaffected by the clipping and will
405  * represent the unclipped motion.
406  *
407  * This method also contains non-accelerated motion deltas (@p deltaNonAccelerated).
408  * The non-accelerated delta is, when applicable, the regular pointer motion
409  * delta as it was before having applied motion acceleration and other
410  * transformations such as normalization.
411  *
412  * Note that the non-accelerated delta does not represent 'raw' events as
413  * they were read from some device. Pointer motion acceleration is device-
414  * and configuration-specific and non-accelerated deltas and accelerated
415  * deltas may have the same value on some devices.
416  *
417  * Relative motions are not coupled to wl_pointer.motion events (see {@link setPointerPos},
418  * and can be sent in combination with such events, but also independently. There may
419  * also be scenarios where wl_pointer.motion is sent, but there is no
420  * relative motion. The order of an absolute and relative motion event
421  * originating from the same physical motion is not guaranteed.
422  *
423  * Sending relative pointer events only makes sense if the RelativePointerManagerInterface
424  * is created on the Display.
425  *
426  * @param delta Motion vector
427  * @param deltaNonAccelerated non-accelerated motion vector
428  * @param microseconds timestamp with microseconds granularity
429  * @see setPointerPos
430  * @since 5.28
431  **/
432  void relativePointerMotion(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 microseconds);
433 
434  /**
435  * Starts a multi-finger swipe gesture for the currently focused pointer surface.
436  *
437  * Such gestures are normally reported through dedicated input devices such as touchpads.
438  *
439  * The gesture is usually initiated by multiple fingers moving in the
440  * same direction but once initiated the direction may change.
441  * The precise conditions of when such a gesture is detected are
442  * implementation-dependent.
443  *
444  * Only one gesture (either swipe or pinch) can be active at a given time.
445  *
446  * @param fingerCount The number of fingers involved in this multi-finger touchpad gesture
447  *
448  * @see PointerGesturesInterface
449  * @see focusedPointerSurface
450  * @see updatePointerSwipeGesture
451  * @see endPointerSwipeGesture
452  * @see cancelPointerSwipeGesture
453  * @see startPointerPinchGesture
454  * @since 5.29
455  **/
456  void startPointerSwipeGesture(quint32 fingerCount);
457 
458  /**
459  * The position of the logical center of the currently active multi-finger swipe gesture changes.
460  *
461  * @param delta coordinates are relative coordinates of the logical center of the gesture compared to the previous event.
462  * @see startPointerSwipeGesture
463  * @see endPointerSwipeGesture
464  * @see cancelPointerSwipeGesture
465  * @since 5.29
466  **/
467  void updatePointerSwipeGesture(const QSizeF &delta);
468 
469  /**
470  * The multi-finger swipe gesture ended. This may happen when one or more fingers are lifted.
471  * @see startPointerSwipeGesture
472  * @see updatePointerSwipeGesture
473  * @see cancelPointerSwipeGesture
474  * @see 5.29
475  **/
476  void endPointerSwipeGesture();
477 
478  /**
479  * The multi-finger swipe gestures ended and got cancelled by the Wayland compositor.
480  * @see startPointerSwipeGesture
481  * @see updatePointerSwipeGesture
482  * @see endPointerSwipeGesture
483  * @since 5.29
484  **/
485  void cancelPointerSwipeGesture();
486 
487  /**
488  * Starts a multi-finch pinch gesture for the currently focused pointer surface.
489  *
490  * Such gestures are normally reported through dedicated input devices such as touchpads.
491  *
492  * The gesture is usually initiated by multiple fingers moving towards
493  * each other or away from each other, or by two or more fingers rotating
494  * around a logical center of gravity. The precise conditions of when
495  * such a gesture is detected are implementation-dependent.
496  *
497  * Only one gesture (either swipe or pinch) can be active at a given time.
498  *
499  * @param fingerCount The number of fingers involved in this multi-touch touchpad gesture
500  *
501  * @see PointerGesturesInterface
502  * @see focusedPointerSurface
503  * @see updatePointerPinchGesture
504  * @see endPointerPinchGesture
505  * @see cancelPointerPinchGesture
506  * @see startPointerSwipeGesture
507  * @since 5.29
508  **/
509  void startPointerPinchGesture(quint32 fingerCount);
510 
511  /**
512  * The position of the logical center, the rotation or the relative scale of this
513  * multi-finger pinch gesture changes.
514  *
515  * @param delta coordinates are relative coordinates of the logical center of the gesture compared to the previous event.
516  * @param scale an absolute scale compared to the gesture start
517  * @param rotation relative angle in degrees clockwise compared to the previous start of update
518  * @see startPointerPinchGesture
519  * @see endPointerPinchGesture
520  * @see cancelPointerPinchGesture
521  * @since 5.29
522  **/
523  void updatePointerPinchGesture(const QSizeF &delta, qreal scale, qreal rotation);
524 
525  /**
526  *
527  * @see startPointerPinchGesture
528  * @see updatePointerPinchGesture
529  * @see cancelPointerPinchGesture
530  * @since 5.29
531  **/
532  void endPointerPinchGesture();
533 
534  /**
535  *
536  * @see startPointerPinchGesture
537  * @see updatePointerPinchGesture
538  * @see endPointerPinchGesture
539  * @since 5.29
540  **/
541  void cancelPointerPinchGesture();
542  ///@}
543 
544  /**
545  * @name keyboard related methods
546  **/
547  ///@{
548 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 69)
549  /**
550  * @deprecated since 5.69, use setKeymapData
551  **/
552  KWAYLANDSERVER_DEPRECATED_VERSION(5, 69, "Use SeatInterface::setKeymapData()")
553  void setKeymap(int fd, quint32 size);
554 #endif
555  /**
556  * Sets the xkb keymap with @p content for this Seat.
557  * The content gets sent to all registered KeyboardInterfaces
558  * @since 5.69
559  **/
560  void setKeymapData(const QByteArray &content);
561  void keyPressed(quint32 key);
562  void keyReleased(quint32 key);
563  void updateKeyboardModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
564  /**
565  * Sets the key repeat information to be forwarded to all bound keyboards.
566  *
567  * To disable key repeat set a @p charactersPerSecond of @c 0.
568  *
569  * Requires wl_seat version 4.
570  *
571  * @param charactersPerSecond The characters per second rate, value of @c 0 disables key repeating
572  * @param delay The delay on key press before starting repeating keys
573  *
574  * @since 5.5
575  ***/
576  void setKeyRepeatInfo(qint32 charactersPerSecond, qint32 delay);
577  quint32 depressedModifiers() const;
578  quint32 latchedModifiers() const;
579  quint32 lockedModifiers() const;
580  quint32 groupModifiers() const;
581  quint32 lastModifiersSerial() const;
582 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 69)
583  /**
584  * @deprecated since 5.69
585  **/
586  int KWAYLANDSERVER_DEPRECATED keymapFileDescriptor() const;
587  /**
588  * @deprecated since 5.69
589  **/
590  quint32 KWAYLANDSERVER_DEPRECATED keymapSize() const;
591 #endif
592  bool isKeymapXkbCompatible() const;
593  QVector<quint32> pressedKeys() const;
594  /**
595  * @returns The key repeat in character per second
596  * @since 5.5
597  * @see setKeyRepeatInfo
598  * @see keyRepeatDelay
599  **/
600  qint32 keyRepeatRate() const;
601  /**
602  * @returns The delay on key press before starting repeating keys
603  * @since 5.5
604  * @see keyRepeatRate
605  * @see setKeyRepeatInfo
606  **/
607  qint32 keyRepeatDelay() const;
608 
609  /**
610  * Passes keyboard focus to @p surface.
611  *
612  * If the SeatInterface has the keyboard capability, also the focused
613  * text input surface will be set to @p surface.
614  *
615  * @see focusedKeyboardSurface
616  * @see hasKeyboard
617  * @see setFocusedTextInputSurface
618  **/
619  void setFocusedKeyboardSurface(SurfaceInterface *surface);
620  SurfaceInterface *focusedKeyboardSurface() const;
621  KeyboardInterface *focusedKeyboard() const;
622  ///@}
623 
624  /**
625  * @name touch related methods
626  **/
627  ///@{
628  void setFocusedTouchSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPointF());
629  SurfaceInterface *focusedTouchSurface() const;
630  TouchInterface *focusedTouch() const;
631  void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
632  QPointF focusedTouchSurfacePosition() const;
633  qint32 touchDown(const QPointF &globalPosition);
634  void touchUp(qint32 id);
635  void touchMove(qint32 id, const QPointF &globalPosition);
636  void touchFrame();
637  void cancelTouchSequence();
638  bool isTouchSequence() const;
639  /**
640  * @returns true if there is a touch sequence going on associated with a touch
641  * down of the given @p serial.
642  * @since 5.XX
643  **/
644  bool hasImplicitTouchGrab(quint32 serial) const;
645  ///@}
646 
647  /**
648  * @name Text input related methods.
649  **/
650  ///@{
651  /**
652  * Passes text input focus to @p surface.
653  *
654  * If the SeatInterface has the keyboard capability this method will
655  * be invoked automatically when setting the focused keyboard surface.
656  *
657  * In case there is a TextInputInterface for the @p surface, the enter
658  * event will be triggered on the TextInputInterface for @p surface.
659  * The focusedTextInput will be set to that TextInputInterface. If there
660  * is no TextInputInterface for that @p surface, it might get updated later on.
661  * In both cases the signal focusedTextInputChanged will be emitted.
662  *
663  * @see focusedTextInputSurface
664  * @see focusedTextInput
665  * @see focusedTextInputChanged
666  * @see setFocusedKeyboardSurface
667  * @since 5.23
668  **/
669  void setFocusedTextInputSurface(SurfaceInterface *surface);
670  /**
671  * @returns The SurfaceInterface which is currently focused for text input.
672  * @see setFocusedTextInputSurface
673  * @since 5.23
674  **/
675  SurfaceInterface *focusedTextInputSurface() const;
676  /**
677  * The currently focused text input, may be @c null even if there is a
678  * focused text input surface set.
679  *
680  * The focused text input might not be enabled for the {@link focusedTextInputSurface}.
681  * It is recommended to check the enabled state before interacting with the
682  * TextInputInterface.
683  *
684  * @see focusedTextInputChanged
685  * @see focusedTextInputSurface
686  * @since 5.23
687  **/
688  TextInputInterface *focusedTextInput() const;
689  ///@}
690 
691  /**
692  * @returns The DataDeviceInterface holding the current clipboard selection.
693  * @since 5.24
694  * @see selectionChanged
695  * @see setSelection
696  **/
697  DataDeviceInterface *selection() const;
698  /**
699  * This method allows to manually set the @p dataDevice for the current clipboard selection.
700  * The clipboard selection is handled automatically in SeatInterface.
701  * If a DataDeviceInterface belonging to the current focused KeyboardInterface
702  * sets a selection, the current clipboard selection will be updated automatically.
703  * With this method it's possible to override the automatic clipboard update for
704  * e.g. the case of a clipboard manager.
705  *
706  * @param dataDevice Sets the current clipboard selection.
707  * @see selection
708  * @see selectionChanged
709  * @since 5.24
710  **/
711  void setSelection(DataDeviceInterface *dataDevice);
712 
713  static SeatInterface *get(wl_resource *native);
714 
715 Q_SIGNALS:
716  void nameChanged(const QString &);
717  void hasPointerChanged(bool);
718  void hasKeyboardChanged(bool);
719  void hasTouchChanged(bool);
720  void pointerPosChanged(const QPointF &pos);
721  void touchMoved(qint32 id, quint32 serial, const QPointF &globalPosition);
722  void timestampChanged(quint32);
723 
724  void pointerCreated(KWayland::Server::PointerInterface *);
725  void keyboardCreated(KWayland::Server::KeyboardInterface *);
726  void touchCreated(KWayland::Server::TouchInterface *);
727 
728  /**
729  * Emitted whenever the focused pointer changes
730  * @since 5.6
731  **/
732  void focusedPointerChanged(KWayland::Server::PointerInterface *);
733 
734  /**
735  * Emitted whenever the selection changes
736  * @since 5.56
737  * @see selection
738  * @see setSelection
739  **/
740  void selectionChanged(DataDeviceInterface *);
741 
742  /**
743  * Emitted when a drag'n'drop operation is started
744  * @since 5.6
745  * @see dragEnded
746  **/
747  void dragStarted();
748  /**
749  * Emitted when a drag'n'drop operation ended, either by dropping or canceling.
750  * @since 5.6
751  * @see dragStarted
752  **/
753  void dragEnded();
754  /**
755  * Emitted whenever the drag surface for motion events changed.
756  * @since 5.6
757  * @see dragSurface
758  **/
759  void dragSurfaceChanged();
760  /**
761  * Emitted whenever the focused text input changed.
762  * @see focusedTextInput
763  * @since 5.23
764  **/
765  void focusedTextInputChanged();
766 
767 private:
768  friend class Display;
769  friend class DataDeviceManagerInterface;
770  friend class TextInputManagerUnstableV0Interface;
771  friend class TextInputManagerUnstableV2Interface;
772  explicit SeatInterface(Display *display, QObject *parent);
773 
774  class Private;
775  Private *d_func() const;
776 };
777 
778 }
779 }
780 
781 Q_DECLARE_METATYPE(KWayland::Server::SeatInterface *)
782 
783 #endif
PointerAxisSource
Describes the source types for axis events.
DataDeviceInterface allows clients to share data by copy-and-paste and drag-and-drop.
Resource for the wl_keyboard interface.
Represents the Global for wl_data_device_manager interface.
Represents a generic Resource for a text input object.
Represents a Seat on the Wayland Display.
Resource representing a wl_surface.
Class holding the Wayland server display loop.
Definition: display.h:86
Resource for the wl_touch interface.
Base class for all Globals.
Definition: global.h:46
Resource for the wl_pointer interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:51:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.