fix an infinit loop issue when pressing tab key if all tabstop widgets are
invisible
This commit is contained in:
parent
e2cf5452d5
commit
bdf928a9e8
@ -1019,12 +1019,13 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// preconditions of get_tabstop: tabstop is not empty and at least one window is visible
|
||||
window_manager::core_window_t* get_tabstop(window_manager::core_window_t* wd, bool forward)
|
||||
{
|
||||
auto & tabs = wd->root_widget->other.attribute.root->tabstop;
|
||||
if (tabs.size())
|
||||
{
|
||||
if (forward) //
|
||||
|
||||
if (forward)
|
||||
{
|
||||
if (detail::tab_type::none == wd->flags.tab)
|
||||
return (tabs.front());
|
||||
@ -1042,13 +1043,12 @@ namespace detail
|
||||
return tabs.front();
|
||||
}
|
||||
}
|
||||
else if (tabs.size() > 1) //at least 2 elments in tabs is required when moving perviously.
|
||||
else if (tabs.size() > 1) //at least 2 elments in tabs are required when moving backward.
|
||||
{
|
||||
auto i = std::find(tabs.cbegin(), tabs.cend(), wd);
|
||||
if (i != tabs.cend())
|
||||
return (tabs.cbegin() == i ? tabs.back() : *(i - 1));
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1059,18 +1059,32 @@ namespace detail
|
||||
if (!impl_->wd_register.available(wd))
|
||||
return nullptr;
|
||||
|
||||
auto & tabs = wd->root_widget->other.attribute.root->tabstop;
|
||||
if (tabs.empty())
|
||||
return nullptr;
|
||||
|
||||
bool precondition = false;
|
||||
for (auto & tab_wd : tabs)
|
||||
{
|
||||
if (tab_wd->visible)
|
||||
{
|
||||
precondition = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (precondition)
|
||||
{
|
||||
auto new_stop = get_tabstop(wd, forward);
|
||||
|
||||
while (new_stop)
|
||||
while (new_stop && (wd != new_stop))
|
||||
{
|
||||
if (wd == new_stop)
|
||||
break;
|
||||
|
||||
if (new_stop->flags.enabled && new_stop->visible)
|
||||
return new_stop;
|
||||
|
||||
new_stop = get_tabstop(new_stop, forward);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user