Process queued events with higher priority than idle ones

In the port using wxEventLoopManual, such as wxMSW, an idle event
handler calling wxIdleEvent::RequestMore() prevented any queued events
from being handled until the next "real" event (i.e. originating from
the underlying toolkit) was received. This was unexpected and
incompatible with the behaviour of wxGTK, where queued events were still
processed immediately even when RequestMore() was being constantly
called, so change wxEventLoopManual to also give higher priority to
these events by stopping calling ProcessIdle() if a queued event is
available.

Closes #18667.
This commit is contained in:
Vadim Zeitlin
2020-02-15 18:26:09 +01:00
parent 5bc020e844
commit 08db475a7f

View File

@@ -270,7 +270,15 @@ int wxEventLoopManual::DoRun()
// generate and process idle events for as long as we don't
// have anything else to do, but stop doing this if Exit() is
// called by one of the idle handlers
while ( !m_shouldExit && !Pending() && ProcessIdle() )
//
// note that Pending() only checks for pending events from the
// underlying toolkit, but not our own pending events added by
// QueueEvent(), so we need to call HasPendingEvents() to check
// for them too
while ( !m_shouldExit
&& !Pending()
&& !(wxTheApp && wxTheApp->HasPendingEvents())
&& ProcessIdle() )
;
// if Exit() was called, don't dispatch any more events here