1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 23:05:08 +00:00

Ladybird: Process Qt event queue when polling the event loop

The logic for `EventLoopImplementationQt::pump()` caused calls to
`EventLoop::pump(PumpMode::DontWaitForEvents)` to not consume events
posted to the Qt event queue. This caused the window to be unresponsive
even when polling the event loop, if waiting was not desired.
This commit is contained in:
Zaggy1024 2023-07-11 19:55:41 -05:00 committed by Andrew Kaster
parent a8f5cf9da7
commit 6131d879f7

View file

@ -49,13 +49,11 @@ int EventLoopImplementationQt::exec()
size_t EventLoopImplementationQt::pump(PumpMode mode) size_t EventLoopImplementationQt::pump(PumpMode mode)
{ {
auto result = Core::ThreadEventQueue::current().process(); auto result = Core::ThreadEventQueue::current().process();
if (mode == PumpMode::WaitForEvents) { auto qt_mode = mode == PumpMode::WaitForEvents ? QEventLoop::WaitForMoreEvents : QEventLoop::AllEvents;
if (is_main_loop()) if (is_main_loop())
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); QCoreApplication::processEvents(qt_mode);
else else
m_event_loop.processEvents(QEventLoop::WaitForMoreEvents); m_event_loop.processEvents(qt_mode);
} else {
}
result += Core::ThreadEventQueue::current().process(); result += Core::ThreadEventQueue::current().process();
return result; return result;
} }