From cee677b1f73b56db8aaeb9225d0035deb8ac18b2 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 8 Jan 2024 19:13:47 +0100 Subject: [PATCH] libui: Make App::process_events() private Previously this was public as some applications (mainly terminal) needed to run some code in-between events, but this is no longer needed, due to the EventLoop providing these services (timers and file descriptor notifiers) --- libui/include/ui/App.h | 6 ++++-- libui/src/App.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libui/include/ui/App.h b/libui/include/ui/App.h index 5f44683b..a20be946 100644 --- a/libui/include/ui/App.h +++ b/libui/include/ui/App.h @@ -53,8 +53,6 @@ namespace ui Result handle_ipc_event(u8 id); - bool process_events(); - static App& the(); private: @@ -65,6 +63,10 @@ namespace ui bool m_should_close { false }; os::EventLoop m_loop; + bool process_events(); + Window* find_window(int id); + + friend void handle_socket_event(int, int); }; } diff --git a/libui/src/App.cpp b/libui/src/App.cpp index fd3e9f3d..da3c9fd8 100644 --- a/libui/src/App.cpp +++ b/libui/src/App.cpp @@ -19,14 +19,14 @@ Result handle_ipc_client_event(os::LocalClient&, u8 id) return ui::App::the().handle_ipc_event(id); } -void handle_socket_event(int, int status) -{ - if (status & POLLHUP) ui::App::the().set_should_close(true); - if (status & POLLIN) { ui::App::the().process_events(); } -} - namespace ui { + void handle_socket_event(int, int status) + { + if (status & POLLHUP) ui::App::the().set_should_close(true); + if (status & POLLIN) { ui::App::the().process_events(); } + } + App* App::s_app { nullptr }; App::App()