From 31289a8d57bca2ed86d750bad6a4ab36f26ac6f1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 24 Apr 2023 14:47:52 +0200 Subject: [PATCH] LibCore: Add a hook for custom construction of EventLoopImplementation --- Userland/Libraries/LibCore/EventLoop.cpp | 4 +++- Userland/Libraries/LibCore/EventLoop.h | 2 ++ Userland/Libraries/LibCore/EventLoopImplementationUnix.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index 6a71f584d0..c45e99f67b 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -30,8 +30,10 @@ bool has_event_loop() } } +Function()> EventLoop::make_implementation = EventLoopImplementationUnix::create; + EventLoop::EventLoop() - : m_impl(make()) + : m_impl(make_implementation()) { if (event_loop_stack().is_empty()) { event_loop_stack().append(*this); diff --git a/Userland/Libraries/LibCore/EventLoop.h b/Userland/Libraries/LibCore/EventLoop.h index fbcd32515a..759a4a6950 100644 --- a/Userland/Libraries/LibCore/EventLoop.h +++ b/Userland/Libraries/LibCore/EventLoop.h @@ -93,6 +93,8 @@ public: static EventLoop& current(); + static Function()> make_implementation; + private: void wait_for_event(WaitMode); Optional