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 <QObject>
10 #include <QPoint>
11 #include <QMatrix4x4>
12 
13 #include <KWayland/Server/kwaylandserver_export.h>
14 #include "global.h"
15 #include "keyboard_interface.h"
16 #include "pointer_interface.h"
17 #include "touch_interface.h"
18 
19 struct wl_client;
20 struct wl_resource;
21 
22 namespace KWayland
23 {
24 namespace Server
25 {
26 
27 class DataDeviceInterface;
28 class Display;
29 class SurfaceInterface;
30 class TextInputInterface;
31 
52 enum class PointerAxisSource {
53  Unknown,
54  Wheel,
55  Finger,
56  Continuous,
57  WheelTilt
58 };
59 
104 class KWAYLANDSERVER_EXPORT SeatInterface : public Global
105 {
106  Q_OBJECT
110  Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
114  Q_PROPERTY(bool pointer READ hasPointer WRITE setHasPointer NOTIFY hasPointerChanged)
118  Q_PROPERTY(bool keyboard READ hasKeyboard WRITE setHasKeyboard NOTIFY hasKeyboardChanged)
123  Q_PROPERTY(bool tourch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
127  Q_PROPERTY(bool touch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
131  Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE setPointerPos NOTIFY pointerPosChanged)
135  Q_PROPERTY(quint32 timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
136 public:
137  virtual ~SeatInterface();
138 
139  QString name() const;
140  bool hasPointer() const;
141  bool hasKeyboard() const;
142  bool hasTouch() const;
143 
144  void setName(const QString &name);
145  void setHasPointer(bool has);
146  void setHasKeyboard(bool has);
147  void setHasTouch(bool has);
148 
149  void setTimestamp(quint32 time);
150  quint32 timestamp() const;
151 
155 
164  bool isDrag() const;
171  bool isDragPointer() const;
178  bool isDragTouch() const;
184  QMatrix4x4 dragSurfaceTransformation() const;
191  SurfaceInterface *dragSurface() const;
197  PointerInterface *dragPointer() const;
203  DataDeviceInterface *dragSource() const;
211  void setDragTarget(SurfaceInterface *surface, const QPointF &globalPosition, const QMatrix4x4 &inputTransformation);
219  void setDragTarget(SurfaceInterface *surface, const QMatrix4x4 &inputTransformation = QMatrix4x4());
221 
225 
231  void setPointerPos(const QPointF &pos);
235  QPointF pointerPos() const;
262  void setFocusedPointerSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPoint());
287  void setFocusedPointerSurface(SurfaceInterface *surface, const QMatrix4x4 &transformation);
292  SurfaceInterface *focusedPointerSurface() const;
297  PointerInterface *focusedPointer() const;
312  void setFocusedPointerSurfacePosition(const QPointF &surfacePosition);
319  QPointF focusedPointerSurfacePosition() const;
331  void setFocusedPointerSurfaceTransformation(const QMatrix4x4 &transformation);
337  QMatrix4x4 focusedPointerSurfaceTransformation() const;
345  void pointerButtonPressed(quint32 button);
349  void pointerButtonPressed(Qt::MouseButton button);
357  void pointerButtonReleased(quint32 button);
361  void pointerButtonReleased(Qt::MouseButton button);
365  bool isPointerButtonPressed(quint32 button) const;
369  bool isPointerButtonPressed(Qt::MouseButton button) const;
373  quint32 pointerButtonSerial(quint32 button) const;
377  quint32 pointerButtonSerial(Qt::MouseButton button) const;
388  void pointerAxisV5(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
392  void pointerAxis(Qt::Orientation orientation, quint32 delta);
397  bool hasImplicitPointerGrab(quint32 serial) const;
398 
433  void relativePointerMotion(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 microseconds);
434 
457  void startPointerSwipeGesture(quint32 fingerCount);
458 
468  void updatePointerSwipeGesture(const QSizeF &delta);
469 
477  void endPointerSwipeGesture();
478 
486  void cancelPointerSwipeGesture();
487 
510  void startPointerPinchGesture(quint32 fingerCount);
511 
524  void updatePointerPinchGesture(const QSizeF &delta, qreal scale, qreal rotation);
525 
533  void endPointerPinchGesture();
534 
542  void cancelPointerPinchGesture();
544 
548 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 69)
550 
553  KWAYLANDSERVER_DEPRECATED_VERSION(5, 69, "Use SeatInterface::setKeymapData()")
554  void setKeymap(int fd, quint32 size);
555 #endif
556 
561  void setKeymapData(const QByteArray &content);
562  void keyPressed(quint32 key);
563  void keyReleased(quint32 key);
564  void updateKeyboardModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
577  void setKeyRepeatInfo(qint32 charactersPerSecond, qint32 delay);
578  quint32 depressedModifiers() const;
579  quint32 latchedModifiers() const;
580  quint32 lockedModifiers() const;
581  quint32 groupModifiers() const;
582  quint32 lastModifiersSerial() const;
583 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 69)
584 
587  int KWAYLANDSERVER_DEPRECATED keymapFileDescriptor() const;
591  quint32 KWAYLANDSERVER_DEPRECATED keymapSize() const;
592 #endif
593  bool isKeymapXkbCompatible() const;
594  QVector<quint32> pressedKeys() const;
601  qint32 keyRepeatRate() const;
608  qint32 keyRepeatDelay() const;
609 
620  void setFocusedKeyboardSurface(SurfaceInterface *surface);
621  SurfaceInterface *focusedKeyboardSurface() const;
622  KeyboardInterface *focusedKeyboard() const;
624 
628  void setFocusedTouchSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPointF());
630  SurfaceInterface *focusedTouchSurface() const;
631  TouchInterface *focusedTouch() const;
632  void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
633  QPointF focusedTouchSurfacePosition() const;
634  qint32 touchDown(const QPointF &globalPosition);
635  void touchUp(qint32 id);
636  void touchMove(qint32 id, const QPointF &globalPosition);
637  void touchFrame();
638  void cancelTouchSequence();
639  bool isTouchSequence() const;
645  bool hasImplicitTouchGrab(quint32 serial) const;
647 
651 
670  void setFocusedTextInputSurface(SurfaceInterface *surface);
676  SurfaceInterface *focusedTextInputSurface() const;
689  TextInputInterface *focusedTextInput() const;
691 
698  DataDeviceInterface *selection() const;
712  void setSelection(DataDeviceInterface *dataDevice);
713 
714  static SeatInterface *get(wl_resource *native);
715 
716 Q_SIGNALS:
717  void nameChanged(const QString&);
718  void hasPointerChanged(bool);
719  void hasKeyboardChanged(bool);
720  void hasTouchChanged(bool);
721  void pointerPosChanged(const QPointF &pos);
722  void touchMoved(qint32 id, quint32 serial, const QPointF &globalPosition);
723  void timestampChanged(quint32);
724 
725  void pointerCreated(KWayland::Server::PointerInterface*);
726  void keyboardCreated(KWayland::Server::KeyboardInterface*);
727  void touchCreated(KWayland::Server::TouchInterface*);
728 
733  void focusedPointerChanged(KWayland::Server::PointerInterface*);
734 
741  void selectionChanged(DataDeviceInterface*);
742 
748  void dragStarted();
754  void dragEnded();
760  void dragSurfaceChanged();
766  void focusedTextInputChanged();
767 
768 private:
769  friend class Display;
770  friend class DataDeviceManagerInterface;
771  friend class TextInputManagerUnstableV0Interface;
772  friend class TextInputManagerUnstableV2Interface;
773  explicit SeatInterface(Display *display, QObject *parent);
774 
775  class Private;
776  Private *d_func() const;
777 };
778 
779 }
780 }
781 
782 Q_DECLARE_METATYPE(KWayland::Server::SeatInterface*)
783 
784 #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:89
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-2020 The KDE developers.
Generated on Thu Jul 9 2020 22:49:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.