aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Keys.cc')
-rw-r--r--src/Keys.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index 7e6c93e..2d26ab8 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -168,6 +168,7 @@ void Keys::grabWindow(Window win) {
168 if (win_it == m_window_map.end()) 168 if (win_it == m_window_map.end())
169 return; 169 return;
170 170
171 m_handler_map[win]->grabButtons();
171 keylist_t::iterator it = m_keylist->keylist.begin(); 172 keylist_t::iterator it = m_keylist->keylist.begin();
172 keylist_t::iterator it_end = m_keylist->keylist.end(); 173 keylist_t::iterator it_end = m_keylist->keylist.end();
173 for (; it != it_end; ++it) { 174 for (; it != it_end; ++it) {
@@ -428,8 +429,9 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
428} 429}
429 430
430/// adds the window to m_window_map, so we know to grab buttons on it 431/// adds the window to m_window_map, so we know to grab buttons on it
431void Keys::registerWindow(Window win, int context) { 432void Keys::registerWindow(Window win, FbTk::EventHandler &h, int context) {
432 m_window_map[win] = context; 433 m_window_map[win] = context;
434 m_handler_map[win] = &h;
433 grabWindow(win); 435 grabWindow(win);
434} 436}
435 437
@@ -437,6 +439,7 @@ void Keys::registerWindow(Window win, int context) {
437void Keys::unregisterWindow(Window win) { 439void Keys::unregisterWindow(Window win) {
438 FbTk::KeyUtil::ungrabKeys(win); 440 FbTk::KeyUtil::ungrabKeys(win);
439 FbTk::KeyUtil::ungrabButtons(win); 441 FbTk::KeyUtil::ungrabButtons(win);
442 m_handler_map.erase(win);
440 m_window_map.erase(win); 443 m_window_map.erase(win);
441} 444}
442 445
@@ -459,6 +462,13 @@ void Keys::keyMode(string keyMode) {
459void Keys::setKeyMode(t_key *keyMode) { 462void Keys::setKeyMode(t_key *keyMode) {
460 ungrabKeys(); 463 ungrabKeys();
461 ungrabButtons(); 464 ungrabButtons();
465
466 // notify handlers that their buttons have been ungrabbed
467 HandlerMap::iterator h_it = m_handler_map.begin(),
468 h_it_end = m_handler_map.end();
469 for (; h_it != h_it_end; ++h_it)
470 h_it->second->grabButtons();
471
462 keylist_t::iterator it = keyMode->keylist.begin(); 472 keylist_t::iterator it = keyMode->keylist.begin();
463 keylist_t::iterator it_end = keyMode->keylist.end(); 473 keylist_t::iterator it_end = keyMode->keylist.end();
464 for (; it != it_end; ++it) { 474 for (; it != it_end; ++it) {