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; 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);
@ -1028,18 +1028,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.set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true); brock.wd_manager.do_lazy_refresh(tstop_wd, true);
root_runtime->condition.tabstop_focus_changed = 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)

View File

@ -905,8 +905,15 @@ 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);
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
}
}
arg_mouse arg; arg_mouse arg;
assign_arg(arg, msgwnd, message, pmdec); assign_arg(arg, msgwnd, message, pmdec);
@ -1396,18 +1403,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)
{ {
brock.wd_manager.set_focus(tstop_wd, false); brock.wd_manager.set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true); brock.wd_manager.do_lazy_refresh(tstop_wd, true);
root_runtime->condition.tabstop_focus_changed = true; root_runtime->condition.tabstop_focus_changed = true;
break;
}
tstop_wd = brock.wd_manager.tabstop(tstop_wd, is_forward);
} }
} }
else else

View File

@ -1023,35 +1023,25 @@ 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 (forward) //
{ if ((detail::tab_type::none == wd->flags.tab) || !(detail::tab_type::tabstop & wd->flags.tab))
if (detail::tab_type::none == wd->flags.tab) return (forward ? tabs.front() : tabs.back());
return (tabs.front());
else if (detail::tab_type::tabstop & wd->flags.tab) auto i = std::find(tabs.cbegin(), tabs.cend(), wd);
{ if (tabs.cend() == i)
auto end = tabs.cend(); return (forward ? tabs.front() : tabs.back());
auto i = std::find(tabs.cbegin(), end, wd);
if (i != end) if (forward)
{ {
++i; ++i;
core_window_t* ts = (i != end ? (*i) : tabs.front()); core_window_t* ts = (i != tabs.cend() ? (*i) : tabs.front());
return (ts != wd ? ts : nullptr); 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 (tabs.cbegin() == i ? tabs.back() : *(i - 1));
} }
}
return nullptr;
}
void window_manager::remove_trash_handle(unsigned tid) void window_manager::remove_trash_handle(unsigned tid)
{ {