Changeset View
Changeset View
Standalone View
Standalone View
src/server/pointer_interface.cpp
Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Line(s) | 315 | { | |||
---|---|---|---|---|---|
317 | Q_ASSERT(d->focusedSurface); | 317 | Q_ASSERT(d->focusedSurface); | ||
318 | if (!d->resource) { | 318 | if (!d->resource) { | ||
319 | return; | 319 | return; | ||
320 | } | 320 | } | ||
321 | wl_pointer_send_button(d->resource, serial, d->seat->timestamp(), button, WL_POINTER_BUTTON_STATE_RELEASED); | 321 | wl_pointer_send_button(d->resource, serial, d->seat->timestamp(), button, WL_POINTER_BUTTON_STATE_RELEASED); | ||
322 | d->sendFrame(); | 322 | d->sendFrame(); | ||
323 | } | 323 | } | ||
324 | 324 | | |||
325 | void PointerInterface::axis(Qt::Orientation orientation, qreal delta, qint32 deltaDiscrete, PointerAxisSource source) | ||||
326 | { | ||||
327 | Q_D(); | ||||
328 | Q_ASSERT(d->focusedSurface); | ||||
329 | if (!d->resource) { | ||||
330 | return; | ||||
331 | } | ||||
332 | | ||||
333 | const quint32 version = wl_resource_get_version(d->resource); | ||||
334 | | ||||
335 | const auto wlOrientation = (orientation == Qt::Vertical) | ||||
336 | ? WL_POINTER_AXIS_VERTICAL_SCROLL | ||||
337 | : WL_POINTER_AXIS_HORIZONTAL_SCROLL; | ||||
338 | | ||||
339 | if (version >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION) { | ||||
340 | wl_pointer_axis_source wlSource; | ||||
341 | switch (source) { | ||||
342 | case PointerAxisSource::Wheel: | ||||
343 | wlSource = WL_POINTER_AXIS_SOURCE_WHEEL; | ||||
344 | break; | ||||
345 | case PointerAxisSource::Finger: | ||||
346 | wlSource = WL_POINTER_AXIS_SOURCE_FINGER; | ||||
347 | break; | ||||
348 | case PointerAxisSource::Continuous: | ||||
349 | wlSource = WL_POINTER_AXIS_SOURCE_CONTINUOUS; | ||||
350 | break; | ||||
351 | case PointerAxisSource::WheelTilt: | ||||
352 | wlSource = WL_POINTER_AXIS_SOURCE_WHEEL_TILT; | ||||
353 | break; | ||||
354 | default: | ||||
355 | Q_UNREACHABLE(); | ||||
356 | break; | ||||
357 | } | ||||
358 | wl_pointer_send_axis_source(d->resource, wlSource); | ||||
359 | } | ||||
360 | | ||||
361 | if (deltaDiscrete && version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) { | ||||
362 | wl_pointer_send_axis_discrete(d->resource, wlOrientation, deltaDiscrete); | ||||
363 | } | ||||
364 | | ||||
365 | if (delta != 0.0) { | ||||
366 | wl_pointer_send_axis(d->resource, d->seat->timestamp(), wlOrientation, wl_fixed_from_double(delta)); | ||||
367 | } else if (version >= WL_POINTER_AXIS_STOP_SINCE_VERSION) { | ||||
368 | wl_pointer_send_axis_stop(d->resource, d->seat->timestamp(), wlOrientation); | ||||
369 | } | ||||
370 | | ||||
371 | d->sendFrame(); | ||||
372 | } | ||||
373 | | ||||
325 | void PointerInterface::axis(Qt::Orientation orientation, quint32 delta) | 374 | void PointerInterface::axis(Qt::Orientation orientation, quint32 delta) | ||
326 | { | 375 | { | ||
327 | Q_D(); | 376 | Q_D(); | ||
328 | Q_ASSERT(d->focusedSurface); | 377 | Q_ASSERT(d->focusedSurface); | ||
329 | if (!d->resource) { | 378 | if (!d->resource) { | ||
330 | return; | 379 | return; | ||
331 | } | 380 | } | ||
332 | wl_pointer_send_axis(d->resource, d->seat->timestamp(), | 381 | wl_pointer_send_axis(d->resource, d->seat->timestamp(), | ||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |