KWayland

tablet_interface.h
1 /********************************************************************
2 Copyright 2019 Aleix Pol Gonzalez <[email protected]>
3 
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), which shall
10 act as a proxy defined in Section 6 of version 3 of the license.
11 
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
20 #ifndef WAYLAND_SERVER_TABLET_INTERFACE_H
21 #define WAYLAND_SERVER_TABLET_INTERFACE_H
22 
23 #include <KWayland/Server/kwaylandserver_export.h>
24 #include <QVector>
25 
26 #include "resource.h"
27 
28 namespace KWayland
29 {
30 namespace Server
31 {
32 class TabletSeatInterface;
33 class Display;
34 class SeatInterface;
35 class SurfaceInterface;
36 class TabletInterface;
37 class TabletCursor;
38 
48 class KWAYLANDSERVER_EXPORT TabletManagerInterface : public QObject
49 {
50  Q_OBJECT
51 public:
52  virtual ~TabletManagerInterface();
53 
54  TabletSeatInterface *seat(SeatInterface *seat) const;
55 
56 private:
57  friend class Display;
58  explicit TabletManagerInterface(Display *d, QObject *parent);
59  class Private;
61 };
62 
63 class KWAYLANDSERVER_EXPORT TabletToolInterface : public QObject
64 {
65  Q_OBJECT
66 public:
67  virtual ~TabletToolInterface();
68 
69  enum Type {
70  Pen = 0x140,
71  Eraser = 0x141,
72  Brush = 0x142,
73  Pencil = 0x143,
74  Airbrush = 0x144,
75  Finger = 0x145,
76  Mouse = 0x146,
77  Lens = 0x147,
78  Totem
79  };
80  Q_ENUM(Type)
81 
82  enum Capability {
83  Tilt = 1,
84  Pressure = 2,
85  Distance = 3,
86  Rotation = 4,
87  Slider = 5,
88  Wheel = 6
89  };
90  Q_ENUM(Capability)
91 
92 
99  void setCurrentSurface(SurfaceInterface *surface);
100  bool isClientSupported() const;
101 
102  void sendRemoved();
103  void sendProximityIn(TabletInterface *tablet);
104  void sendProximityOut();
105  void sendUp();
106  void sendDown();
107  void sendPressure(quint32 pressure);
108  void sendDistance(quint32 distance);
109  void sendTilt(qreal degreesX, qreal degreesY);
110  void sendRotation(qreal degrees);
111  void sendSlider(qint32 position);
112  void sendWheel(qint32 degrees, qint32 clicks);
113  void sendButton(quint32 button, bool pressed);
114  void sendFrame(quint32 time);
115  void sendMotion(const QPointF &pos);
116 
117 Q_SIGNALS:
118  void cursorChanged(TabletCursor* cursor) const;
119 
120 private:
121  friend class TabletSeatInterface;
122  explicit TabletToolInterface(Display *display, Type type, quint32 hsh, quint32 hsl, quint32 hih, quint32 hil, const QVector<Capability> &capability, QObject *parent);
123  class Private;
124  QScopedPointer<Private> d;
125 };
126 
127 class KWAYLANDSERVER_EXPORT TabletCursor : public QObject
128 {
129  Q_OBJECT
130 public:
131  ~TabletCursor() override;
132  QPoint hotspot() const;
133  quint32 enteredSerial() const;
134  SurfaceInterface* surface() const;
135 
136 Q_SIGNALS:
137  void changed();
138 
139 private:
140  friend class TabletToolInterface;
141  TabletCursor();
142  class Private;
143  const QScopedPointer<Private> d;
144 };
145 
146 class KWAYLANDSERVER_EXPORT TabletInterface : public QObject
147 {
148  Q_OBJECT
149 public:
150  virtual ~TabletInterface();
151 
155  bool isSurfaceSupported(SurfaceInterface *surface) const;
156 
157  void sendRemoved();
158 
159 private:
160  friend class TabletSeatInterface;
161  friend class TabletToolInterface;
162  explicit TabletInterface(quint32 vendorId, quint32 productId, const QString &name, const QStringList &paths, QObject *parent);
163  class Private;
165 };
166 
167 class KWAYLANDSERVER_EXPORT TabletSeatInterface : public QObject
168 {
169  Q_OBJECT
170 public:
171  virtual ~TabletSeatInterface();
172 
173  TabletInterface *addTablet(quint32 vendorId, quint32 productId, const QString &sysname, const QString &name, const QStringList &paths);
174  TabletToolInterface *addTool(TabletToolInterface::Type type, quint64 hardwareSerial, quint64 hardwareId, const QVector<TabletToolInterface::Capability> &capabilities);
175 
176  TabletToolInterface *toolByHardwareId(quint64 hardwareId) const;
177  TabletToolInterface *toolByHardwareSerial(quint64 hardwareSerial) const;
178  TabletInterface *tabletByName(const QString &sysname) const;
179 
180  void removeTablet(const QString &sysname);
181 
182 private:
183  friend class TabletManagerInterface;
184  explicit TabletSeatInterface(Display *display, QObject *parent);
185  class Private;
187 };
188 
189 }
190 }
191 
192 Q_DECLARE_METATYPE(KWayland::Server::TabletSeatInterface *)
193 
194 #endif
This is an implementation of wayland-protocols/unstable/tablet/tablet-unstable-v2.xml.
Class holding the Wayland server display loop.
Definition: display.h:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:48:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.