refactor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Bedrock Platform-Independent Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -119,6 +119,27 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::close_thread_window(unsigned thread_id)
|
||||
{
|
||||
std::vector<core_window_t*> v;
|
||||
wd_manager().all_handles(v);
|
||||
|
||||
std::vector<native_window_type> roots;
|
||||
native_window_type root = nullptr;
|
||||
for (auto wd : v)
|
||||
{
|
||||
if (((0 == thread_id) || (wd->thread_id == thread_id)) && (wd->root != root))
|
||||
{
|
||||
root = wd->root;
|
||||
if (roots.cend() == std::find(roots.cbegin(), roots.cend(), root))
|
||||
roots.emplace_back(root);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i : roots)
|
||||
native_interface::close_window(i);
|
||||
}
|
||||
|
||||
void bedrock::event_expose(core_window_t * wd, bool exposed)
|
||||
{
|
||||
if (nullptr == wd) return;
|
||||
@@ -585,29 +606,5 @@ namespace nana
|
||||
throw std::runtime_error("Invalid event code");
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::_m_except_handler()
|
||||
{
|
||||
std::vector<core_window_t*> v;
|
||||
wd_manager().all_handles(v);
|
||||
if (v.size())
|
||||
{
|
||||
std::vector<native_window_type> roots;
|
||||
native_window_type root = nullptr;
|
||||
unsigned tid = nana::system::this_thread_id();
|
||||
for (auto wd : v)
|
||||
{
|
||||
if ((wd->thread_id == tid) && (wd->root != root))
|
||||
{
|
||||
root = wd->root;
|
||||
if (roots.cend() == std::find(roots.cbegin(), roots.cend(), root))
|
||||
roots.emplace_back(root);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i : roots)
|
||||
native_interface::close_window(i);
|
||||
}
|
||||
}
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
Reference in New Issue
Block a user