Changeset View
Changeset View
Standalone View
Standalone View
src/server/fakeinput_interface.cpp
Show All 36 Lines | |||||
37 | public: | 37 | public: | ||
38 | Private(FakeInputInterface *q, Display *d); | 38 | Private(FakeInputInterface *q, Display *d); | ||
39 | QList<FakeInputDevice*> devices; | 39 | QList<FakeInputDevice*> devices; | ||
40 | 40 | | |||
41 | private: | 41 | private: | ||
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); | ||
48 | static void touchMotionCallback(wl_client *client, wl_resource *resource, quint32 id, wl_fixed_t x, wl_fixed_t y); | 49 | static void touchMotionCallback(wl_client *client, wl_resource *resource, quint32 id, wl_fixed_t x, wl_fixed_t y); | ||
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); | ||
52 | 53 | | |||
Show All 23 Lines | |||||
76 | 77 | | |||
77 | const quint32 FakeInputInterface::Private::s_version = 2; | 78 | const quint32 FakeInputInterface::Private::s_version = 2; | ||
78 | QList<quint32> FakeInputInterface::Private::touchIds = QList<quint32>(); | 79 | QList<quint32> FakeInputInterface::Private::touchIds = QList<quint32>(); | ||
79 | 80 | | |||
80 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | 81 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | ||
81 | const struct org_kde_kwin_fake_input_interface FakeInputInterface::Private::s_interface = { | 82 | const struct org_kde_kwin_fake_input_interface FakeInputInterface::Private::s_interface = { | ||
82 | authenticateCallback, | 83 | authenticateCallback, | ||
83 | pointerMotionCallback, | 84 | pointerMotionCallback, | ||
84 | buttonCallback, | 85 | buttonCallback, | ||
graesslin: Must be last, new requests only at end. | |||||
85 | axisCallback, | 86 | axisCallback, | ||
86 | touchDownCallback, | 87 | touchDownCallback, | ||
87 | touchMotionCallback, | 88 | touchMotionCallback, | ||
88 | touchUpCallback, | 89 | touchUpCallback, | ||
89 | touchCancelCallback, | 90 | touchCancelCallback, | ||
90 | touchFrameCallback | 91 | touchFrameCallback, | ||
92 | pointerMotionAbsoluteCallback | ||||
91 | }; | 93 | }; | ||
92 | #endif | 94 | #endif | ||
93 | 95 | | |||
94 | FakeInputInterface::Private::Private(FakeInputInterface *q, Display *d) | 96 | FakeInputInterface::Private::Private(FakeInputInterface *q, Display *d) | ||
95 | : Global::Private(d, &org_kde_kwin_fake_input_interface, s_version) | 97 | : Global::Private(d, &org_kde_kwin_fake_input_interface, s_version) | ||
96 | , q(q) | 98 | , q(q) | ||
97 | { | 99 | { | ||
98 | } | 100 | } | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 145 | { | |||
144 | Q_UNUSED(client) | 146 | Q_UNUSED(client) | ||
145 | FakeInputDevice *d = device(resource); | 147 | FakeInputDevice *d = device(resource); | ||
146 | if (!d || !d->isAuthenticated()) { | 148 | if (!d || !d->isAuthenticated()) { | ||
147 | return; | 149 | return; | ||
148 | } | 150 | } | ||
149 | emit d->pointerMotionRequested(QSizeF(wl_fixed_to_double(delta_x), wl_fixed_to_double(delta_y))); | 151 | emit d->pointerMotionRequested(QSizeF(wl_fixed_to_double(delta_x), wl_fixed_to_double(delta_y))); | ||
150 | } | 152 | } | ||
151 | 153 | | |||
154 | void FakeInputInterface::Private::pointerMotionAbsoluteCallback(wl_client *client, wl_resource *resource, wl_fixed_t x, wl_fixed_t y) | ||||
155 | { | ||||
156 | Q_UNUSED(client) | ||||
157 | FakeInputDevice *d = device(resource); | ||||
158 | if (!d || !d->isAuthenticated()) { | ||||
159 | return; | ||||
160 | } | ||||
161 | emit d->pointerMotionAbsoluteRequested(QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y))); | ||||
162 | } | ||||
163 | | ||||
164 | | ||||
zzag: Please delete one extra empty line. | |||||
152 | void FakeInputInterface::Private::axisCallback(wl_client *client, wl_resource *resource, uint32_t axis, wl_fixed_t value) | 165 | void FakeInputInterface::Private::axisCallback(wl_client *client, wl_resource *resource, uint32_t axis, wl_fixed_t value) | ||
153 | { | 166 | { | ||
154 | Q_UNUSED(client) | 167 | Q_UNUSED(client) | ||
155 | FakeInputDevice *d = device(resource); | 168 | FakeInputDevice *d = device(resource); | ||
156 | if (!d || !d->isAuthenticated()) { | 169 | if (!d || !d->isAuthenticated()) { | ||
157 | return; | 170 | return; | ||
158 | } | 171 | } | ||
159 | Qt::Orientation orientation; | 172 | Qt::Orientation orientation; | ||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |
Must be last, new requests only at end.