fix bug that mousedown/click would not triggerred
This commit is contained in:
parent
092ae97c66
commit
3d2dbf60af
@ -569,7 +569,10 @@ namespace detail
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = wd_manager.find_window(native_window, xevent.xbutton.x, xevent.xbutton.y);
|
msgwnd = wd_manager.find_window(native_window, xevent.xbutton.x, xevent.xbutton.y);
|
||||||
if(nullptr == msgwnd) break;
|
|
||||||
|
pressed_wd = nullptr;
|
||||||
|
if(nullptr == msgwnd)
|
||||||
|
break;
|
||||||
|
|
||||||
if ((msgwnd == msgwnd->root_widget->other.attribute.root->menubar) && brock.get_menu(msgwnd->root, true))
|
if ((msgwnd == msgwnd->root_widget->other.attribute.root->menubar) && brock.get_menu(msgwnd->root, true))
|
||||||
brock.erase_menu(true);
|
brock.erase_menu(true);
|
||||||
@ -578,7 +581,9 @@ namespace detail
|
|||||||
|
|
||||||
if(msgwnd->flags.enabled)
|
if(msgwnd->flags.enabled)
|
||||||
{
|
{
|
||||||
bool dbl_click = (last_mouse_down_window == msgwnd) && (xevent.xbutton.time - last_mouse_down_time <= 400);
|
pressed_wd = msgwnd;
|
||||||
|
|
||||||
|
const bool dbl_click = (last_mouse_down_window == msgwnd) && (xevent.xbutton.time - last_mouse_down_time <= 400);
|
||||||
last_mouse_down_time = xevent.xbutton.time;
|
last_mouse_down_time = xevent.xbutton.time;
|
||||||
last_mouse_down_window = msgwnd;
|
last_mouse_down_window = msgwnd;
|
||||||
|
|
||||||
@ -597,17 +602,12 @@ namespace detail
|
|||||||
auto retain = msgwnd->annex.events_ptr;
|
auto retain = msgwnd->annex.events_ptr;
|
||||||
context.event_window = msgwnd;
|
context.event_window = msgwnd;
|
||||||
|
|
||||||
pressed_wd = nullptr;
|
|
||||||
|
|
||||||
msgwnd->set_action(mouse_action::pressed);
|
msgwnd->set_action(mouse_action::pressed);
|
||||||
arg_mouse arg;
|
arg_mouse arg;
|
||||||
assign_arg(arg, msgwnd, ButtonPress, xevent);
|
assign_arg(arg, msgwnd, ButtonPress, xevent);
|
||||||
arg.evt_code = dbl_click ? event_code::dbl_click : event_code::mouse_down;
|
arg.evt_code = dbl_click ? event_code::dbl_click : event_code::mouse_down;
|
||||||
if(brock.emit(arg.evt_code, msgwnd, arg, true, &context))
|
if (brock.emit(arg.evt_code, msgwnd, arg, true, &context))
|
||||||
{
|
{
|
||||||
if (wd_manager.available(msgwnd))
|
|
||||||
{
|
|
||||||
pressed_wd = msgwnd;
|
|
||||||
//If a root window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event.
|
//If a root window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event.
|
||||||
if (msgwnd->root != native_interface::get_focus_window())
|
if (msgwnd->root != native_interface::get_focus_window())
|
||||||
{
|
{
|
||||||
@ -618,7 +618,8 @@ namespace detail
|
|||||||
wd_manager.do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
pressed_wd = nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
|
@ -919,7 +919,13 @@ namespace detail
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
|
msgwnd = wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
|
||||||
if ((nullptr == msgwnd) || (pressed_wd && (msgwnd != pressed_wd)))
|
|
||||||
|
//Don't take care about whether msgwnd is equal to the pressed_wd.
|
||||||
|
//
|
||||||
|
//pressed_wd will remains when opens a no-actived window in an mouse_down event(like combox popups the drop-list).
|
||||||
|
//After the no-actived window is closed, the window doesn't respond to the mouse click other than pressed_wd.
|
||||||
|
pressed_wd = nullptr;
|
||||||
|
if (nullptr == msgwnd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//if event on the menubar, just remove the menu if it is not associating with the menubar
|
//if event on the menubar, just remove the menu if it is not associating with the menubar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user