fix the revertable lock of window_manager

This commit is contained in:
Jinhao
2016-10-19 02:58:49 +08:00
parent 01ff1c11c1
commit 9ed5e81ca2
6 changed files with 53 additions and 23 deletions

View File

@@ -992,33 +992,30 @@ namespace API
void modal_window(window wd)
{
auto const iwd = reinterpret_cast<basic_window*>(wd);
internal_scope_guard isg;
if (!restrict::wd_manager().available(iwd))
return;
if ((iwd->other.category == category::flags::root) && (iwd->flags.modal == false))
{
auto const iwd = reinterpret_cast<basic_window*>(wd);
internal_scope_guard isg;
if (!restrict::wd_manager().available(iwd))
return;
if ((iwd->other.category == category::flags::root) && (iwd->flags.modal == false))
{
iwd->flags.modal = true;
iwd->flags.modal = true;
#if defined(NANA_X11)
interface_type::set_modal(iwd->root);
interface_type::set_modal(iwd->root);
#endif
restrict::wd_manager().show(iwd, true);
}
else
return;
restrict::wd_manager().show(iwd, true);
}
else
return;
//modal has to guarantee that does not lock the mutex of window_manager before invokeing the pump_event,
//otherwise, the modal will prevent the other thread access the window.
restrict::bedrock.pump_event(wd, true);
}
void wait_for(window wd)
{
if (wd)
internal_scope_guard lock;
if (restrict::wd_manager().available(reinterpret_cast<basic_window*>(wd)))
restrict::bedrock.pump_event(wd, false);
}