diff options
author | Jami Kettunen <jami.kettunen@protonmail.com> | 2020-01-01 19:07:53 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-01 18:10:50 +0100 |
commit | dfd759f75a76e6827ba4ad26b05da0aa1b14b3e4 (patch) | |
tree | 23baa1490d58deb14445320fa7ced7f01022b07c /Servers/WindowServer | |
parent | 58517bc0682232287b3c90e10021c30bd33c6c00 (diff) | |
download | serenity-dfd759f75a76e6827ba4ad26b05da0aa1b14b3e4.zip |
WindowServer: Implement switching windows in reverse order
Diffstat (limited to 'Servers/WindowServer')
-rw-r--r-- | Servers/WindowServer/WSWindowManager.cpp | 3 | ||||
-rw-r--r-- | Servers/WindowServer/WSWindowSwitcher.cpp | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index d40d38ea20..41fec072ab 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -1065,7 +1065,8 @@ void WSWindowManager::event(CEvent& event) return; } - if (key_event.type() == WSEvent::KeyDown && key_event.modifiers() == Mod_Logo && key_event.key() == Key_Tab) + if (key_event.type() == WSEvent::KeyDown && ((key_event.modifiers() == Mod_Logo && key_event.key() == Key_Tab) || + (key_event.modifiers() == (Mod_Logo | Mod_Shift) && key_event.key() == Key_Tab))) m_switcher.show(); if (m_switcher.is_visible()) { m_switcher.on_key_event(key_event); diff --git a/Servers/WindowServer/WSWindowSwitcher.cpp b/Servers/WindowServer/WSWindowSwitcher.cpp index e79d55588f..b5eafc6726 100644 --- a/Servers/WindowServer/WSWindowSwitcher.cpp +++ b/Servers/WindowServer/WSWindowSwitcher.cpp @@ -56,13 +56,23 @@ void WSWindowSwitcher::on_key_event(const WSKeyEvent& event) } return; } + + if (event.key() == Key_LeftShift || event.key() == Key_RightShift) + return; if (event.key() != Key_Tab) { WSWindowManager::the().set_highlight_window(nullptr); hide(); return; } ASSERT(!m_windows.is_empty()); - m_selected_index = (m_selected_index + 1) % m_windows.size(); + + if (!event.shift()) { + m_selected_index = (m_selected_index + 1) % m_windows.size(); + } else { + m_selected_index = (m_selected_index - 1) % m_windows.size(); + if (m_selected_index < 0) + m_selected_index = m_windows.size() - 1; + } ASSERT(m_selected_index < m_windows.size()); auto* highlight_window = m_windows.at(m_selected_index).ptr(); ASSERT(highlight_window); |