minor changes
This commit is contained in:
@@ -647,7 +647,8 @@ namespace detail
|
||||
static core_window_t* last_mouse_down_window;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -667,7 +668,7 @@ namespace detail
|
||||
if(pressed_wd_space)
|
||||
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 (mouse_action::pressed != msgwnd->flags.action)
|
||||
@@ -681,7 +682,7 @@ namespace detail
|
||||
arg.evt_code = event_code::mouse_move;
|
||||
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;
|
||||
}
|
||||
break;
|
||||
@@ -701,7 +702,7 @@ namespace detail
|
||||
arg.receiver = native_window;
|
||||
arg.getting = true;
|
||||
if(!brock.emit(event_code::focus, focus, arg, true, &context))
|
||||
brock.wd_manager().set_focus(msgwnd, true);
|
||||
wd_manager.set_focus(msgwnd, true);
|
||||
}
|
||||
break;
|
||||
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))
|
||||
{
|
||||
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)
|
||||
@@ -745,7 +746,7 @@ namespace detail
|
||||
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
|
||||
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 ((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)
|
||||
{
|
||||
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)
|
||||
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;
|
||||
if(brock.emit(arg.evt_code, msgwnd, arg, true, &context))
|
||||
{
|
||||
if (brock.wd_manager().available(msgwnd))
|
||||
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.
|
||||
@@ -790,7 +791,7 @@ namespace detail
|
||||
//call the drawer mouse up event for restoring the surface graphics
|
||||
msgwnd->flags.action = mouse_action::normal;
|
||||
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
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -852,7 +853,7 @@ namespace detail
|
||||
}
|
||||
|
||||
//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)
|
||||
msgwnd->flags.action = mouse_action::over;
|
||||
@@ -866,7 +867,7 @@ namespace detail
|
||||
if(click_arg.window_handle)
|
||||
evt_ptr->click.emit(click_arg);
|
||||
|
||||
if (brock.wd_manager().available(msgwnd))
|
||||
if (wd_manager.available(msgwnd))
|
||||
{
|
||||
arg.evt_code = event_code::mouse_up;
|
||||
evt_ptr->mouse_up.emit(arg);
|
||||
@@ -875,29 +876,27 @@ namespace detail
|
||||
else if(click_arg.window_handle)
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case DestroyNotify:
|
||||
if(wd_manager.available(msgwnd))
|
||||
{
|
||||
auto & spec = nana::detail::platform_spec::instance();
|
||||
if(brock.wd_manager().available(msgwnd))
|
||||
//The msgwnd may be destroyed if the window is destroyed by calling native interface of close_window().
|
||||
if (msgwnd->root == brock.get_menu())
|
||||
{
|
||||
//The msgwnd may be destroyed if the window is destroyed by calling native interface of close_window().
|
||||
if (msgwnd->root == brock.get_menu())
|
||||
{
|
||||
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);
|
||||
brock.erase_menu(false);
|
||||
brock.delay_restore(3); //Restores if delay_restore not decleared
|
||||
}
|
||||
|
||||
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;
|
||||
case MotionNotify:
|
||||
@@ -915,8 +914,8 @@ namespace detail
|
||||
if(pressed_wd_space)
|
||||
break;
|
||||
|
||||
msgwnd = brock.wd_manager().find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
|
||||
if (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
|
||||
msgwnd = wd_manager.find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
|
||||
if (wd_manager.available(hovered_wd) && (msgwnd != hovered_wd))
|
||||
{
|
||||
brock.event_msleave(hovered_wd);
|
||||
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,
|
||||
//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)
|
||||
msgwnd = cap_wd;
|
||||
}
|
||||
else if(msgwnd)
|
||||
{
|
||||
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;
|
||||
if(prev_captured_inside)
|
||||
@@ -970,7 +969,7 @@ namespace detail
|
||||
arg.evt_code = event_code::mouse_move;
|
||||
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;
|
||||
break;
|
||||
case MapNotify:
|
||||
@@ -1035,7 +1034,6 @@ namespace detail
|
||||
|
||||
keybuf[len] = 0;
|
||||
wchar_t os_code = 0;
|
||||
auto & wd_manager = brock.wd_manager();
|
||||
switch(status)
|
||||
{
|
||||
case XLookupKeySym:
|
||||
@@ -1116,7 +1114,7 @@ namespace detail
|
||||
|
||||
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 );
|
||||
brock.delay_restore(cmd);
|
||||
@@ -1216,7 +1214,7 @@ namespace detail
|
||||
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1245,7 +1243,7 @@ namespace detail
|
||||
{
|
||||
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
|
||||
if (set_focus)
|
||||
brock.wd_manager().set_focus(msgwnd, false);
|
||||
wd_manager.set_focus(msgwnd, false);
|
||||
|
||||
arg_keyboard arg;
|
||||
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)
|
||||
{
|
||||
context.event_window = pre_event_window;
|
||||
@@ -1299,10 +1297,10 @@ namespace detail
|
||||
}
|
||||
|
||||
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)
|
||||
brock.wd_manager().remove_trash_handle(thread_id);
|
||||
wd_manager.remove_trash_handle(thread_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user