1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

Ladybird: Run the Core::EventLoop with a Qt backend

This patch adds EventLoopImplementationQt which is a full replacement
for the Core::EventLoopImplementationUnix that uses Qt's event loop
as a backend instead.

This means that Core::Timer, Core::Notifier, and Core::Event delivery
are all driven by Qt primitives in the Ladybird UI and WC processes.
This commit is contained in:
Andreas Kling 2023-04-24 14:51:19 +02:00
parent 31289a8d57
commit 3494c2382d
6 changed files with 201 additions and 10 deletions

View file

@ -5,6 +5,7 @@
*/
#include "BrowserWindow.h"
#include "EventLoopImplementationQt.h"
#include "HelperProcess.h"
#include "Settings.h"
#include "Utilities.h"
@ -51,14 +52,13 @@ static ErrorOr<void> handle_attached_debugger()
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
// NOTE: This is only used for the Core::Socket inside the IPC connections.
// FIXME: Refactor things so we can get rid of this somehow.
QApplication app(arguments.argc, arguments.argv);
Core::EventLoop::make_implementation = Ladybird::EventLoopImplementationQt::create;
Core::EventLoop event_loop;
TRY(handle_attached_debugger());
QApplication app(arguments.argc, arguments.argv);
platform_init();
// NOTE: We only instantiate this to ensure that Gfx::FontDatabase has its default queries initialized.
@ -110,5 +110,5 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window.view().load(TRY(get_formatted_url(home_url.bytes_as_string_view())));
}
return app.exec();
return event_loop.exec();
}