From 4fc95d646dbbe71744fb4e02ca0e995b652bffe5 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 18 Sep 2025 22:10:30 +0200 Subject: renderer: asynchronously load background tex (#11749) Bumps required hyprgraphics to 0.1.6 --------- Co-authored-by: Mihai Fufezan --- src/helpers/MainLoopExecutor.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/helpers/MainLoopExecutor.hpp (limited to 'src/helpers/MainLoopExecutor.hpp') diff --git a/src/helpers/MainLoopExecutor.hpp b/src/helpers/MainLoopExecutor.hpp new file mode 100644 index 00000000..b33148f0 --- /dev/null +++ b/src/helpers/MainLoopExecutor.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +class CMainLoopExecutor { + public: + /* + MainLoopExecutor + + Executes a function on the main thread once the writeFd() has some data written to it, + then destroys itself. + + Needs to be kept owned, otherwise will die and kill the fds. + */ + + CMainLoopExecutor(std::function&& callback); + ~CMainLoopExecutor(); + + // Call from your worker thread: signals to the main thread. Destroy afterwards. + void signal(); + + // do not call + void onFired(); + + private: + Hyprutils::OS::CFileDescriptor m_readFd, m_writeFd; + wl_event_source* m_event = nullptr; + std::function m_fn; +}; -- cgit v1.2.3