minor changes
This commit is contained in:
parent
2b5593a8ac
commit
ea06295975
@ -647,7 +647,8 @@ namespace detail
|
|||||||
static core_window_t* last_mouse_down_window;
|
static core_window_t* last_mouse_down_window;
|
||||||
|
|
||||||
auto native_window = reinterpret_cast<native_window_type>(event_window(xevent));
|
auto native_window = reinterpret_cast<native_window_type>(event_window(xevent));
|
||||||
auto root_runtime = brock.wd_manager().root_runtime(native_window);
|
auto & wd_manager = brock.wd_manager();
|
||||||
|
auto root_runtime = wd_manager.root_runtime(native_window);
|
||||||
|
|
||||||
if(root_runtime)
|
if(root_runtime)
|
||||||
{
|
{
|
||||||
@ -667,7 +668,7 @@ namespace detail
|
|||||||
if(pressed_wd_space)
|
if(pressed_wd_space)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = brock.wd_manager().find_window(native_window, xevent.xcrossing.x, xevent.xcrossing.y);
|
msgwnd = wd_manager.find_window(native_window, xevent.xcrossing.x, xevent.xcrossing.y);
|
||||||
if(msgwnd)
|
if(msgwnd)
|
||||||
{
|
{
|
||||||
if (mouse_action::pressed != msgwnd->flags.action)
|
if (mouse_action::pressed != msgwnd->flags.action)
|
||||||
@ -681,7 +682,7 @@ namespace detail
|
|||||||
arg.evt_code = event_code::mouse_move;
|
arg.evt_code = event_code::mouse_move;
|
||||||
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
|
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
|
||||||
|
|
||||||
if (!brock.wd_manager().available(hovered_wd))
|
if (!wd_manager.available(hovered_wd))
|
||||||
hovered_wd = nullptr;
|
hovered_wd = nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -701,7 +702,7 @@ namespace detail
|
|||||||
arg.receiver = native_window;
|
arg.receiver = native_window;
|
||||||
arg.getting = true;
|
arg.getting = true;
|
||||||
if(!brock.emit(event_code::focus, focus, arg, true, &context))
|
if(!brock.emit(event_code::focus, focus, arg, true, &context))
|
||||||
brock.wd_manager().set_focus(msgwnd, true);
|
wd_manager.set_focus(msgwnd, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
@ -727,7 +728,7 @@ namespace detail
|
|||||||
if(msgwnd->dimension.width != static_cast<unsigned>(xevent.xconfigure.width) || msgwnd->dimension.height != static_cast<unsigned>(xevent.xconfigure.height))
|
if(msgwnd->dimension.width != static_cast<unsigned>(xevent.xconfigure.width) || msgwnd->dimension.height != static_cast<unsigned>(xevent.xconfigure.height))
|
||||||
{
|
{
|
||||||
auto & cf = xevent.xconfigure;
|
auto & cf = xevent.xconfigure;
|
||||||
brock.wd_manager().size(msgwnd, nana::size{static_cast<unsigned>(cf.width), static_cast<unsigned>(cf.height)}, true, true);
|
wd_manager.size(msgwnd, nana::size{static_cast<unsigned>(cf.width), static_cast<unsigned>(cf.height)}, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msgwnd->pos_native.x != xevent.xconfigure.x || msgwnd->pos_native.y != xevent.xconfigure.y)
|
if(msgwnd->pos_native.x != xevent.xconfigure.x || msgwnd->pos_native.y != xevent.xconfigure.y)
|
||||||
@ -745,7 +746,7 @@ namespace detail
|
|||||||
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
|
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = brock.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;
|
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))
|
||||||
@ -765,9 +766,9 @@ namespace detail
|
|||||||
if (new_focus && !new_focus->flags.ignore_mouse_focus)
|
if (new_focus && !new_focus->flags.ignore_mouse_focus)
|
||||||
{
|
{
|
||||||
context.event_window = new_focus;
|
context.event_window = new_focus;
|
||||||
auto kill_focus = brock.wd_manager().set_focus(new_focus, false);
|
auto kill_focus = wd_manager.set_focus(new_focus, false);
|
||||||
if (kill_focus != new_focus)
|
if (kill_focus != new_focus)
|
||||||
brock.wd_manager().do_lazy_refresh(kill_focus, false);
|
wd_manager.do_lazy_refresh(kill_focus, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,7 +782,7 @@ namespace detail
|
|||||||
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 (brock.wd_manager().available(msgwnd))
|
if (wd_manager.available(msgwnd))
|
||||||
{
|
{
|
||||||
pressed_wd = 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.
|
||||||
@ -790,7 +791,7 @@ namespace detail
|
|||||||
//call the drawer mouse up event for restoring the surface graphics
|
//call the drawer mouse up event for restoring the surface graphics
|
||||||
msgwnd->flags.action = mouse_action::normal;
|
msgwnd->flags.action = mouse_action::normal;
|
||||||
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -821,7 +822,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgwnd = brock.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)
|
if(nullptr == msgwnd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -852,7 +853,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Do mouse_up, this handle may be closed by click handler.
|
//Do mouse_up, this handle may be closed by click handler.
|
||||||
if(brock.wd_manager().available(msgwnd) && msgwnd->flags.enabled)
|
if(wd_manager.available(msgwnd) && msgwnd->flags.enabled)
|
||||||
{
|
{
|
||||||
if(hit)
|
if(hit)
|
||||||
msgwnd->flags.action = mouse_action::over;
|
msgwnd->flags.action = mouse_action::over;
|
||||||
@ -866,7 +867,7 @@ namespace detail
|
|||||||
if(click_arg.window_handle)
|
if(click_arg.window_handle)
|
||||||
evt_ptr->click.emit(click_arg);
|
evt_ptr->click.emit(click_arg);
|
||||||
|
|
||||||
if (brock.wd_manager().available(msgwnd))
|
if (wd_manager.available(msgwnd))
|
||||||
{
|
{
|
||||||
arg.evt_code = event_code::mouse_up;
|
arg.evt_code = event_code::mouse_up;
|
||||||
evt_ptr->mouse_up.emit(arg);
|
evt_ptr->mouse_up.emit(arg);
|
||||||
@ -875,29 +876,27 @@ namespace detail
|
|||||||
else if(click_arg.window_handle)
|
else if(click_arg.window_handle)
|
||||||
msgwnd->together.events_ptr->click.emit(click_arg);
|
msgwnd->together.events_ptr->click.emit(click_arg);
|
||||||
|
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
pressed_wd = nullptr;
|
pressed_wd = nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
|
if(wd_manager.available(msgwnd))
|
||||||
{
|
{
|
||||||
auto & spec = nana::detail::platform_spec::instance();
|
//The msgwnd may be destroyed if the window is destroyed by calling native interface of close_window().
|
||||||
if(brock.wd_manager().available(msgwnd))
|
if (msgwnd->root == brock.get_menu())
|
||||||
{
|
{
|
||||||
//The msgwnd may be destroyed if the window is destroyed by calling native interface of close_window().
|
brock.erase_menu(false);
|
||||||
if (msgwnd->root == brock.get_menu())
|
brock.delay_restore(3); //Restores if delay_restore not decleared
|
||||||
{
|
|
||||||
brock.erase_menu(false);
|
|
||||||
brock.delay_restore(3); //Restores if delay_restore not decleared
|
|
||||||
}
|
|
||||||
|
|
||||||
spec.remove(native_window);
|
|
||||||
brock.wd_manager().destroy(msgwnd);
|
|
||||||
|
|
||||||
brock.manage_form_loader(msgwnd, false);
|
|
||||||
brock.wd_manager().destroy_handle(msgwnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto & spec = ::nana::detail::platform_spec::instance();
|
||||||
|
spec.remove(native_window);
|
||||||
|
wd_manager.destroy(msgwnd);
|
||||||
|
|
||||||
|
brock.manage_form_loader(msgwnd, false);
|
||||||
|
wd_manager.destroy_handle(msgwnd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
@ -915,8 +914,8 @@ namespace detail
|
|||||||
if(pressed_wd_space)
|
if(pressed_wd_space)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = brock.wd_manager().find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
|
msgwnd = wd_manager.find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
|
||||||
if (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
|
if (wd_manager.available(hovered_wd) && (msgwnd != hovered_wd))
|
||||||
{
|
{
|
||||||
brock.event_msleave(hovered_wd);
|
brock.event_msleave(hovered_wd);
|
||||||
hovered_wd->flags.action = mouse_action::normal;
|
hovered_wd->flags.action = mouse_action::normal;
|
||||||
@ -924,14 +923,14 @@ namespace detail
|
|||||||
|
|
||||||
//if msgwnd is neither a captured window nor a child of captured window,
|
//if msgwnd is neither a captured window nor a child of captured window,
|
||||||
//redirect the msgwnd to the captured window.
|
//redirect the msgwnd to the captured window.
|
||||||
auto cap_wd = brock.wd_manager().capture_redirect(msgwnd);
|
auto cap_wd = wd_manager.capture_redirect(msgwnd);
|
||||||
if(cap_wd)
|
if(cap_wd)
|
||||||
msgwnd = cap_wd;
|
msgwnd = cap_wd;
|
||||||
}
|
}
|
||||||
else if(msgwnd)
|
else if(msgwnd)
|
||||||
{
|
{
|
||||||
bool prev_captured_inside;
|
bool prev_captured_inside;
|
||||||
if(brock.wd_manager().capture_window_entered(xevent.xmotion.x, xevent.xmotion.y, prev_captured_inside))
|
if(wd_manager.capture_window_entered(xevent.xmotion.x, xevent.xmotion.y, prev_captured_inside))
|
||||||
{
|
{
|
||||||
event_code evt_code;
|
event_code evt_code;
|
||||||
if(prev_captured_inside)
|
if(prev_captured_inside)
|
||||||
@ -970,7 +969,7 @@ namespace detail
|
|||||||
arg.evt_code = event_code::mouse_move;
|
arg.evt_code = event_code::mouse_move;
|
||||||
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
|
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
|
||||||
}
|
}
|
||||||
if (!brock.wd_manager().available(hovered_wd))
|
if (!wd_manager.available(hovered_wd))
|
||||||
hovered_wd = nullptr;
|
hovered_wd = nullptr;
|
||||||
break;
|
break;
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
@ -1035,7 +1034,6 @@ namespace detail
|
|||||||
|
|
||||||
keybuf[len] = 0;
|
keybuf[len] = 0;
|
||||||
wchar_t os_code = 0;
|
wchar_t os_code = 0;
|
||||||
auto & wd_manager = brock.wd_manager();
|
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case XLookupKeySym:
|
case XLookupKeySym:
|
||||||
@ -1116,7 +1114,7 @@ namespace detail
|
|||||||
|
|
||||||
brock.emit(event_code::key_press, msgwnd, arg, true, &context);
|
brock.emit(event_code::key_press, msgwnd, arg, true, &context);
|
||||||
|
|
||||||
if(brock.wd_manager().available(msgwnd) && (msgwnd->root_widget->other.attribute.root->menubar == msgwnd))
|
if(wd_manager.available(msgwnd) && (msgwnd->root_widget->other.attribute.root->menubar == msgwnd))
|
||||||
{
|
{
|
||||||
int cmd = (menu_wd && (keyboard::escape == static_cast<wchar_t>(arg.key)) ? 1 : 0 );
|
int cmd = (menu_wd && (keyboard::escape == static_cast<wchar_t>(arg.key)) ? 1 : 0 );
|
||||||
brock.delay_restore(cmd);
|
brock.delay_restore(cmd);
|
||||||
@ -1216,7 +1214,7 @@ namespace detail
|
|||||||
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||||
|
|
||||||
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
pressed_wd_space = nullptr;
|
pressed_wd_space = nullptr;
|
||||||
}
|
}
|
||||||
@ -1245,7 +1243,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
|
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
|
||||||
if (set_focus)
|
if (set_focus)
|
||||||
brock.wd_manager().set_focus(msgwnd, false);
|
wd_manager.set_focus(msgwnd, false);
|
||||||
|
|
||||||
arg_keyboard arg;
|
arg_keyboard arg;
|
||||||
arg.evt_code = event_code::key_release;
|
arg.evt_code = event_code::key_release;
|
||||||
@ -1284,7 +1282,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
root_runtime = brock.wd_manager().root_runtime(native_window);
|
root_runtime = wd_manager.root_runtime(native_window);
|
||||||
if(root_runtime)
|
if(root_runtime)
|
||||||
{
|
{
|
||||||
context.event_window = pre_event_window;
|
context.event_window = pre_event_window;
|
||||||
@ -1299,10 +1297,10 @@ namespace detail
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto thread_id = ::nana::system::this_thread_id();
|
auto thread_id = ::nana::system::this_thread_id();
|
||||||
brock.wd_manager().call_safe_place(thread_id);
|
wd_manager.call_safe_place(thread_id);
|
||||||
|
|
||||||
if(msgwnd)
|
if(msgwnd)
|
||||||
brock.wd_manager().remove_trash_handle(thread_id);
|
wd_manager.remove_trash_handle(thread_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -791,7 +791,9 @@ namespace detail
|
|||||||
static restrict::TRACKMOUSEEVENT track = {sizeof track, 0x00000002};
|
static restrict::TRACKMOUSEEVENT track = {sizeof track, 0x00000002};
|
||||||
|
|
||||||
auto native_window = reinterpret_cast<native_window_type>(root_window);
|
auto native_window = reinterpret_cast<native_window_type>(root_window);
|
||||||
auto* root_runtime = brock.wd_manager().root_runtime(native_window);
|
|
||||||
|
auto & wd_manager = brock.wd_manager();
|
||||||
|
auto* root_runtime = wd_manager.root_runtime(native_window);
|
||||||
|
|
||||||
if(root_runtime)
|
if(root_runtime)
|
||||||
{
|
{
|
||||||
@ -836,7 +838,7 @@ namespace detail
|
|||||||
bool take_over = false;
|
bool take_over = false;
|
||||||
auto mmi = reinterpret_cast<MINMAXINFO*>(lParam);
|
auto mmi = reinterpret_cast<MINMAXINFO*>(lParam);
|
||||||
|
|
||||||
if(msgwnd->min_track_size.width && msgwnd->min_track_size.height)
|
if(!msgwnd->min_track_size.empty())
|
||||||
{
|
{
|
||||||
mmi->ptMinTrackSize.x = static_cast<LONG>(msgwnd->min_track_size.width + msgwnd->extra_width);
|
mmi->ptMinTrackSize.x = static_cast<LONG>(msgwnd->min_track_size.width + msgwnd->extra_width);
|
||||||
mmi->ptMinTrackSize.y = static_cast<LONG>(msgwnd->min_track_size.height + msgwnd->extra_height);
|
mmi->ptMinTrackSize.y = static_cast<LONG>(msgwnd->min_track_size.height + msgwnd->extra_height);
|
||||||
@ -888,7 +890,7 @@ namespace detail
|
|||||||
arg_focus arg;
|
arg_focus arg;
|
||||||
assign_arg(arg, focus, native_window, true);
|
assign_arg(arg, focus, native_window, true);
|
||||||
if (!brock.emit(event_code::focus, focus, arg, true, &context))
|
if (!brock.emit(event_code::focus, focus, arg, true, &context))
|
||||||
brock.wd_manager().set_focus(msgwnd, true);
|
wd_manager.set_focus(msgwnd, true);
|
||||||
}
|
}
|
||||||
def_window_proc = true;
|
def_window_proc = true;
|
||||||
break;
|
break;
|
||||||
@ -923,21 +925,21 @@ namespace detail
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
pressed_wd = nullptr;
|
pressed_wd = nullptr;
|
||||||
msgwnd = brock.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(msgwnd && msgwnd->flags.enabled)
|
if(msgwnd && msgwnd->flags.enabled)
|
||||||
{
|
{
|
||||||
if (msgwnd->flags.take_active && !msgwnd->flags.ignore_mouse_focus)
|
if (msgwnd->flags.take_active && !msgwnd->flags.ignore_mouse_focus)
|
||||||
{
|
{
|
||||||
auto killed = brock.wd_manager().set_focus(msgwnd, false);
|
auto killed = wd_manager.set_focus(msgwnd, false);
|
||||||
if (killed != msgwnd)
|
if (killed != msgwnd)
|
||||||
brock.wd_manager().do_lazy_refresh(killed, false);
|
wd_manager.do_lazy_refresh(killed, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_mouse arg;
|
arg_mouse arg;
|
||||||
assign_arg(arg, msgwnd, message, pmdec);
|
assign_arg(arg, msgwnd, message, pmdec);
|
||||||
if (brock.emit(arg.evt_code, msgwnd, arg, true, &context))
|
if (brock.emit(arg.evt_code, msgwnd, arg, true, &context))
|
||||||
{
|
{
|
||||||
if (brock.wd_manager().available(msgwnd))
|
if (wd_manager.available(msgwnd))
|
||||||
pressed_wd = msgwnd;
|
pressed_wd = msgwnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -951,7 +953,7 @@ namespace detail
|
|||||||
if (pressed_wd_space)
|
if (pressed_wd_space)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = brock.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)))
|
if ((nullptr == msgwnd) || (pressed_wd && (msgwnd != pressed_wd)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -970,9 +972,9 @@ namespace detail
|
|||||||
auto new_focus = (msgwnd->flags.take_active ? msgwnd : msgwnd->other.active_window);
|
auto new_focus = (msgwnd->flags.take_active ? msgwnd : msgwnd->other.active_window);
|
||||||
if (new_focus && (!new_focus->flags.ignore_mouse_focus))
|
if (new_focus && (!new_focus->flags.ignore_mouse_focus))
|
||||||
{
|
{
|
||||||
auto kill_focus = brock.wd_manager().set_focus(new_focus, false);
|
auto kill_focus = wd_manager.set_focus(new_focus, false);
|
||||||
if (kill_focus != new_focus)
|
if (kill_focus != new_focus)
|
||||||
brock.wd_manager().do_lazy_refresh(kill_focus, false);
|
wd_manager.do_lazy_refresh(kill_focus, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,14 +991,14 @@ namespace detail
|
|||||||
auto pos = native_interface::cursor_position();
|
auto pos = native_interface::cursor_position();
|
||||||
auto rootwd = native_interface::find_window(pos.x, pos.y);
|
auto rootwd = native_interface::find_window(pos.x, pos.y);
|
||||||
native_interface::calc_window_point(rootwd, pos);
|
native_interface::calc_window_point(rootwd, pos);
|
||||||
if(msgwnd != brock.wd_manager().find_window(rootwd, pos.x, pos.y))
|
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->flags.action = mouse_action::normal;
|
msgwnd->flags.action = mouse_action::normal;
|
||||||
|
|
||||||
arg.evt_code = event_code::mouse_up;
|
arg.evt_code = event_code::mouse_up;
|
||||||
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1012,7 +1014,7 @@ namespace detail
|
|||||||
if (pressed_wd_space)
|
if (pressed_wd_space)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = brock.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)
|
if(nullptr == msgwnd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1041,7 +1043,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Do mouse_up, this handle may be closed by click handler.
|
//Do mouse_up, this handle may be closed by click handler.
|
||||||
if(brock.wd_manager().available(msgwnd) && msgwnd->flags.enabled)
|
if(wd_manager.available(msgwnd) && msgwnd->flags.enabled)
|
||||||
{
|
{
|
||||||
arg.evt_code = event_code::mouse_up;
|
arg.evt_code = event_code::mouse_up;
|
||||||
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
||||||
@ -1049,7 +1051,7 @@ namespace detail
|
|||||||
if (click_arg.window_handle)
|
if (click_arg.window_handle)
|
||||||
retain->click.emit(click_arg);
|
retain->click.emit(click_arg);
|
||||||
|
|
||||||
if (brock.wd_manager().available(msgwnd))
|
if (wd_manager.available(msgwnd))
|
||||||
{
|
{
|
||||||
arg.evt_code = event_code::mouse_up;
|
arg.evt_code = event_code::mouse_up;
|
||||||
retain->mouse_up.emit(arg);
|
retain->mouse_up.emit(arg);
|
||||||
@ -1058,7 +1060,7 @@ namespace detail
|
|||||||
else if (click_arg.window_handle)
|
else if (click_arg.window_handle)
|
||||||
retain->click.emit(click_arg);
|
retain->click.emit(click_arg);
|
||||||
|
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
pressed_wd = nullptr;
|
pressed_wd = nullptr;
|
||||||
break;
|
break;
|
||||||
@ -1067,8 +1069,8 @@ namespace detail
|
|||||||
if (pressed_wd_space)
|
if (pressed_wd_space)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msgwnd = brock.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 (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
|
if (wd_manager.available(hovered_wd) && (msgwnd != hovered_wd))
|
||||||
{
|
{
|
||||||
brock.event_msleave(hovered_wd);
|
brock.event_msleave(hovered_wd);
|
||||||
hovered_wd->flags.action = mouse_action::normal;
|
hovered_wd->flags.action = mouse_action::normal;
|
||||||
@ -1076,7 +1078,7 @@ namespace detail
|
|||||||
|
|
||||||
//if msgwnd is neither captured window nor the child of captured window,
|
//if msgwnd is neither captured window nor the child of captured window,
|
||||||
//redirect the msgwnd to the captured window.
|
//redirect the msgwnd to the captured window.
|
||||||
auto wd = brock.wd_manager().capture_redirect(msgwnd);
|
auto wd = wd_manager.capture_redirect(msgwnd);
|
||||||
if(wd)
|
if(wd)
|
||||||
msgwnd = wd;
|
msgwnd = wd;
|
||||||
}
|
}
|
||||||
@ -1084,7 +1086,7 @@ namespace detail
|
|||||||
else if(msgwnd)
|
else if(msgwnd)
|
||||||
{
|
{
|
||||||
bool prev_captured_inside;
|
bool prev_captured_inside;
|
||||||
if(brock.wd_manager().capture_window_entered(pmdec.mouse.x, pmdec.mouse.y, prev_captured_inside))
|
if(wd_manager.capture_window_entered(pmdec.mouse.x, pmdec.mouse.y, prev_captured_inside))
|
||||||
{
|
{
|
||||||
event_code evt_code;
|
event_code evt_code;
|
||||||
if(prev_captured_inside)
|
if(prev_captured_inside)
|
||||||
@ -1129,7 +1131,7 @@ namespace detail
|
|||||||
track.hwndTrack = native_window;
|
track.hwndTrack = native_window;
|
||||||
restrict::track_mouse_event(&track);
|
restrict::track_mouse_event(&track);
|
||||||
}
|
}
|
||||||
if (!brock.wd_manager().available(hovered_wd))
|
if (!wd_manager.available(hovered_wd))
|
||||||
hovered_wd = nullptr;
|
hovered_wd = nullptr;
|
||||||
break;
|
break;
|
||||||
case WM_MOUSELEAVE:
|
case WM_MOUSELEAVE:
|
||||||
@ -1145,7 +1147,7 @@ namespace detail
|
|||||||
if (pointer_wd == root_window)
|
if (pointer_wd == root_window)
|
||||||
{
|
{
|
||||||
::ScreenToClient(pointer_wd, &scr_pos);
|
::ScreenToClient(pointer_wd, &scr_pos);
|
||||||
auto scrolled_wd = brock.wd_manager().find_window(reinterpret_cast<native_window_type>(pointer_wd), scr_pos.x, scr_pos.y);
|
auto scrolled_wd = wd_manager.find_window(reinterpret_cast<native_window_type>(pointer_wd), scr_pos.x, scr_pos.y);
|
||||||
|
|
||||||
def_window_proc = true;
|
def_window_proc = true;
|
||||||
auto evt_wd = scrolled_wd;
|
auto evt_wd = scrolled_wd;
|
||||||
@ -1155,7 +1157,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
def_window_proc = false;
|
def_window_proc = false;
|
||||||
nana::point mspos{ scr_pos.x, scr_pos.y };
|
nana::point mspos{ scr_pos.x, scr_pos.y };
|
||||||
brock.wd_manager().calc_window_point(evt_wd, mspos);
|
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);
|
||||||
@ -1169,13 +1171,13 @@ namespace detail
|
|||||||
if (scrolled_wd && (nullptr == evt_wd))
|
if (scrolled_wd && (nullptr == evt_wd))
|
||||||
{
|
{
|
||||||
nana::point mspos{ scr_pos.x, scr_pos.y };
|
nana::point mspos{ scr_pos.x, scr_pos.y };
|
||||||
brock.wd_manager().calc_window_point(scrolled_wd, mspos);
|
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);
|
||||||
brock.emit_drawer(event_code::mouse_wheel, scrolled_wd, arg, &context);
|
brock.emit_drawer(event_code::mouse_wheel, scrolled_wd, arg, &context);
|
||||||
brock.wd_manager().do_lazy_refresh(scrolled_wd, false);
|
wd_manager.do_lazy_refresh(scrolled_wd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1193,7 +1195,7 @@ namespace detail
|
|||||||
POINT pos;
|
POINT pos;
|
||||||
::DragQueryPoint(drop, &pos);
|
::DragQueryPoint(drop, &pos);
|
||||||
|
|
||||||
msgwnd = brock.wd_manager().find_window(native_window, pos.x, pos.y);
|
msgwnd = wd_manager.find_window(native_window, pos.x, pos.y);
|
||||||
if(msgwnd)
|
if(msgwnd)
|
||||||
{
|
{
|
||||||
arg_dropfiles dropfiles;
|
arg_dropfiles dropfiles;
|
||||||
@ -1224,11 +1226,11 @@ namespace detail
|
|||||||
dropfiles.pos.x = pos.x;
|
dropfiles.pos.x = pos.x;
|
||||||
dropfiles.pos.y = pos.y;
|
dropfiles.pos.y = pos.y;
|
||||||
|
|
||||||
brock.wd_manager().calc_window_point(msgwnd, dropfiles.pos);
|
wd_manager.calc_window_point(msgwnd, dropfiles.pos);
|
||||||
dropfiles.window_handle = reinterpret_cast<window>(msgwnd);
|
dropfiles.window_handle = reinterpret_cast<window>(msgwnd);
|
||||||
|
|
||||||
msgwnd->together.events_ptr->mouse_dropfiles.emit(dropfiles);
|
msgwnd->together.events_ptr->mouse_dropfiles.emit(dropfiles);
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1316,7 +1318,7 @@ namespace detail
|
|||||||
break;
|
break;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if(wParam != SIZE_MINIMIZED)
|
if(wParam != SIZE_MINIMIZED)
|
||||||
brock.wd_manager().size(msgwnd, size(pmdec.size.width, pmdec.size.height), true, true);
|
wd_manager.size(msgwnd, size(pmdec.size.width, pmdec.size.height), true, true);
|
||||||
break;
|
break;
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
|
brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
|
||||||
@ -1342,7 +1344,7 @@ namespace detail
|
|||||||
case WM_SYSCHAR:
|
case WM_SYSCHAR:
|
||||||
def_window_proc = true;
|
def_window_proc = true;
|
||||||
brock.set_keyboard_shortkey(true);
|
brock.set_keyboard_shortkey(true);
|
||||||
msgwnd = brock.wd_manager().find_shortkey(native_window, static_cast<unsigned long>(wParam));
|
msgwnd = wd_manager.find_shortkey(native_window, static_cast<unsigned long>(wParam));
|
||||||
if(msgwnd)
|
if(msgwnd)
|
||||||
{
|
{
|
||||||
arg_keyboard arg;
|
arg_keyboard arg;
|
||||||
@ -1389,7 +1391,7 @@ namespace detail
|
|||||||
|
|
||||||
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
|
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
|
||||||
if (set_focus)
|
if (set_focus)
|
||||||
brock.wd_manager().set_focus(msgwnd, false);
|
wd_manager.set_focus(msgwnd, false);
|
||||||
|
|
||||||
arg_keyboard arg;
|
arg_keyboard arg;
|
||||||
arg.evt_code = event_code::key_release;
|
arg.evt_code = event_code::key_release;
|
||||||
@ -1419,7 +1421,6 @@ namespace detail
|
|||||||
|
|
||||||
if(msgwnd)
|
if(msgwnd)
|
||||||
{
|
{
|
||||||
auto & wd_manager = brock.wd_manager();
|
|
||||||
if((VK_TAB == wParam) && (!msgwnd->visible || (false == (msgwnd->flags.tab & tab_type::eating)))) //Tab
|
if((VK_TAB == wParam) && (!msgwnd->visible || (false == (msgwnd->flags.tab & tab_type::eating)))) //Tab
|
||||||
{
|
{
|
||||||
bool is_forward = (::GetKeyState(VK_SHIFT) >= 0);
|
bool is_forward = (::GetKeyState(VK_SHIFT) >= 0);
|
||||||
@ -1496,10 +1497,10 @@ namespace detail
|
|||||||
arg.ignore = false;
|
arg.ignore = false;
|
||||||
|
|
||||||
msgwnd->together.events_ptr->key_char.emit(arg);
|
msgwnd->together.events_ptr->key_char.emit(arg);
|
||||||
if ((false == arg.ignore) && brock.wd_manager().available(msgwnd))
|
if ((false == arg.ignore) && wd_manager.available(msgwnd))
|
||||||
brock.emit_drawer(event_code::key_char, msgwnd, arg, &context);
|
brock.emit_drawer(event_code::key_char, msgwnd, arg, &context);
|
||||||
|
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1532,7 +1533,7 @@ namespace detail
|
|||||||
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||||
|
|
||||||
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
|
||||||
brock.wd_manager().do_lazy_refresh(msgwnd, false);
|
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
}
|
}
|
||||||
pressed_wd_space = nullptr;
|
pressed_wd_space = nullptr;
|
||||||
}
|
}
|
||||||
@ -1577,12 +1578,12 @@ namespace detail
|
|||||||
brock.erase_menu(false);
|
brock.erase_menu(false);
|
||||||
brock.delay_restore(3); //Restores if delay_restore not decleared
|
brock.delay_restore(3); //Restores if delay_restore not decleared
|
||||||
}
|
}
|
||||||
brock.wd_manager().destroy(msgwnd);
|
wd_manager.destroy(msgwnd);
|
||||||
nana::detail::platform_spec::instance().release_window_icon(msgwnd->root);
|
nana::detail::platform_spec::instance().release_window_icon(msgwnd->root);
|
||||||
break;
|
break;
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
brock.manage_form_loader(msgwnd, false);
|
brock.manage_form_loader(msgwnd, false);
|
||||||
brock.wd_manager().destroy_handle(msgwnd);
|
wd_manager.destroy_handle(msgwnd);
|
||||||
|
|
||||||
if(--context.window_count <= 0)
|
if(--context.window_count <= 0)
|
||||||
{
|
{
|
||||||
@ -1594,7 +1595,7 @@ namespace detail
|
|||||||
def_window_proc = true;
|
def_window_proc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
root_runtime = brock.wd_manager().root_runtime(native_window);
|
root_runtime = wd_manager.root_runtime(native_window);
|
||||||
if(root_runtime)
|
if(root_runtime)
|
||||||
{
|
{
|
||||||
root_runtime->condition.pressed = pressed_wd;
|
root_runtime->condition.pressed = pressed_wd;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user