Fix general UI delay/flickers redrawing elements

This is an old bug that makes the UI looks as "partially painted." We
have to process all logic messages first, and then generate paint
messages so we paint the latest UI state (instead of a intermediate
UI state).
This commit is contained in:
David Capello 2017-01-02 15:38:20 -03:00
parent ea71455f81
commit eb0f046dc7

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -259,9 +259,6 @@ bool Manager::generateMessages()
// Generate messages for timers
Timer::pollTimers();
// Generate redraw events.
flushRedraw();
if (!msg_queue.empty())
return true;
else
@ -612,7 +609,15 @@ void Manager::handleWindowZOrder()
void Manager::dispatchMessages()
{
// Send messages in the queue (mouse/key/timer/etc. events) This
// might change the state of widgets, etc.
pumpQueue();
// Generate and send only kPaintMessages with the latest UI state.
flushRedraw();
pumpQueue();
// Flip the back-buffer to the real display.
flipDisplay();
}