Quellcode durchsuchen

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.
sin-ack vor 4 Jahren
Ursprung
Commit
6162e78c7f

+ 2 - 2
Userland/Libraries/LibGUI/Application.cpp

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

+ 2 - 1
Userland/Libraries/LibGUI/Application.h

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