Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
dacap committed Jan 2, 2017
1 parent ea71455 commit eb0f046
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/ui/manager.cpp
@@ -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.
Expand Down Expand Up @@ -259,9 +259,6 @@ bool Manager::generateMessages()
// Generate messages for timers
Timer::pollTimers();

// Generate redraw events.
flushRedraw();

if (!msg_queue.empty())
return true;
else
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit eb0f046

Please sign in to comment.