From b09aae8579d57defadaa39ebc5566ddb68799506 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 5 Apr 2007 16:07:01 +0000 Subject: changed caps lock detection to use LockMask, so the actual key can be used for Mod4, etc. --- ChangeLog | 3 +++ src/FbTk/KeyUtil.cc | 14 ++++++-------- src/FbTk/KeyUtil.hh | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9733ca4..3bf652a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0.0: +*07/04/05: + * Adjusted detection of Caps Lock key (Mark) + FbTk/KeyUtil.cc/hh *07/04/01: * Fixed a problem with windows being created in iconic state (Mark) Window.cc Screen.cc fluxbox.cc diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc index 6985139..abf91fe 100644 --- a/src/FbTk/KeyUtil.cc +++ b/src/FbTk/KeyUtil.cc @@ -62,7 +62,7 @@ KeyUtil &KeyUtil::instance() { KeyUtil::KeyUtil() - : m_modmap(0), m_capslock(0), m_numlock(0), m_scrolllock(0) + : m_modmap(0), m_numlock(0), m_scrolllock(0) { init(); } @@ -93,9 +93,9 @@ void KeyUtil::loadModmap() { m_modmap->modifiermap[realkey], 0); switch (ks) { - case XK_Caps_Lock: - m_capslock = modlist[i].mask; - break; + // we just want to clean the Lock modifier, not specifically the + // XK_Caps_Lock key + // the others tend to vary from distro to distro, though case XK_Scroll_Lock: m_scrolllock = modlist[i].mask; break; @@ -114,13 +114,12 @@ void KeyUtil::loadModmap() { */ void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { Display *display = App::instance()->display(); - const unsigned int capsmod = instance().capslock(); const unsigned int nummod = instance().numlock(); const unsigned int scrollmod = instance().scrolllock(); // Grab with numlock, capslock and scrlock for (int i = 0; i < 8; i++) { - XGrabKey(display, key, mod | (i & 1 ? capsmod : 0) | + XGrabKey(display, key, mod | (i & 1 ? LockMask : 0) | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), win, True, GrabModeAsync, GrabModeAsync); } @@ -130,13 +129,12 @@ void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win, unsigned int event_mask, Cursor cursor) { Display *display = App::instance()->display(); - const unsigned int capsmod = instance().capslock(); const unsigned int nummod = instance().numlock(); const unsigned int scrollmod = instance().scrolllock(); // Grab with numlock, capslock and scrlock for (int i = 0; i < 8; i++) { - XGrabButton(display, button, mod | (i & 1 ? capsmod : 0) | + XGrabButton(display, button, mod | (i & 1 ? LockMask : 0) | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), win, False, event_mask, GrabModeAsync, GrabModeAsync, None, cursor); diff --git a/src/FbTk/KeyUtil.hh b/src/FbTk/KeyUtil.hh index 4909c5a..e80918a 100644 --- a/src/FbTk/KeyUtil.hh +++ b/src/FbTk/KeyUtil.hh @@ -87,14 +87,14 @@ public: */ static unsigned int keycodeToModmask(unsigned int keycode); int numlock() const { return m_numlock; } - int capslock() const { return m_capslock; } + int capslock() const { return LockMask; } int scrolllock() const { return m_scrolllock; } private: void loadModmap(); XModifierKeymap *m_modmap; - int m_capslock, m_numlock, m_scrolllock; + int m_numlock, m_scrolllock; static std::auto_ptr s_keyutil; }; -- cgit v0.11.2