KWayland

pointer_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_POINTER_INTERFACE_H
7 #define WAYLAND_SERVER_POINTER_INTERFACE_H
8 
9 #include <KWayland/Server/kwaylandserver_export.h>
10 
11 #include "resource.h"
12 
13 namespace KWayland
14 {
15 namespace Server
16 {
17 class Cursor;
18 class PointerGesturesUnstableV1Interface;
19 class RelativePointerManagerUnstableV1Interface;
20 class SeatInterface;
21 class SurfaceInterface;
22 
23 enum class PointerAxisSource;
24 
25 /**
26  * @brief Resource for the wl_pointer interface.
27  *
28  * @see SeatInterface
29  **/
30 class KWAYLANDSERVER_EXPORT PointerInterface : public Resource
31 {
32  Q_OBJECT
33 public:
34  virtual ~PointerInterface();
35 
36  /**
37  * @returns the focused SurfaceInterface on this pointer resource, if any.
38  **/
39  SurfaceInterface *focusedSurface() const;
40 
41  /**
42  * The Cursor set on this PointerInterface. Might be @c null.
43  * @since 5.3
44  **/
45  Cursor *cursor() const;
46 
47  /**
48  * @returns The PointerInterface for the @p native resource.
49  * @since 5.28
50  **/
51  static PointerInterface *get(wl_resource *native);
52 
53 Q_SIGNALS:
54  /**
55  * Signal emitted whenever the Cursor changes.
56  **/
57  void cursorChanged();
58 
59 private:
60  void setFocusedSurface(SurfaceInterface *surface, quint32 serial);
61  void buttonPressed(quint32 button, quint32 serial);
62  void buttonReleased(quint32 button, quint32 serial);
63  void axis(Qt::Orientation orientation, qreal delta, qint32 discreteDelta, PointerAxisSource source);
64  void axis(Qt::Orientation orientation, quint32 delta);
65  void relativeMotion(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 microseconds);
66  friend class SeatInterface;
67  friend class RelativePointerManagerUnstableV1Interface;
68  friend class PointerGesturesUnstableV1Interface;
69  explicit PointerInterface(SeatInterface *parent, wl_resource *parentResource);
70  class Private;
71  Private *d_func() const;
72 };
73 
74 /**
75  * @brief Class encapsulating a Cursor image.
76  *
77  * @since 5.3
78  **/
79 class KWAYLANDSERVER_EXPORT Cursor : public QObject
80 {
81  Q_OBJECT
82 public:
83  virtual ~Cursor();
84  /**
85  * The hotspot of the cursor image in surface-relative coordinates.
86  **/
87  QPoint hotspot() const;
88  /**
89  * The entered serial when the Cursor got set.
90  **/
91  quint32 enteredSerial() const;
92  /**
93  * The PointerInterface this Cursor belongs to.
94  **/
95  PointerInterface *pointer() const;
96  /**
97  * The SurfaceInterface for the image content of the Cursor.
98  **/
99  QPointer<SurfaceInterface> surface() const;
100 
101 Q_SIGNALS:
102  void hotspotChanged();
103  void enteredSerialChanged();
104  void surfaceChanged();
105  void changed();
106 
107 private:
108  friend class PointerInterface;
109  Cursor(PointerInterface *parent);
110  class Private;
111  const QScopedPointer<Private> d;
112 };
113 
114 }
115 }
116 
117 Q_DECLARE_METATYPE(KWayland::Server::PointerInterface *)
118 
119 #endif
PointerAxisSource
Describes the source types for axis events.
Represents a Seat on the Wayland Display.
Class encapsulating a Cursor image.
Resource representing a wl_surface.
Represents a bound Resource.
Definition: resource.h:31
Orientation
Resource for the wl_pointer interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Aug 1 2021 22:50:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.