mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
Ladybird+LibCore: Use QCoreApplication to drive the main Qt event loop
Using QEventLoop works for everything but it breaks *one* little feature that we care about: automatically quitting the app when all windows have been closed. That only works if you drive the outermost main event loop with a QCoreApplication instead of a QEventLoop. This is unfortunate, as it complicates our API a little bit, but I'm sure we can think of a way to make this nicer someday. In order for QCoreApplication::exec() to process our own ThreadEventQueue, we now have a zero-timer that we kick whenever new events are posted to the thread queue.
This commit is contained in:
parent
0f22dfa634
commit
c21eb30a2b
9 changed files with 79 additions and 25 deletions
|
@ -19,6 +19,7 @@
|
|||
namespace Core {
|
||||
|
||||
class EventLoopImplementation;
|
||||
class ThreadEventQueue;
|
||||
|
||||
// The event loop enables asynchronous (not parallel or multi-threaded) computing by efficiently handling events from various sources.
|
||||
// Event loops are most important for GUI programs, where the various GUI updates and action callbacks run on the EventLoop,
|
||||
|
@ -95,6 +96,9 @@ public:
|
|||
|
||||
static Function<NonnullOwnPtr<EventLoopImplementation>()> make_implementation;
|
||||
|
||||
void did_post_event(Badge<ThreadEventQueue>);
|
||||
EventLoopImplementation& impl() { return *m_impl; }
|
||||
|
||||
private:
|
||||
void wait_for_event(WaitMode);
|
||||
Optional<Time> get_next_timer_expiration();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue