diff options
Diffstat (limited to 'src/ShortcutManager.cc')
-rw-r--r-- | src/ShortcutManager.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/ShortcutManager.cc b/src/ShortcutManager.cc new file mode 100644 index 0000000..52e94af --- /dev/null +++ b/src/ShortcutManager.cc | |||
@@ -0,0 +1,45 @@ | |||
1 | #include "ShortcutManager.hh" | ||
2 | #include "Debug.hh" | ||
3 | |||
4 | #include <iostream> | ||
5 | |||
6 | ShortcutManager::ShortcutManager() : m_last_placeholder_key(0) { } | ||
7 | |||
8 | void ShortcutManager::setLastPlaceHolderKey(unsigned int lastPlaceHolderKey_) | ||
9 | { | ||
10 | m_last_placeholder_key = lastPlaceHolderKey_; | ||
11 | } | ||
12 | |||
13 | unsigned int ShortcutManager::getLastPlaceHolderKey() | ||
14 | { | ||
15 | return m_last_placeholder_key; | ||
16 | } | ||
17 | |||
18 | void ShortcutManager::mapKeyToWindow(unsigned int key, FluxboxWindow* window) | ||
19 | { | ||
20 | m_key_to_window_map.insert(std::make_pair(key, window)); | ||
21 | } | ||
22 | |||
23 | void ShortcutManager::removeWindow(FluxboxWindow* window) | ||
24 | { | ||
25 | KeyToWindowMap::const_iterator it; | ||
26 | for (it = m_key_to_window_map.begin(); it != m_key_to_window_map.end(); ++it) { | ||
27 | if (it->second == window){ | ||
28 | fbdbg << "Remove mapping window[" << window | ||
29 | << "] key [" << it->first << "]" << std::endl; | ||
30 | m_key_to_window_map.erase(it); | ||
31 | return; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | FluxboxWindow* ShortcutManager::getWindowForKey(unsigned int key) | ||
37 | { | ||
38 | KeyToWindowMap::const_iterator it = m_key_to_window_map.find(key); | ||
39 | if (it != m_key_to_window_map.end()) { | ||
40 | return it->second; | ||
41 | } | ||
42 | else { | ||
43 | return nullptr; | ||
44 | } | ||
45 | } | ||