Discard enqueued kWinMoveMessage messages (fix #1006)

When we're moving or resizing a window, sending several
kWinMoveMessage doesn't make sense. So we discard all kWinMoveMessage
and re-enqueue a new one with the latest window bounds.
This commit is contained in:
David Capello 2018-08-16 15:40:53 -03:00
parent 9c032013f2
commit b5ace78bdf

View File

@ -592,9 +592,11 @@ void Window::moveWindow(const gfx::Rect& rect, bool use_blit)
#define FLAGS (DrawableRegionFlags)(kCutTopWindows | kUseChildArea)
Manager* manager = this->manager();
Message* msg;
manager->dispatchMessages();
// Discard enqueued kWinMoveMessage for this window because we are
// going to send a new kWinMoveMessage with the latest window
// bounds.
manager->removeMessagesFor(this, kWinMoveMessage);
// Get the window's current position
Rect old_pos = bounds();
@ -605,7 +607,7 @@ void Window::moveWindow(const gfx::Rect& rect, bool use_blit)
Rect man_pos = manager->bounds();
// Send a kWinMoveMessage message to the window
msg = new Message(kWinMoveMessage);
Message* msg = new Message(kWinMoveMessage);
msg->addRecipient(this);
manager->enqueueMessage(msg);