Commit 89228b06 authored by Rafael Kitover's avatar Rafael Kitover
Browse files

fix high CPU usage under wxgtk2 #260

When using GTK2, call DrawArea(dc) instead of GetWindow()->Refresh(),
this prevents glib from using huge amounts of CPU (as discovered by
@retro-wertz .)

Switching video drivers sometimes crashes the app, the DrawArea() call
is as safe as possible, the problem is elsewhere.
parent d1603218
......@@ -1816,8 +1816,20 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
}
}
// next, draw the frame (queue a PaintEv)
// next, draw the frame (queue a PaintEv) Refresh must be used under
// Wayland or nothing is drawn, however it causes high CPU usage with GTK2,
// so use the old method in that case
#ifdef __WXGTK3__
GetWindow()->Refresh();
#else
{
DrawingPanelBase* panel = wxGetApp().frame->GetPanel()->panel;
if (panel) {
wxClientDC dc(panel->GetWindow());
panel->DrawArea(dc);
}
}
#endif
// finally, draw on-screen text using wx method, if possible
// this method flickers too much right now
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment