diff options
| author | vaxerski <vaxry@vaxry.net> | 2024-06-12 16:49:26 +0200 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2024-06-12 16:49:26 +0200 |
| commit | c7e85e26f761fb58db6692649e259589cdf55cf0 (patch) | |
| tree | 15a665d22fdddbc22f50ea8029578c1a31927e17 /src/protocols/core/Seat.cpp | |
| parent | 1bae19ce85ae9a25f2dddb6cee8bbd6ed3872ade (diff) | |
seat: fixup touch event handling
fixes #6353
Diffstat (limited to 'src/protocols/core/Seat.cpp')
| -rw-r--r-- | src/protocols/core/Seat.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp index 8bf03909..331eb15e 100644 --- a/src/protocols/core/Seat.cpp +++ b/src/protocols/core/Seat.cpp @@ -25,37 +25,38 @@ void CWLTouchResource::sendDown(SP<CWLSurfaceResource> surface, uint32_t timeMs, if (!owner) return; - if (currentSurface) { - LOGM(WARN, "requested CWLTouchResource::sendDown without sendUp first."); - sendUp(timeMs, id); - } - ASSERT(surface->client() == owner->client()); currentSurface = surface; listeners.destroySurface = surface->events.destroy.registerListener([this, timeMs, id](std::any d) { sendUp(timeMs + 10 /* hack */, id); }); resource->sendDown(g_pSeatManager->nextSerial(owner.lock()), timeMs, surface->getResource().get(), id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y)); + + fingers++; } void CWLTouchResource::sendUp(uint32_t timeMs, int32_t id) { - if (!owner || !currentSurface) + if (!owner) return; resource->sendUp(g_pSeatManager->nextSerial(owner.lock()), timeMs, id); - currentSurface.reset(); - listeners.destroySurface.reset(); + fingers--; + if (fingers <= 0) { + currentSurface.reset(); + listeners.destroySurface.reset(); + fingers = 0; + } } void CWLTouchResource::sendMotion(uint32_t timeMs, int32_t id, const Vector2D& local) { - if (!owner || !currentSurface) + if (!owner) return; resource->sendMotion(timeMs, id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y)); } void CWLTouchResource::sendFrame() { - if (!owner || !currentSurface) + if (!owner) return; resource->sendFrame(); |
