diff options
author | markt <markt> | 2007-01-05 16:54:34 (GMT) |
---|---|---|
committer | markt <markt> | 2007-01-05 16:54:34 (GMT) |
commit | 8930a711ee101c1a02f579a2ee8ebbe39065c085 (patch) | |
tree | cce01b032cb6c7e76e820590490e7c08ab758112 /src/Keys.cc | |
parent | 64fcedda00205f0c0b9464967f06322d4c7afa91 (diff) | |
download | fluxbox_pavel-8930a711ee101c1a02f579a2ee8ebbe39065c085.zip fluxbox_pavel-8930a711ee101c1a02f579a2ee8ebbe39065c085.tar.bz2 |
only grab keybindings on screens managed by fluxbox
Diffstat (limited to 'src/Keys.cc')
-rw-r--r-- | src/Keys.cc | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/Keys.cc b/src/Keys.cc index 72e3112..e7b7acd 100644 --- a/src/Keys.cc +++ b/src/Keys.cc | |||
@@ -24,6 +24,9 @@ | |||
24 | 24 | ||
25 | #include "Keys.hh" | 25 | #include "Keys.hh" |
26 | 26 | ||
27 | #include "fluxbox.hh" | ||
28 | #include "Screen.hh" | ||
29 | |||
27 | #include "FbTk/StringUtil.hh" | 30 | #include "FbTk/StringUtil.hh" |
28 | #include "FbTk/App.hh" | 31 | #include "FbTk/App.hh" |
29 | #include "FbTk/Command.hh" | 32 | #include "FbTk/Command.hh" |
@@ -99,12 +102,18 @@ using std::pair; | |||
99 | Keys::Keys(): | 102 | Keys::Keys(): |
100 | m_display(FbTk::App::instance()->display()) | 103 | m_display(FbTk::App::instance()->display()) |
101 | { | 104 | { |
105 | typedef std::list<BScreen *> ScreenList; | ||
106 | ScreenList screen_list = Fluxbox::instance()->screenList(); | ||
107 | ScreenList::iterator it = screen_list.begin(); | ||
108 | ScreenList::iterator it_end = screen_list.end(); | ||
109 | |||
110 | for (; it != it_end; ++it) | ||
111 | m_window_list.push_back(RootWindow(m_display,(*it)->screenNumber())); | ||
102 | 112 | ||
103 | } | 113 | } |
104 | 114 | ||
105 | Keys::~Keys() { | 115 | Keys::~Keys() { |
106 | 116 | ungrabKeys(); | |
107 | FbTk::KeyUtil::ungrabKeys(); | ||
108 | deleteTree(); | 117 | deleteTree(); |
109 | } | 118 | } |
110 | 119 | ||
@@ -115,6 +124,22 @@ void Keys::deleteTree() { | |||
115 | m_map.clear(); | 124 | m_map.clear(); |
116 | } | 125 | } |
117 | 126 | ||
127 | void Keys::grabKey(unsigned int key, unsigned int mod) { | ||
128 | std::list<Window>::iterator it = m_window_list.begin(); | ||
129 | std::list<Window>::iterator it_end = m_window_list.end(); | ||
130 | |||
131 | for (; it != it_end; ++it) | ||
132 | FbTk::KeyUtil::grabKey(key, mod, *it); | ||
133 | } | ||
134 | |||
135 | void Keys::ungrabKeys() { | ||
136 | std::list<Window>::iterator it = m_window_list.begin(); | ||
137 | std::list<Window>::iterator it_end = m_window_list.end(); | ||
138 | |||
139 | for (; it != it_end; ++it) | ||
140 | FbTk::KeyUtil::ungrabKeys(*it); | ||
141 | } | ||
142 | |||
118 | /** | 143 | /** |
119 | Load and grab keys | 144 | Load and grab keys |
120 | TODO: error checking | 145 | TODO: error checking |
@@ -285,7 +310,7 @@ bool Keys::doAction(XKeyEvent &ke) { | |||
285 | setKeyMode(next_key); | 310 | setKeyMode(next_key); |
286 | // grab "None Escape" to exit keychain in the middle | 311 | // grab "None Escape" to exit keychain in the middle |
287 | unsigned int esc = FbTk::KeyUtil::getKey("Escape"); | 312 | unsigned int esc = FbTk::KeyUtil::getKey("Escape"); |
288 | FbTk::KeyUtil::grabKey(esc,0); | 313 | grabKey(esc,0); |
289 | return true; | 314 | return true; |
290 | } | 315 | } |
291 | if (!temp_key || *temp_key->m_command == 0) { | 316 | if (!temp_key || *temp_key->m_command == 0) { |
@@ -323,11 +348,11 @@ void Keys::keyMode(string keyMode) { | |||
323 | } | 348 | } |
324 | 349 | ||
325 | void Keys::setKeyMode(t_key *keyMode) { | 350 | void Keys::setKeyMode(t_key *keyMode) { |
326 | FbTk::KeyUtil::ungrabKeys(); | 351 | ungrabKeys(); |
327 | keylist_t::iterator it = keyMode->keylist.begin(); | 352 | keylist_t::iterator it = keyMode->keylist.begin(); |
328 | keylist_t::iterator it_end = keyMode->keylist.end(); | 353 | keylist_t::iterator it_end = keyMode->keylist.end(); |
329 | for (; it != it_end; ++it) | 354 | for (; it != it_end; ++it) |
330 | FbTk::KeyUtil::grabKey((*it)->key,(*it)->mod); | 355 | grabKey((*it)->key,(*it)->mod); |
331 | m_keylist = keyMode; | 356 | m_keylist = keyMode; |
332 | } | 357 | } |
333 | 358 | ||