}
break;
}
+ case QEvent::Wheel: {
+ QWheelEvent *we = static_cast<QWheelEvent *>(event);
+ input->sendMouseWheelEvent(we->orientation(), we->delta());
+ break;
+ }
case QEvent::KeyPress: {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Meta || ke->key() == Qt::Key_Super_L) {
d->sendMouseMoveEvent(wlsurface,localPos,globalPos);
}
+void WaylandInputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
+{
+ d->sendMouseWheelEvent(orientation, delta);
+}
+
void WaylandInputDevice::sendKeyPressEvent(uint code)
{
d->sendKeyPressEvent(code);
void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
void sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos = QPointF());
void sendMouseMoveEvent(WaylandSurface *surface , const QPointF &localPos, const QPointF &globalPos = QPointF());
+ void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
void sendKeyPressEvent(uint code);
void sendKeyReleaseEvent(uint code);
WaylandCompositor *compositor() const;
Wayland::InputDevice *handle() const;
+
private:
Wayland::InputDevice *d;
Q_DISABLE_COPY(WaylandInputDevice)
sendMouseMoveEvent(localPos,globalPos);
}
+void InputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
+{
+ struct wl_resource *resource = base()->pointer_focus_resource;
+ if (!resource)
+ return;
+ uint32_t time = m_compositor->currentTimeMsecs();
+ uint32_t axis = orientation == Qt::Horizontal ? WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL
+ : WL_INPUT_DEVICE_AXIS_VERTICAL_SCROLL;
+ wl_input_device_send_axis(resource, time, axis, delta);
+}
+
void InputDevice::sendKeyPressEvent(uint code)
{
if (base()->keyboard_focus_resource != NULL) {
void sendMouseReleaseEvent(Qt::MouseButton button, const QPointF &localPos, const QPointF &globalPos = QPointF());
void sendMouseMoveEvent(const QPointF &localPos, const QPointF &globalPos = QPointF());
void sendMouseMoveEvent(Surface *surface, const QPointF &localPos, const QPointF &globalPos = QPointF());
+ void sendMouseWheelEvent(Qt::Orientation orientation, int delta);
void sendKeyPressEvent(uint code);
void sendKeyReleaseEvent(uint code);
uint32_t axis,
int32_t value)
{
- Q_UNUSED(data);
Q_UNUSED(wl_input_device);
- Q_UNUSED(time);
- Q_UNUSED(axis);
- Q_UNUSED(value);
+ QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
+ QWaylandWindow *window = inputDevice->mPointerFocus;
+ Qt::Orientation orientation = axis == WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL ? Qt::Horizontal
+ : Qt::Vertical;
+ QWindowSystemInterface::handleWheelEvent(window->window(), time,
+ inputDevice->mSurfacePos,
+ inputDevice->mGlobalPos,
+ value, orientation);
}
+
#ifndef QT_NO_WAYLAND_XKB
static Qt::KeyboardModifiers translateModifiers(xkb_state *state)
{