diff options
| author | vaxerski <vaxry@vaxry.net> | 2024-12-03 21:15:25 +0000 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2024-12-03 21:15:25 +0000 |
| commit | f6ac755cf76750b8ee53389c54ef653590462c1c (patch) | |
| tree | a216ea77acaf1e1165475bac00d70b28c2e55895 /src/protocols/Tablet.cpp | |
| parent | 320144ae7288fe23686935ebb235d9fe0c900862 (diff) | |
cleanup: Revert use doLater instead of adding idle event handlers (#8624)
This reverts commit 6d7544458d0fafcae410c1978a0cabce2fb4a346.
Diffstat (limited to 'src/protocols/Tablet.cpp')
| -rw-r--r-- | src/protocols/Tablet.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp index 7768402b..d7f741b9 100644 --- a/src/protocols/Tablet.cpp +++ b/src/protocols/Tablet.cpp @@ -2,7 +2,6 @@ #include "../devices/Tablet.hpp" #include "../Compositor.hpp" #include "../managers/SeatManager.hpp" -#include "../managers/eventLoop/EventLoopManager.hpp" #include "core/Seat.hpp" #include "core/Compositor.hpp" #include <algorithm> @@ -163,6 +162,11 @@ CTabletToolV2Resource::CTabletToolV2Resource(SP<CZwpTabletToolV2> resource_, SP< }); } +CTabletToolV2Resource::~CTabletToolV2Resource() { + if (frameSource) + wl_event_source_remove(frameSource); +} + bool CTabletToolV2Resource::good() { return resource->resource(); } @@ -201,22 +205,20 @@ void CTabletToolV2Resource::sendData() { } void CTabletToolV2Resource::queueFrame() { - if (frameQueued) + if (frameSource) return; - frameQueued = true; - g_pEventLoopManager->doLater([this]() { - if (!frameQueued || tool.expired() || inert) - return; - - sendFrame(); - }); + frameSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, [](void* data) { ((CTabletToolV2Resource*)data)->sendFrame(false); }, this); } -void CTabletToolV2Resource::sendFrame() { - frameQueued = false; +void CTabletToolV2Resource::sendFrame(bool removeSource) { + if (frameSource) { + if (removeSource) + wl_event_source_remove(frameSource); + frameSource = nullptr; + } - if (!current || !resource) + if (!current) return; timespec now; |
