all repos — fluxbox @ 22f3df9aa81efc071cb13d43a372ead97548eebc

custom fork of the fluxbox windowmanager

break keychains after an invalid key is pressed (which unfortunately will be swallowed)
Mark Tiefenbruck mark@fluxbox.org
commit

22f3df9aa81efc071cb13d43a372ead97548eebc

parent

c91926cf71dcaaea2cf6e56e74b1de50ff17f6f5

4 files changed, 15 insertions(+), 12 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 1.1.2 *08/10/04: + * Break emacs-style keychains after one invalid key has been pressed (Mark) + Screen.cc Keys.cc/hh * Fix flickering of shaped windows, #2131548 and #2001027 (Mark) FbTk/Shape.cc *08/10/01:
M src/Keys.ccsrc/Keys.cc

@@ -170,7 +170,9 @@ }

-Keys::Keys(): m_reloader(new FbTk::AutoReloadHelper()), next_key(0) { +Keys::Keys(): + m_reloader(new FbTk::AutoReloadHelper()), + next_key(0), saved_keymode(0) { m_reloader->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<Keys>(*this, &Keys::reload))); }

@@ -187,6 +189,7 @@ for (keyspace_t::iterator map_it = m_map.begin(); map_it != m_map.end(); ++map_it)

delete map_it->second; m_map.clear(); next_key = 0; + saved_keymode = 0; } // keys are only grabbed in global context

@@ -504,22 +507,16 @@ // click commands

if (!temp_key && isdouble) temp_key = next_key->find(type, mods, key, context, false); - // need to save this for emacs-style keybindings - static t_key *saved_keymode = 0; - - // grab "None Escape" to exit keychain in the middle - unsigned int esc = FbTk::KeyUtil::getKey("Escape"); - if (temp_key && !temp_key->keylist.empty()) { // emacs-style if (!saved_keymode) saved_keymode = m_keylist; next_key = temp_key; setKeyMode(next_key); - grabKey(esc,0); return true; } if (!temp_key || *temp_key->m_command == 0) { - if (type == KeyPress && key == esc && mods == 0) { + if (type == KeyPress && + !FbTk::KeyUtil::instance().keycodeToModmask(key)) { // if we're in the middle of an emacs-style keychain, exit it next_key = 0; if (saved_keymode) {
M src/Keys.hhsrc/Keys.hh

@@ -83,6 +83,9 @@ Reload configuration if keys file has changed

*/ void reconfigure(); void keyMode(const std::string& keyMode); + + bool inKeychain() const { return saved_keymode != 0; } + private: class t_key; // helper class to build a 'keytree' typedef std::map<std::string, t_key *> keyspace_t;

@@ -109,7 +112,7 @@ t_key *m_keylist;

keyspace_t m_map; // former doAction static var, we need to access it from deleteTree - t_key *next_key; + t_key *next_key, *saved_keymode; WindowMap m_window_map; HandlerMap m_handler_map;
M src/Screen.ccsrc/Screen.cc

@@ -856,6 +856,7 @@ void BScreen::keyPressEvent(XKeyEvent &ke) {

if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, Keys::GLOBAL|Keys::ON_DESKTOP)) // re-grab keyboard, so we don't pass KeyRelease to clients + // also for catching invalid keys in the middle of keychains FbTk::EventManager::instance()->grabKeyboard(rootWindow().window()); }

@@ -871,8 +872,8 @@

m_cycling = false; focusControl().stopCyclingFocus(); } - - FbTk::EventManager::instance()->ungrabKeyboard(); + if (!Fluxbox::instance()->keys()->inKeychain()) + FbTk::EventManager::instance()->ungrabKeyboard(); } void BScreen::buttonPressEvent(XButtonEvent &be) {