Changeset View
Changeset View
Standalone View
Standalone View
src/server/fakeinput_interface.cpp
Context not available. | |||||
42 | void bind(wl_client *client, uint32_t version, uint32_t id) override; | 42 | void bind(wl_client *client, uint32_t version, uint32_t id) override; | ||
---|---|---|---|---|---|
43 | static void authenticateCallback(wl_client *client, wl_resource *resource, const char *application, const char *reason); | 43 | static void authenticateCallback(wl_client *client, wl_resource *resource, const char *application, const char *reason); | ||
44 | static void pointerMotionCallback(wl_client *client, wl_resource *resource, wl_fixed_t delta_x, wl_fixed_t delta_y); | 44 | static void pointerMotionCallback(wl_client *client, wl_resource *resource, wl_fixed_t delta_x, wl_fixed_t delta_y); | ||
45 | static void pointerMotionAbsoluteCallback(wl_client *client, wl_resource *resource, wl_fixed_t x, wl_fixed_t y); | ||||
45 | static void buttonCallback(wl_client *client, wl_resource *resource, uint32_t button, uint32_t state); | 46 | static void buttonCallback(wl_client *client, wl_resource *resource, uint32_t button, uint32_t state); | ||
46 | static void axisCallback(wl_client *client, wl_resource *resource, uint32_t axis, wl_fixed_t value); | 47 | static void axisCallback(wl_client *client, wl_resource *resource, uint32_t axis, wl_fixed_t value); | ||
47 | static void touchDownCallback(wl_client *client, wl_resource *resource, quint32 id, wl_fixed_t x, wl_fixed_t y); | 48 | static void touchDownCallback(wl_client *client, wl_resource *resource, quint32 id, wl_fixed_t x, wl_fixed_t y); | ||
Context not available. | |||||
49 | static void touchUpCallback(wl_client *client, wl_resource *resource, quint32 id); | 50 | static void touchUpCallback(wl_client *client, wl_resource *resource, quint32 id); | ||
50 | static void touchCancelCallback(wl_client *client, wl_resource *resource); | 51 | static void touchCancelCallback(wl_client *client, wl_resource *resource); | ||
51 | static void touchFrameCallback(wl_client *client, wl_resource *resource); | 52 | static void touchFrameCallback(wl_client *client, wl_resource *resource); | ||
53 | static void keyboardButtonCallback(wl_client *client, wl_resource *resource, const char *type, uint32_t key, uint32_t state); | ||||
52 | 54 | | |||
53 | static void unbind(wl_resource *resource); | 55 | static void unbind(wl_resource *resource); | ||
54 | static Private *cast(wl_resource *r) { | 56 | static Private *cast(wl_resource *r) { | ||
Context not available. | |||||
74 | FakeInputDevice *q; | 76 | FakeInputDevice *q; | ||
75 | }; | 77 | }; | ||
76 | 78 | | |||
77 | const quint32 FakeInputInterface::Private::s_version = 2; | 79 | const quint32 FakeInputInterface::Private::s_version = 3; | ||
78 | QList<quint32> FakeInputInterface::Private::touchIds = QList<quint32>(); | 80 | QList<quint32> FakeInputInterface::Private::touchIds = QList<quint32>(); | ||
79 | 81 | | |||
80 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | 82 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | ||
Context not available. | |||||
87 | touchMotionCallback, | 89 | touchMotionCallback, | ||
88 | touchUpCallback, | 90 | touchUpCallback, | ||
89 | touchCancelCallback, | 91 | touchCancelCallback, | ||
90 | touchFrameCallback | 92 | touchFrameCallback, | ||
93 | pointerMotionAbsoluteCallback, | ||||
94 | keyboardButtonCallback | ||||
91 | }; | 95 | }; | ||
92 | #endif | 96 | #endif | ||
93 | 97 | | |||
Context not available. | |||||
149 | emit d->pointerMotionRequested(QSizeF(wl_fixed_to_double(delta_x), wl_fixed_to_double(delta_y))); | 153 | emit d->pointerMotionRequested(QSizeF(wl_fixed_to_double(delta_x), wl_fixed_to_double(delta_y))); | ||
150 | } | 154 | } | ||
151 | 155 | | |||
156 | void FakeInputInterface::Private::pointerMotionAbsoluteCallback(wl_client *client, wl_resource *resource, wl_fixed_t x, wl_fixed_t y) | ||||
157 | { | ||||
158 | Q_UNUSED(client) | ||||
159 | FakeInputDevice *d = device(resource); | ||||
160 | if (!d || !d->isAuthenticated()) { | ||||
161 | return; | ||||
162 | } | ||||
163 | emit d->pointerMotionAbsoluteRequested(QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y))); | ||||
164 | } | ||||
165 | | ||||
166 | | ||||
152 | void FakeInputInterface::Private::axisCallback(wl_client *client, wl_resource *resource, uint32_t axis, wl_fixed_t value) | 167 | void FakeInputInterface::Private::axisCallback(wl_client *client, wl_resource *resource, uint32_t axis, wl_fixed_t value) | ||
153 | { | 168 | { | ||
154 | Q_UNUSED(client) | 169 | Q_UNUSED(client) | ||
Context not available. | |||||
253 | emit d->touchFrameRequested(); | 268 | emit d->touchFrameRequested(); | ||
254 | } | 269 | } | ||
255 | 270 | | |||
271 | void FakeInputInterface::Private::keyboardButtonCallback(wl_client *client, wl_resource *resource, const char *type, uint32_t key, uint32_t state) | ||||
272 | { | ||||
273 | Q_UNUSED(client) | ||||
274 | FakeInputDevice *d = device(resource); | ||||
275 | if (!d || !d->isAuthenticated()) { | ||||
276 | return; | ||||
277 | } | ||||
278 | | ||||
279 | if (QByteArray(type) != QByteArrayLiteral("xkb")) { | ||||
280 | return; | ||||
281 | } | ||||
282 | | ||||
283 | emit d->keyboardEvent(key, state == 0 ? true : false); | ||||
284 | | ||||
285 | } | ||||
286 | | ||||
256 | FakeInputInterface::FakeInputInterface(Display *display, QObject *parent) | 287 | FakeInputInterface::FakeInputInterface(Display *display, QObject *parent) | ||
257 | : Global(new Private(this, display), parent) | 288 | : Global(new Private(this, display), parent) | ||
258 | { | 289 | { | ||
Context not available. |