Minor optimization in wxGTK wxYield()
Don't call gdk_window_get_display() if we don't need it because we don't have any events to put back into the display queue.
This commit is contained in:
@@ -385,16 +385,19 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
|
|||||||
|
|
||||||
wxEventLoopBase::DoYieldFor(eventsToProcess);
|
wxEventLoopBase::DoYieldFor(eventsToProcess);
|
||||||
|
|
||||||
// put all unprocessed GDK events back in the queue
|
// put any unprocessed GDK events back in the queue
|
||||||
GdkDisplay* disp = gdk_window_get_display(wxGetTopLevelGDK());
|
if ( !m_arrGdkEvents.IsEmpty() )
|
||||||
for (size_t i=0; i<m_arrGdkEvents.GetCount(); i++)
|
|
||||||
{
|
{
|
||||||
GdkEvent* ev = (GdkEvent*)m_arrGdkEvents[i];
|
GdkDisplay* disp = gdk_window_get_display(wxGetTopLevelGDK());
|
||||||
|
for (size_t i=0; i<m_arrGdkEvents.GetCount(); i++)
|
||||||
|
{
|
||||||
|
GdkEvent* ev = (GdkEvent*)m_arrGdkEvents[i];
|
||||||
|
|
||||||
// NOTE: gdk_display_put_event makes a copy of the event passed to it
|
// NOTE: gdk_display_put_event makes a copy of the event passed to it
|
||||||
gdk_display_put_event(disp, ev);
|
gdk_display_put_event(disp, ev);
|
||||||
gdk_event_free(ev);
|
gdk_event_free(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_arrGdkEvents.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_arrGdkEvents.Clear();
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user