Don't block Menu::showPopup() with a customized event loop

We must call Menu::showPopup() in ui::kMouseUpMessage message.
This commit is contained in:
David Capello 2014-08-09 11:13:51 -03:00
parent 67f9354b3d
commit b1b4ed8b39
2 changed files with 10 additions and 8 deletions

View File

@ -273,16 +273,22 @@ bool Tabs::onProcessMessage(Message* msg)
return true;
case kMouseDownMessage:
case kMouseUpMessage:
if (m_hot != NULL) {
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
if (m_selected != m_hot) {
m_selected = m_hot;
invalidate();
}
if (m_selected && m_delegate)
m_delegate->clickTab(this,
m_selected->view,
static_cast<MouseMessage*>(msg)->buttons());
// Left button is processed in mouse down message, right
// button is processed in mouse up.
if (m_selected && m_delegate &&
((mouseMsg->left() && msg->type() == kMouseDownMessage) ||
(!mouseMsg->left() && msg->type() == kMouseUpMessage))) {
m_delegate->clickTab(this, m_selected->view, mouseMsg->buttons());
}
}
return true;

View File

@ -270,10 +270,6 @@ bool MenuItem::hasSubmenu() const
void Menu::showPopup(int x, int y)
{
do {
jmouse_poll();
} while (jmouse_b(0) != kButtonNone);
// New window and new menu-box
Window* window = new Window(Window::WithoutTitleBar);
MenuBox* menubox = new MenuBox();