mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 04:53:48 -07:00
@@ -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();
|
||||
|
Reference in New Issue
Block a user