fix mouse left button issues due to breaking changes

This commit is contained in:
Jinhao
2015-07-28 00:00:15 +08:00
parent 5dd5d110d7
commit 396163c1b7
13 changed files with 93 additions and 72 deletions

View File

@@ -754,23 +754,26 @@ namespace nana
API::register_menu_window(this->handle(), !owner_menubar);
}
events().destroy.connect_unignorable([this]{
auto & events = this->events();
events.destroy.connect_unignorable([this]{
_m_destroy();
});
events().key_press.connect_unignorable([this](const arg_keyboard& arg){
events.key_press.connect_unignorable([this](const arg_keyboard& arg){
_m_key_down(arg);
});
events().mouse_down.connect_unignorable([this](const arg_mouse& arg)
auto fn = [this](const arg_mouse& arg)
{
this->_m_open_sub(0); //Try to open submenu immediately
});
if (event_code::mouse_down == arg.evt_code)
_m_open_sub(0); //Try to open submenu immediately
else if (event_code::mouse_up == arg.evt_code)
if (arg.button == ::nana::mouse::left_button)
pick();
};
events().mouse_up.connect_unignorable([this](const arg_mouse& arg){
if (arg.left_button)
pick();
});
events.mouse_down.connect_unignorable(fn);
events.mouse_up.connect_unignorable(fn);
timer_.interval(100);
timer_.elapse([this]{
@@ -782,7 +785,7 @@ namespace nana
if (want_focus_)
{
event_focus_ = events().focus.connect_unignorable([this](const arg_focus& arg)
event_focus_ = events.focus.connect_unignorable([this](const arg_focus& arg)
{
//when the focus of the menu window is losing, close the menu.
//But here is not every menu window may have focus event installed,