mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 00:23:35 +00:00
Pressing two times BrushTypeField was making its popup always visible
There was an ugly combination of events: 1. When ContextBar::BrushTypeField receives an onItemChange is because the mouse button is pressed on it (a kMouseDownMessage) 2. It shows the BrushPopup window (which is a PopupWindow with kCloseOnClickInOtherWindow click behavior) 3. When other click is made in BrushTypeField, the BrushPopup is closed because it is filtering messages (since it's kCloseOnClickInOtherWindow). This generates a kCloseMessage in the queue. 4. BrushTypeField::onItemChange() is executed again (for the same click in point 3), and it checks that the popup is closed (recently closed, by this click), so it shows the BrushPopup again. 5. The enqueued kCloseMessage is receved by PopupWindow, and it calls stopFilteringMessages(). So in this case we have a visible PopupWindow that is not filtering messages. To fix this bug we have included a startFilteringMessages() in kOpenMessage. So when the popup is shown again, it filters messages and the popup cannot stay visible.
This commit is contained in:
parent
f7465771b0
commit
cc2a5e8cc5
@ -67,6 +67,16 @@ bool PopupWindow::onProcessMessage(Message* msg)
|
||||
{
|
||||
switch (msg->type()) {
|
||||
|
||||
// There are cases where startFilteringMessages() is called when a
|
||||
// kCloseMessage for this same PopupWindow is enqueued. Processing
|
||||
// the kOpenMessage we ensure that the popup will be filtering
|
||||
// messages if it's needed when it's visible (as kCloseMessage and
|
||||
// kOpenMessage must be enqueued in the correct order).
|
||||
case kOpenMessage:
|
||||
if (!isMoveable())
|
||||
startFilteringMessages();
|
||||
break;
|
||||
|
||||
case kCloseMessage:
|
||||
stopFilteringMessages();
|
||||
break;
|
||||
@ -80,7 +90,7 @@ bool PopupWindow::onProcessMessage(Message* msg)
|
||||
if (m_filtering) {
|
||||
KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
|
||||
KeyScancode scancode = keymsg->scancode();
|
||||
|
||||
|
||||
if (scancode == kKeyEsc ||
|
||||
scancode == kKeyEnter ||
|
||||
scancode == kKeyEnterPad) {
|
||||
|
Loading…
Reference in New Issue
Block a user