stop changing focus when dbl clicks on form/panel background

This commit is contained in:
Jinhao 2015-05-20 02:26:39 +08:00
parent aac94e238b
commit 8515fff8d0
3 changed files with 36 additions and 51 deletions

View File

@ -726,7 +726,7 @@ namespace detail
last_mouse_down_window = msgwnd;
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;
auto kill_focus = brock.wd_manager.set_focus(new_focus, false);
@ -1028,18 +1028,12 @@ namespace detail
arg_keyboard argkey;
brock.get_key_state(argkey);
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.do_lazy_refresh(tstop_wd, true);
root_runtime->condition.tabstop_focus_changed = true;
break;
}
tstop_wd = brock.wd_manager.tabstop(tstop_wd, is_forward);
brock.wd_manager.set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
root_runtime->condition.tabstop_focus_changed = true;
}
}
else if(keyboard::alt == keychar)

View File

@ -905,8 +905,15 @@ namespace detail
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if(msgwnd && msgwnd->flags.enabled)
{
if(msgwnd->flags.take_active)
brock.wd_manager.set_focus(msgwnd, false);
if (msgwnd->flags.take_active && !msgwnd->flags.ignore_mouse_focus)
{
auto killed = brock.wd_manager.set_focus(msgwnd, false);
if (killed != msgwnd)
{
brock.wd_manager.do_lazy_refresh(killed, false);
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
}
}
arg_mouse arg;
assign_arg(arg, msgwnd, message, pmdec);
@ -1396,18 +1403,12 @@ namespace detail
bool is_forward = (::GetKeyState(VK_SHIFT) >= 0);
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, is_forward);
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.do_lazy_refresh(tstop_wd, true);
root_runtime->condition.tabstop_focus_changed = true;
break;
}
tstop_wd = brock.wd_manager.tabstop(tstop_wd, is_forward);
brock.wd_manager.set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
root_runtime->condition.tabstop_focus_changed = true;
}
}
else

View File

@ -1023,34 +1023,24 @@ namespace detail
return nullptr;
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) //
{
if (detail::tab_type::none == wd->flags.tab)
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));
}
++i;
core_window_t* ts = (i != tabs.cend() ? (*i) : tabs.front());
return (ts != wd ? ts : nullptr);
}
return nullptr;
return (tabs.cbegin() == i ? tabs.back() : *(i - 1));
}
void window_manager::remove_trash_handle(unsigned tid)