fix mouse_wheel issue on Linux
This commit is contained in:
parent
001eac9dbf
commit
f400c14f9b
@ -626,30 +626,38 @@ namespace detail
|
|||||||
if(pressed_wd_space)
|
if(pressed_wd_space)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
msgwnd = wd_manager.find_window(native_window, xevent.xbutton.x, xevent.xbutton.y);
|
||||||
|
if(nullptr == msgwnd)
|
||||||
|
break;
|
||||||
|
|
||||||
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
|
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
|
||||||
{
|
{
|
||||||
//The hovered window receives the message, unlike in Windows, no redirection is required.
|
//The hovered window receives the message, unlike in Windows, no redirection is required.
|
||||||
nana::point mspos{xevent.xbutton.x, xevent.xbutton.y};
|
auto evt_wd = msgwnd;
|
||||||
while(msgwnd)
|
while(evt_wd)
|
||||||
{
|
{
|
||||||
if(msgwnd->annex.events_ptr->mouse_wheel.length() != 0)
|
if(evt_wd->annex.events_ptr->mouse_wheel.length() != 0)
|
||||||
{
|
{
|
||||||
mspos -= msgwnd->pos_root;
|
|
||||||
arg_wheel arg;
|
arg_wheel arg;
|
||||||
arg.which = arg_wheel::wheel::vertical;
|
arg.which = arg_wheel::wheel::vertical;
|
||||||
assign_arg(arg, msgwnd, xevent);
|
assign_arg(arg, evt_wd, xevent);
|
||||||
brock.emit(event_code::mouse_wheel, msgwnd, arg, true, &context);
|
brock.emit(event_code::mouse_wheel, evt_wd, arg, true, &context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
msgwnd = msgwnd->parent;
|
evt_wd = evt_wd->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msgwnd && (nullptr == evt_wd))
|
||||||
|
{
|
||||||
|
arg_wheel arg;
|
||||||
|
arg.which = arg_wheel::wheel::vertical;
|
||||||
|
assign_arg(arg, msgwnd, xevent);
|
||||||
|
draw_invoker(&drawer::mouse_wheel, msgwnd, arg, &context);
|
||||||
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgwnd = wd_manager.find_window(native_window, xevent.xbutton.x, xevent.xbutton.y);
|
|
||||||
if(nullptr == msgwnd)
|
|
||||||
break;
|
|
||||||
|
|
||||||
msgwnd->set_action(mouse_action::normal);
|
msgwnd->set_action(mouse_action::normal);
|
||||||
if(msgwnd->flags.enabled)
|
if(msgwnd->flags.enabled)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1124,8 +1124,6 @@ namespace detail
|
|||||||
if (evt_wd->annex.events_ptr->mouse_wheel.length() != 0)
|
if (evt_wd->annex.events_ptr->mouse_wheel.length() != 0)
|
||||||
{
|
{
|
||||||
def_window_proc = false;
|
def_window_proc = false;
|
||||||
nana::point mspos{ scr_pos.x, scr_pos.y };
|
|
||||||
wd_manager.calc_window_point(evt_wd, mspos);
|
|
||||||
|
|
||||||
arg_wheel arg;
|
arg_wheel arg;
|
||||||
arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
|
arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
|
||||||
@ -1138,9 +1136,6 @@ namespace detail
|
|||||||
|
|
||||||
if (scrolled_wd && (nullptr == evt_wd))
|
if (scrolled_wd && (nullptr == evt_wd))
|
||||||
{
|
{
|
||||||
nana::point mspos{ scr_pos.x, scr_pos.y };
|
|
||||||
wd_manager.calc_window_point(scrolled_wd, mspos);
|
|
||||||
|
|
||||||
arg_wheel arg;
|
arg_wheel arg;
|
||||||
arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
|
arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
|
||||||
assign_arg(arg, scrolled_wd, pmdec);
|
assign_arg(arg, scrolled_wd, pmdec);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user