break keychains after an invalid key is pressed (which unfortunately will be swallowed)
This commit is contained in:
parent
c91926cf71
commit
22f3df9aa8
4 changed files with 15 additions and 12 deletions
|
@ -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:
|
||||
|
|
15
src/Keys.cc
15
src/Keys.cc
|
@ -170,7 +170,9 @@ Keys::t_key::~t_key() {
|
|||
|
||||
|
||||
|
||||
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 @@ void Keys::deleteTree() {
|
|||
delete map_it->second;
|
||||
m_map.clear();
|
||||
next_key = 0;
|
||||
saved_keymode = 0;
|
||||
}
|
||||
|
||||
// keys are only grabbed in global context
|
||||
|
@ -504,22 +507,16 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
|
|||
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) {
|
||||
|
|
|
@ -83,6 +83,9 @@ public:
|
|||
*/
|
||||
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 @@ private:
|
|||
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;
|
||||
|
|
|
@ -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 @@ void BScreen::keyReleaseEvent(XKeyEvent &ke) {
|
|||
m_cycling = false;
|
||||
focusControl().stopCyclingFocus();
|
||||
}
|
||||
|
||||
FbTk::EventManager::instance()->ungrabKeyboard();
|
||||
if (!Fluxbox::instance()->keys()->inKeychain())
|
||||
FbTk::EventManager::instance()->ungrabKeyboard();
|
||||
}
|
||||
|
||||
void BScreen::buttonPressEvent(XButtonEvent &be) {
|
||||
|
|
Loading…
Reference in a new issue