KWayland

pointer.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_POINTER_H
7 #define WAYLAND_POINTER_H
8 
9 #include <QObject>
10 #include <QPoint>
11 
12 #include <KWayland/Client/kwaylandclient_export.h>
13 
14 struct wl_pointer;
15 
16 namespace KWayland
17 {
18 namespace Client
19 {
20 
21 class Surface;
22 
32 class KWAYLANDCLIENT_EXPORT Pointer : public QObject
33 {
34  Q_OBJECT
35 public:
36  enum class ButtonState {
37  Released,
38  Pressed
39  };
40  enum class Axis {
41  Vertical,
42  Horizontal
43  };
44  enum class AxisSource {
45  Wheel,
46  Finger,
47  Continuous,
48  WheelTilt
49  };
50  explicit Pointer(QObject *parent = nullptr);
51  virtual ~Pointer();
52 
56  bool isValid() const;
62  void setup(wl_pointer *pointer);
71  void release();
86  void destroy();
87 
98  void setCursor(Surface *surface, const QPoint &hotspot = QPoint());
104  void hideCursor();
105 
109  Surface *enteredSurface() const;
113  Surface *enteredSurface();
114 
115  operator wl_pointer*();
116  operator wl_pointer*() const;
117 
118 Q_SIGNALS:
129  void entered(quint32 serial, const QPointF &relativeToSurface);
137  void left(quint32 serial);
144  void motion(const QPointF &relativeToSurface, quint32 time);
155  void buttonStateChanged(quint32 serial, quint32 time, quint32 button, KWayland::Client::Pointer::ButtonState state);
163  void axisChanged(quint32 time, KWayland::Client::Pointer::Axis axis, qreal delta);
169  void axisSourceChanged(KWayland::Client::Pointer::AxisSource source);
175  void axisDiscreteChanged(KWayland::Client::Pointer::Axis axis, qint32 discreteDelta);
181  void axisStopped(quint32 time, KWayland::Client::Pointer::Axis axis);
182 
189  void frame();
190 
191 private:
192  class Private;
194 };
195 
196 }
197 }
198 
199 Q_DECLARE_METATYPE(KWayland::Client::Pointer::ButtonState)
200 Q_DECLARE_METATYPE(KWayland::Client::Pointer::Axis)
201 Q_DECLARE_METATYPE(KWayland::Client::Pointer::AxisSource)
202 
203 #endif
Wrapper for the wl_surface interface.
Definition: surface.h:44
Wrapper for the wl_pointer interface.
Definition: pointer.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:48:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.