Added toggleScreen function, using hot key to loop through all screens.

Comparing to switchToScreen, it is more handy since the user only need
to hit one hotkey.
This commit is contained in:
zhexiwang
2020-06-02 21:49:06 +08:00
parent dbd10820c3
commit b477efa706
11 changed files with 112 additions and 5 deletions

View File

@@ -163,6 +163,10 @@ Server::Server(
m_inputFilter,
new TMethodEventJob<Server>(this,
&Server::handleSwitchToScreenEvent));
m_events->adoptHandler(m_events->forServer().toggleScreen(),
m_inputFilter,
new TMethodEventJob<Server>(this,
&Server::handleToggleScreenEvent));
m_events->adoptHandler(m_events->forServer().switchInDirection(),
m_inputFilter,
new TMethodEventJob<Server>(this,
@@ -1407,6 +1411,24 @@ Server::handleSwitchToScreenEvent(const Event& event, void*)
}
}
void
Server::handleToggleScreenEvent(const Event& event, void*)
{
std::string current = getName(m_active);
ClientList::const_iterator index = m_clients.find(current);
if (index == m_clients.end()) {
LOG((CLOG_DEBUG1 "screen \"%s\" not active", current.c_str()));
}
else {
++index;
if (index == m_clients.end()) {
index = m_clients.begin();
}
jumpToScreen(index->second);
}
}
void
Server::handleSwitchInDirectionEvent(const Event& event, void*)
{