fix issue that mouse_up penetration in Linux

This commit is contained in:
Jinhao 2017-02-12 08:06:50 +08:00
parent 26ec27b4c4
commit a22954d8d8

View File

@ -610,14 +610,21 @@ namespace detail
{ {
//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())
{
auto pos = native_interface::cursor_position();
auto rootwd = native_interface::find_window(pos.x, pos.y);
native_interface::calc_window_point(rootwd, pos);
if(msgwnd != wd_manager.find_window(rootwd, pos.x, pos.y))
{ {
//call the drawer mouse up event for restoring the surface graphics //call the drawer mouse up event for restoring the surface graphics
msgwnd->set_action(mouse_action::normal); msgwnd->set_action(mouse_action::normal);
arg.evt_code = event_code::mouse_up;
draw_invoker(&drawer::mouse_up, msgwnd, arg, &context); draw_invoker(&drawer::mouse_up, msgwnd, arg, &context);
wd_manager.do_lazy_refresh(msgwnd, false); wd_manager.do_lazy_refresh(msgwnd, false);
} }
} }
}
else else
pressed_wd = nullptr; pressed_wd = nullptr;
} }