ClientManager: use lifo behaviour for free windows

This commit is contained in:
Maxime Coste 2014-01-29 19:15:50 +00:00
parent cdcdd41328
commit 209a4a3ddf

View File

@ -83,7 +83,7 @@ void ClientManager::remove_client(Client& client)
WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
{
for (auto it = m_free_windows.begin(), end = m_free_windows.end();
for (auto it = m_free_windows.rbegin(), end = m_free_windows.rend();
it != end; ++it)
{
auto& w = it->window;
@ -91,7 +91,7 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
{
w->forget_timestamp();
WindowAndSelections res = std::move(*it);
m_free_windows.erase(it);
m_free_windows.erase(it.base()-1);
return res;
}
}