use GetWindow()->Refresh() in Wayland only

Some people are reporting stuttering, and @retro-wertz tested both
DrawArea() and Refresh() on wxgtk3 under xorg and found that the
Refresh() method produces more stuttering.

Change the compile check for wxgtk2 to a runtime check for wayland, and
use Refresh() under Wayland only.
This commit is contained in:
Rafael Kitover 2018-07-02 18:32:18 -07:00
parent 459a1fbebb
commit a8d0508cf2
1 changed files with 4 additions and 7 deletions

View File

@ -1817,19 +1817,16 @@ void DrawingPanelBase::DrawArea(uint8_t** data)
} }
// next, draw the frame (queue a PaintEv) Refresh must be used under // 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, // Wayland or nothing is drawn.
// so use the old method in that case if (wxGetApp().UsingWayland())
#if !defined(__WXGTK__) || defined(__WXGTK3__) GetWindow()->Refresh();
GetWindow()->Refresh(); else {
#else
{
DrawingPanelBase* panel = wxGetApp().frame->GetPanel()->panel; DrawingPanelBase* panel = wxGetApp().frame->GetPanel()->panel;
if (panel) { if (panel) {
wxClientDC dc(panel->GetWindow()); wxClientDC dc(panel->GetWindow());
panel->DrawArea(dc); panel->DrawArea(dc);
} }
} }
#endif
// finally, draw on-screen text using wx method, if possible // finally, draw on-screen text using wx method, if possible
// this method flickers too much right now // this method flickers too much right now