Merge branch 'develop' of https://github.com/cnjinhao/nana into develop
This commit is contained in:
commit
2776365fdf
@ -76,11 +76,6 @@ namespace detail
|
|||||||
{
|
{
|
||||||
using container = std::vector<basic_window*>;
|
using container = std::vector<basic_window*>;
|
||||||
|
|
||||||
struct root_context
|
|
||||||
{
|
|
||||||
bool focus_changed;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class update_state
|
enum class update_state
|
||||||
{
|
{
|
||||||
none, lazy, refresh
|
none, lazy, refresh
|
||||||
@ -203,7 +198,6 @@ namespace detail
|
|||||||
std::vector<edge_nimbus_action> effects_edge_nimbus;
|
std::vector<edge_nimbus_action> effects_edge_nimbus;
|
||||||
basic_window* focus{nullptr};
|
basic_window* focus{nullptr};
|
||||||
basic_window* menubar{nullptr};
|
basic_window* menubar{nullptr};
|
||||||
root_context context;
|
|
||||||
bool ime_enabled{false};
|
bool ime_enabled{false};
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
cursor running_cursor{ nana::cursor::arrow };
|
cursor running_cursor{ nana::cursor::arrow };
|
||||||
@ -211,7 +205,7 @@ namespace detail
|
|||||||
cursor state_cursor{nana::cursor::arrow};
|
cursor state_cursor{nana::cursor::arrow};
|
||||||
basic_window* state_cursor_window{ nullptr };
|
basic_window* state_cursor_window{ nullptr };
|
||||||
|
|
||||||
std::function<void()> draw_through; ///< A draw through renderer for root widgets.
|
std::function<void()> draw_through; // A draw through renderer for root widgets.
|
||||||
};
|
};
|
||||||
|
|
||||||
const category::flags category;
|
const category::flags category;
|
||||||
|
|||||||
@ -195,7 +195,6 @@ namespace nana
|
|||||||
{
|
{
|
||||||
case category::root_tag::value:
|
case category::root_tag::value:
|
||||||
attribute.root = new attr_root_tag;
|
attribute.root = new attr_root_tag;
|
||||||
attribute.root->context.focus_changed = false;
|
|
||||||
break;
|
break;
|
||||||
case category::frame_tag::value:
|
case category::frame_tag::value:
|
||||||
attribute.frame = new attr_frame_tag;
|
attribute.frame = new attr_frame_tag;
|
||||||
|
|||||||
@ -664,7 +664,6 @@ namespace detail
|
|||||||
auto focus = msgwnd->other.attribute.root->focus;
|
auto focus = msgwnd->other.attribute.root->focus;
|
||||||
if(focus && focus->together.caret)
|
if(focus && focus->together.caret)
|
||||||
focus->together.caret->set_active(true);
|
focus->together.caret->set_active(true);
|
||||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = true;
|
|
||||||
|
|
||||||
arg_focus arg;
|
arg_focus arg;
|
||||||
arg.window_handle = reinterpret_cast<window>(focus);
|
arg.window_handle = reinterpret_cast<window>(focus);
|
||||||
@ -726,15 +725,15 @@ namespace detail
|
|||||||
last_mouse_down_window = msgwnd;
|
last_mouse_down_window = msgwnd;
|
||||||
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)
|
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 = brock.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);
|
brock.wd_manager.do_lazy_refresh(kill_focus, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto retain = msgwnd->together.events_ptr;
|
auto retain = msgwnd->together.events_ptr;
|
||||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
|
|
||||||
context.event_window = msgwnd;
|
context.event_window = msgwnd;
|
||||||
|
|
||||||
pressed_wd = nullptr;
|
pressed_wd = nullptr;
|
||||||
@ -748,7 +747,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
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.
|
||||||
if(msgwnd->root_widget->other.attribute.root->context.focus_changed)
|
if (msgwnd->root != native_interface::get_focus_window())
|
||||||
{
|
{
|
||||||
//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;
|
||||||
@ -1028,18 +1027,12 @@ namespace detail
|
|||||||
arg_keyboard argkey;
|
arg_keyboard argkey;
|
||||||
brock.get_key_state(argkey);
|
brock.get_key_state(argkey);
|
||||||
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, argkey.shift);
|
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, argkey.shift);
|
||||||
while (tstop_wd)
|
if (tstop_wd)
|
||||||
{
|
{
|
||||||
if (!tstop_wd->flags.ignore_mouse_focus)
|
brock.wd_manager.set_focus(tstop_wd, false);
|
||||||
{
|
brock.wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
brock.wd_manager.set_focus(tstop_wd, false);
|
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
|
||||||
brock.wd_manager.do_lazy_refresh(msgwnd, false);
|
root_runtime->condition.tabstop_focus_changed = true;
|
||||||
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
|
|
||||||
root_runtime->condition.tabstop_focus_changed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tstop_wd = brock.wd_manager.tabstop(tstop_wd, is_forward);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(keyboard::alt == keychar)
|
else if(keyboard::alt == keychar)
|
||||||
|
|||||||
@ -863,8 +863,6 @@ namespace detail
|
|||||||
if(focus && focus->together.caret)
|
if(focus && focus->together.caret)
|
||||||
focus->together.caret->set_active(true);
|
focus->together.caret->set_active(true);
|
||||||
|
|
||||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = true;
|
|
||||||
|
|
||||||
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))
|
||||||
@ -888,9 +886,6 @@ namespace detail
|
|||||||
//wParam indicates a handle of window that receives the focus.
|
//wParam indicates a handle of window that receives the focus.
|
||||||
brock.close_menu_if_focus_other_window(reinterpret_cast<native_window_type>(wParam));
|
brock.close_menu_if_focus_other_window(reinterpret_cast<native_window_type>(wParam));
|
||||||
}
|
}
|
||||||
//focus_changed means that during an event procedure if the focus is changed
|
|
||||||
if(brock.wd_manager.available(msgwnd))
|
|
||||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = true;
|
|
||||||
|
|
||||||
def_window_proc = true;
|
def_window_proc = true;
|
||||||
break;
|
break;
|
||||||
@ -905,8 +900,12 @@ namespace detail
|
|||||||
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
|
msgwnd = brock.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)
|
if (msgwnd->flags.take_active && !msgwnd->flags.ignore_mouse_focus)
|
||||||
brock.wd_manager.set_focus(msgwnd, false);
|
{
|
||||||
|
auto killed = brock.wd_manager.set_focus(msgwnd, false);
|
||||||
|
if (killed != msgwnd)
|
||||||
|
brock.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);
|
||||||
@ -939,10 +938,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
auto kill_focus = brock.wd_manager.set_focus(new_focus, false);
|
auto kill_focus = brock.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);
|
brock.wd_manager.do_lazy_refresh(kill_focus, false);
|
||||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_mouse arg;
|
arg_mouse arg;
|
||||||
@ -953,7 +949,7 @@ namespace detail
|
|||||||
if (brock.emit(event_code::mouse_down, msgwnd, arg, true, &context))
|
if (brock.emit(event_code::mouse_down, msgwnd, arg, true, &context))
|
||||||
{
|
{
|
||||||
//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_widget->other.attribute.root->context.focus_changed)
|
if (msgwnd->root != native_interface::get_focus_window())
|
||||||
{
|
{
|
||||||
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);
|
||||||
@ -1396,18 +1392,12 @@ namespace detail
|
|||||||
bool is_forward = (::GetKeyState(VK_SHIFT) >= 0);
|
bool is_forward = (::GetKeyState(VK_SHIFT) >= 0);
|
||||||
|
|
||||||
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, is_forward);
|
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, is_forward);
|
||||||
while (tstop_wd)
|
if (tstop_wd)
|
||||||
{
|
{
|
||||||
if (!tstop_wd->flags.ignore_mouse_focus)
|
root_runtime->condition.tabstop_focus_changed = true;
|
||||||
{
|
brock.wd_manager.set_focus(tstop_wd, false);
|
||||||
root_runtime->condition.tabstop_focus_changed = true;
|
brock.wd_manager.do_lazy_refresh(msgwnd, false);
|
||||||
brock.wd_manager.set_focus(tstop_wd, false);
|
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
|
||||||
brock.wd_manager.do_lazy_refresh(msgwnd, false);
|
|
||||||
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tstop_wd = brock.wd_manager.tabstop(tstop_wd, is_forward);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1044,34 +1044,24 @@ namespace detail
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto & tabs = wd->root_widget->other.attribute.root->tabstop;
|
auto & tabs = wd->root_widget->other.attribute.root->tabstop;
|
||||||
if (tabs.size())
|
if (tabs.empty())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if ((detail::tab_type::none == wd->flags.tab) || !(detail::tab_type::tabstop & wd->flags.tab))
|
||||||
|
return (forward ? tabs.front() : tabs.back());
|
||||||
|
|
||||||
|
auto i = std::find(tabs.cbegin(), tabs.cend(), wd);
|
||||||
|
if (tabs.cend() == i)
|
||||||
|
return (forward ? tabs.front() : tabs.back());
|
||||||
|
|
||||||
|
if (forward)
|
||||||
{
|
{
|
||||||
if (forward) //
|
++i;
|
||||||
{
|
core_window_t* ts = (i != tabs.cend() ? (*i) : tabs.front());
|
||||||
if (detail::tab_type::none == wd->flags.tab)
|
return (ts != wd ? ts : nullptr);
|
||||||
return (tabs.front());
|
|
||||||
else if (detail::tab_type::tabstop & wd->flags.tab)
|
|
||||||
{
|
|
||||||
auto end = tabs.cend();
|
|
||||||
auto i = std::find(tabs.cbegin(), end, wd);
|
|
||||||
if (i != end)
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
core_window_t* ts = (i != end ? (*i) : tabs.front());
|
|
||||||
return (ts != wd ? ts : nullptr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return tabs.front();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (tabs.size() > 1) //at least 2 elments in tabs is required when moving perviously.
|
|
||||||
{
|
|
||||||
auto i = std::find(tabs.cbegin(), tabs.cend(), wd);
|
|
||||||
if (i != tabs.cend())
|
|
||||||
return (tabs.cbegin() == i ? tabs.back() : *(i - 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
|
||||||
|
return (tabs.cbegin() == i ? tabs.back() : *(i - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_manager::remove_trash_handle(unsigned tid)
|
void window_manager::remove_trash_handle(unsigned tid)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user