1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

LibGUI: Let GUI applications create an inspectable EventLoop

GUI applications automatically have EventLoops created for them via
GUI::Application; however before this commit it was not possible to make
the application event loop inspectable. This exposes a third optional
argument to GUI::Application which allows one to make the application
event loop inspectable.
This commit is contained in:
sin-ack 2021-07-25 21:02:51 +00:00 committed by Ali Mohammad Pur
parent 2e3a5b884c
commit 6162e78c7f
2 changed files with 4 additions and 3 deletions

View file

@ -68,11 +68,11 @@ Application* Application::the()
return *s_the; return *s_the;
} }
Application::Application(int argc, char** argv) Application::Application(int argc, char** argv, Core::EventLoop::MakeInspectable make_inspectable)
{ {
VERIFY(!*s_the); VERIFY(!*s_the);
*s_the = *this; *s_the = *this;
m_event_loop = make<Core::EventLoop>(); m_event_loop = make<Core::EventLoop>(make_inspectable);
WindowServerConnection::the(); WindowServerConnection::the();
Clipboard::initialize({}); Clipboard::initialize({});
if (argc > 0) if (argc > 0)

View file

@ -10,6 +10,7 @@
#include <AK/OwnPtr.h> #include <AK/OwnPtr.h>
#include <AK/String.h> #include <AK/String.h>
#include <AK/WeakPtr.h> #include <AK/WeakPtr.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Object.h> #include <LibCore/Object.h>
#include <LibGUI/Forward.h> #include <LibGUI/Forward.h>
#include <LibGUI/Shortcut.h> #include <LibGUI/Shortcut.h>
@ -79,7 +80,7 @@ public:
Function<void(Action&)> on_action_leave; Function<void(Action&)> on_action_leave;
private: private:
Application(int argc, char** argv); Application(int argc, char** argv, Core::EventLoop::MakeInspectable = Core::EventLoop::MakeInspectable::No);
virtual void event(Core::Event&) override; virtual void event(Core::Event&) override;