aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Keys.cc')
-rw-r--r--src/Keys.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index 7187c47..76224ef 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -23,6 +23,8 @@
23 23
24#include "fluxbox.hh" 24#include "fluxbox.hh"
25#include "Screen.hh" 25#include "Screen.hh"
26#include "WinClient.hh"
27#include "WindowCmd.hh"
26 28
27#include "FbTk/EventManager.hh" 29#include "FbTk/EventManager.hh"
28#include "FbTk/StringUtil.hh" 30#include "FbTk/StringUtil.hh"
@@ -119,7 +121,7 @@ public:
119 context_ = context_ ? context_ : GLOBAL; 121 context_ = context_ ? context_ : GLOBAL;
120 keylist_t::iterator it = keylist.begin(), it_end = keylist.end(); 122 keylist_t::iterator it = keylist.begin(), it_end = keylist.end();
121 for (; it != it_end; it++) { 123 for (; it != it_end; it++) {
122 if ((*it)->type == type_ && (*it)->key == key_ && 124 if (*it && (*it)->type == type_ && (*it)->key == key_ &&
123 ((*it)->context & context_) > 0 && 125 ((*it)->context & context_) > 0 &&
124 isdouble_ == (*it)->isdouble && (*it)->mod == 126 isdouble_ == (*it)->isdouble && (*it)->mod ==
125 FbTk::KeyUtil::instance().isolateModifierMask(mod_)) 127 FbTk::KeyUtil::instance().isolateModifierMask(mod_))
@@ -168,7 +170,7 @@ Keys::t_key::~t_key() {
168 170
169 171
170 172
171Keys::Keys() { } 173Keys::Keys() : next_key(0) { }
172 174
173Keys::~Keys() { 175Keys::~Keys() {
174 ungrabKeys(); 176 ungrabKeys();
@@ -181,6 +183,7 @@ void Keys::deleteTree() {
181 for (keyspace_t::iterator map_it = m_map.begin(); map_it != m_map.end(); ++map_it) 183 for (keyspace_t::iterator map_it = m_map.begin(); map_it != m_map.end(); ++map_it)
182 delete map_it->second; 184 delete map_it->second;
183 m_map.clear(); 185 m_map.clear();
186 next_key = 0;
184} 187}
185 188
186// keys are only grabbed in global context 189// keys are only grabbed in global context
@@ -479,7 +482,7 @@ bool Keys::addBinding(const string &linebuffer) {
479 482
480// return true if bound to a command, else false 483// return true if bound to a command, else false
481bool Keys::doAction(int type, unsigned int mods, unsigned int key, 484bool Keys::doAction(int type, unsigned int mods, unsigned int key,
482 int context, Time time) { 485 int context, WinClient *current, Time time) {
483 486
484 static Time last_button_time = 0; 487 static Time last_button_time = 0;
485 static unsigned int last_button = 0; 488 static unsigned int last_button = 0;
@@ -502,7 +505,6 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
502 isdouble = double_click; 505 isdouble = double_click;
503 } 506 }
504 507
505 static t_key* next_key = m_keylist;
506 if (!next_key) 508 if (!next_key)
507 next_key = m_keylist; 509 next_key = m_keylist;
508 510
@@ -546,7 +548,11 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
546 return false; 548 return false;
547 } 549 }
548 550
551 WinClient *old = WindowCmd<void>::client();
552 WindowCmd<void>::setClient(current);
549 temp_key->m_command->execute(); 553 temp_key->m_command->execute();
554 WindowCmd<void>::setClient(old);
555
550 if (saved_keymode) { 556 if (saved_keymode) {
551 if (next_key == m_keylist) // don't reset keymode if command changed it 557 if (next_key == m_keylist) // don't reset keymode if command changed it
552 setKeyMode(saved_keymode); 558 setKeyMode(saved_keymode);