Changeset View
Changeset View
Standalone View
Standalone View
src/client/pointer.cpp
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Line(s) | |||||
178 | { | 178 | { | ||
179 | auto p = reinterpret_cast<Pointer::Private*>(data); | 179 | auto p = reinterpret_cast<Pointer::Private*>(data); | ||
180 | Q_ASSERT(p->pointer == pointer); | 180 | Q_ASSERT(p->pointer == pointer); | ||
181 | emit p->q->frame(); | 181 | emit p->q->frame(); | ||
182 | } | 182 | } | ||
183 | 183 | | |||
184 | void Pointer::Private::axisSourceCallback(void *data, wl_pointer *pointer, uint32_t axis_source) | 184 | void Pointer::Private::axisSourceCallback(void *data, wl_pointer *pointer, uint32_t axis_source) | ||
185 | { | 185 | { | ||
186 | Q_UNUSED(data) | 186 | auto p = reinterpret_cast<Pointer::Private*>(data); | ||
187 | Q_UNUSED(pointer) | 187 | Q_ASSERT(p->pointer == pointer); | ||
188 | Q_UNUSED(axis_source) | 188 | AxisSource source; | ||
189 | // TODO: implement | 189 | switch (axis_source) { | ||
190 | case WL_POINTER_AXIS_SOURCE_WHEEL: | ||||
191 | source = AxisSource::Wheel; | ||||
192 | break; | ||||
193 | case WL_POINTER_AXIS_SOURCE_FINGER: | ||||
194 | source = AxisSource::Finger; | ||||
195 | break; | ||||
196 | case WL_POINTER_AXIS_SOURCE_CONTINUOUS: | ||||
197 | source = AxisSource::Continuous; | ||||
198 | break; | ||||
199 | case WL_POINTER_AXIS_SOURCE_WHEEL_TILT: | ||||
200 | source = AxisSource::WheelTilt; | ||||
201 | break; | ||||
202 | default: | ||||
203 | Q_UNREACHABLE(); | ||||
204 | break; | ||||
205 | } | ||||
206 | emit p->q->axisSourceChanged(source); | ||||
190 | } | 207 | } | ||
191 | 208 | | |||
192 | void Pointer::Private::axisStopCallback(void *data, wl_pointer *pointer, uint32_t time, uint32_t axis) | 209 | void Pointer::Private::axisStopCallback(void *data, wl_pointer *pointer, uint32_t time, uint32_t axis) | ||
193 | { | 210 | { | ||
194 | Q_UNUSED(data) | 211 | auto p = reinterpret_cast<Pointer::Private*>(data); | ||
195 | Q_UNUSED(pointer) | 212 | Q_ASSERT(p->pointer == pointer); | ||
196 | Q_UNUSED(time) | 213 | const auto axis_ = (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) | ||
197 | Q_UNUSED(axis) | 214 | ? Axis::Horizontal | ||
198 | // TODO: implement | 215 | : Axis::Vertical; | ||
216 | emit p->q->axisStopped(time, axis_); | ||||
199 | } | 217 | } | ||
200 | 218 | | |||
201 | void Pointer::Private::axisDiscreteCallback(void *data, wl_pointer *pointer, uint32_t axis, int32_t discrete) | 219 | void Pointer::Private::axisDiscreteCallback(void *data, wl_pointer *pointer, uint32_t axis, int32_t discrete) | ||
202 | { | 220 | { | ||
203 | Q_UNUSED(data) | 221 | auto p = reinterpret_cast<Pointer::Private*>(data); | ||
204 | Q_UNUSED(pointer) | 222 | Q_ASSERT(p->pointer == pointer); | ||
205 | Q_UNUSED(axis) | 223 | const auto axis_ = (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) | ||
206 | Q_UNUSED(discrete) | 224 | ? Axis::Horizontal | ||
207 | // TODO: implement | 225 | : Axis::Vertical; | ||
226 | emit p->q->axisDiscreteChanged(axis_, discrete); | ||||
208 | } | 227 | } | ||
209 | 228 | | |||
210 | void Pointer::setCursor(Surface *surface, const QPoint &hotspot) | 229 | void Pointer::setCursor(Surface *surface, const QPoint &hotspot) | ||
211 | { | 230 | { | ||
212 | Q_ASSERT(isValid()); | 231 | Q_ASSERT(isValid()); | ||
213 | wl_surface *s = nullptr; | 232 | wl_surface *s = nullptr; | ||
214 | if (surface) { | 233 | if (surface) { | ||
215 | s = *surface; | 234 | s = *surface; | ||
Show All 36 Lines |