diff --git a/src/wayland/seat_interface.cpp b/src/wayland/seat_interface.cpp index 8c7810a7f8..f023f3397c 100644 --- a/src/wayland/seat_interface.cpp +++ b/src/wayland/seat_interface.cpp @@ -862,7 +862,19 @@ qint32 SeatInterface::touchDown(const QPointF &globalPosition) const quint32 serial = display()->nextSerial(); if (d->touchInterface.focus.touch && d->touchInterface.focus.surface) { d->touchInterface.focus.touch->down(id, serial, globalPosition - d->touchInterface.focus.offset); + } else if (id == 0 && focusedTouchSurface()) { + auto p = d->pointerForSurface(focusedTouchSurface()); + if (!p) { + return id; + } + const QPointF pos = globalPosition - d->touchInterface.focus.offset; + wl_pointer_send_enter(p->resource(), serial, + focusedTouchSurface()->resource(), + wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y())); + + wl_pointer_send_button(p->resource(), serial, timestamp(), BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED); } + d->touchInterface.ids << id; return id; } @@ -872,7 +884,16 @@ void SeatInterface::touchMove(qint32 id, const QPointF &globalPosition) Q_D(); if (d->touchInterface.focus.touch && d->touchInterface.focus.surface) { d->touchInterface.focus.touch->move(id, globalPosition - d->touchInterface.focus.offset); - } + } else if (id == 0 && focusedTouchSurface()) { + auto p = d->pointerForSurface(focusedTouchSurface()); + if (!p) { + return; + } + + const QPointF pos = globalPosition - d->touchInterface.focus.offset; + wl_pointer_send_motion(p->resource(), timestamp(), + wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y())); + } } void SeatInterface::touchUp(qint32 id) @@ -881,6 +902,14 @@ void SeatInterface::touchUp(qint32 id) Q_ASSERT(d->touchInterface.ids.contains(id)); if (d->touchInterface.focus.touch && d->touchInterface.focus.surface) { d->touchInterface.focus.touch->up(id, display()->nextSerial()); + } else if (id == 0 && focusedTouchSurface()) { + const quint32 serial = display()->nextSerial(); + auto p = d->pointerForSurface(focusedTouchSurface()); + if (!p) { + return; + } + + wl_pointer_send_button(p->resource(), serial, timestamp(), BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED); } d->touchInterface.ids.removeAll(id); }