diff --git a/src/wayland/seat_interface.cpp b/src/wayland/seat_interface.cpp index 0708153e81..069151b06a 100644 --- a/src/wayland/seat_interface.cpp +++ b/src/wayland/seat_interface.cpp @@ -1081,7 +1081,7 @@ void SeatInterface::notifyTouchDown(qint32 id, const QPointF &globalPosition) if (id == 0 && hasPointer() && focusedTouchSurface()) { TouchInterfacePrivate *touchPrivate = TouchInterfacePrivate::get(d->touch.data()); - if (touchPrivate->touchesForClient(focusedTouchSurface()->client()).isEmpty()) { + if (!touchPrivate->hasTouchesForClient(focusedTouchSurface()->client())) { // If the client did not bind the touch interface fall back // to at least emulating touch through pointer events. d->pointer->sendEnter(focusedTouchSurface(), pos, serial); @@ -1117,7 +1117,7 @@ void SeatInterface::notifyTouchMotion(qint32 id, const QPointF &globalPosition) if (hasPointer() && focusedTouchSurface()) { TouchInterfacePrivate *touchPrivate = TouchInterfacePrivate::get(d->touch.data()); - if (touchPrivate->touchesForClient(focusedTouchSurface()->client()).isEmpty()) { + if (!touchPrivate->hasTouchesForClient(focusedTouchSurface()->client())) { // Client did not bind touch, fall back to emulating with pointer events. d->pointer->sendMotion(pos); d->pointer->sendFrame(); @@ -1148,7 +1148,7 @@ void SeatInterface::notifyTouchUp(qint32 id) if (id == 0 && hasPointer() && focusedTouchSurface()) { TouchInterfacePrivate *touchPrivate = TouchInterfacePrivate::get(d->touch.data()); - if (touchPrivate->touchesForClient(focusedTouchSurface()->client()).isEmpty()) { + if (!touchPrivate->hasTouchesForClient(focusedTouchSurface()->client())) { // Client did not bind touch, fall back to emulating with pointer events. const quint32 serial = display()->nextSerial(); d->pointer->sendButton(BTN_LEFT, PointerButtonState::Released, serial); diff --git a/src/wayland/touch_interface.cpp b/src/wayland/touch_interface.cpp index aaf228abe6..58f2cb4429 100644 --- a/src/wayland/touch_interface.cpp +++ b/src/wayland/touch_interface.cpp @@ -35,6 +35,11 @@ QList TouchInterfacePrivate::touchesForClient return resourceMap().values(client->client()); } +bool TouchInterfacePrivate::hasTouchesForClient(ClientConnection *client) const +{ + return resourceMap().contains(client->client()); +} + TouchInterface::TouchInterface(SeatInterface *seat) : d(new TouchInterfacePrivate(this, seat)) { diff --git a/src/wayland/touch_interface_p.h b/src/wayland/touch_interface_p.h index d352a541f2..ead40bc696 100644 --- a/src/wayland/touch_interface_p.h +++ b/src/wayland/touch_interface_p.h @@ -21,6 +21,7 @@ public: TouchInterfacePrivate(TouchInterface *q, SeatInterface *seat); QList touchesForClient(ClientConnection *client) const; + bool hasTouchesForClient(ClientConnection *client) const; TouchInterface *q; QPointer focusedSurface;