diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/FbTk/KeyUtil.cc | 14 | ||||
-rw-r--r-- | src/FbTk/KeyUtil.hh | 4 |
3 files changed, 11 insertions, 10 deletions
@@ -1,5 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.0.0: | 2 | Changes for 1.0.0: |
3 | *07/04/05: | ||
4 | * Adjusted detection of Caps Lock key (Mark) | ||
5 | FbTk/KeyUtil.cc/hh | ||
3 | *07/04/01: | 6 | *07/04/01: |
4 | * Fixed a problem with windows being created in iconic state (Mark) | 7 | * Fixed a problem with windows being created in iconic state (Mark) |
5 | Window.cc Screen.cc fluxbox.cc | 8 | 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() { | |||
62 | 62 | ||
63 | 63 | ||
64 | KeyUtil::KeyUtil() | 64 | KeyUtil::KeyUtil() |
65 | : m_modmap(0), m_capslock(0), m_numlock(0), m_scrolllock(0) | 65 | : m_modmap(0), m_numlock(0), m_scrolllock(0) |
66 | { | 66 | { |
67 | init(); | 67 | init(); |
68 | } | 68 | } |
@@ -93,9 +93,9 @@ void KeyUtil::loadModmap() { | |||
93 | m_modmap->modifiermap[realkey], 0); | 93 | m_modmap->modifiermap[realkey], 0); |
94 | 94 | ||
95 | switch (ks) { | 95 | switch (ks) { |
96 | case XK_Caps_Lock: | 96 | // we just want to clean the Lock modifier, not specifically the |
97 | m_capslock = modlist[i].mask; | 97 | // XK_Caps_Lock key |
98 | break; | 98 | // the others tend to vary from distro to distro, though |
99 | case XK_Scroll_Lock: | 99 | case XK_Scroll_Lock: |
100 | m_scrolllock = modlist[i].mask; | 100 | m_scrolllock = modlist[i].mask; |
101 | break; | 101 | break; |
@@ -114,13 +114,12 @@ void KeyUtil::loadModmap() { | |||
114 | */ | 114 | */ |
115 | void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { | 115 | void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { |
116 | Display *display = App::instance()->display(); | 116 | Display *display = App::instance()->display(); |
117 | const unsigned int capsmod = instance().capslock(); | ||
118 | const unsigned int nummod = instance().numlock(); | 117 | const unsigned int nummod = instance().numlock(); |
119 | const unsigned int scrollmod = instance().scrolllock(); | 118 | const unsigned int scrollmod = instance().scrolllock(); |
120 | 119 | ||
121 | // Grab with numlock, capslock and scrlock | 120 | // Grab with numlock, capslock and scrlock |
122 | for (int i = 0; i < 8; i++) { | 121 | for (int i = 0; i < 8; i++) { |
123 | XGrabKey(display, key, mod | (i & 1 ? capsmod : 0) | | 122 | XGrabKey(display, key, mod | (i & 1 ? LockMask : 0) | |
124 | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), | 123 | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), |
125 | win, True, GrabModeAsync, GrabModeAsync); | 124 | win, True, GrabModeAsync, GrabModeAsync); |
126 | } | 125 | } |
@@ -130,13 +129,12 @@ void KeyUtil::grabKey(unsigned int key, unsigned int mod, Window win) { | |||
130 | void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win, | 129 | void KeyUtil::grabButton(unsigned int button, unsigned int mod, Window win, |
131 | unsigned int event_mask, Cursor cursor) { | 130 | unsigned int event_mask, Cursor cursor) { |
132 | Display *display = App::instance()->display(); | 131 | Display *display = App::instance()->display(); |
133 | const unsigned int capsmod = instance().capslock(); | ||
134 | const unsigned int nummod = instance().numlock(); | 132 | const unsigned int nummod = instance().numlock(); |
135 | const unsigned int scrollmod = instance().scrolllock(); | 133 | const unsigned int scrollmod = instance().scrolllock(); |
136 | 134 | ||
137 | // Grab with numlock, capslock and scrlock | 135 | // Grab with numlock, capslock and scrlock |
138 | for (int i = 0; i < 8; i++) { | 136 | for (int i = 0; i < 8; i++) { |
139 | XGrabButton(display, button, mod | (i & 1 ? capsmod : 0) | | 137 | XGrabButton(display, button, mod | (i & 1 ? LockMask : 0) | |
140 | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), | 138 | (i & 2 ? nummod : 0) | (i & 4 ? scrollmod : 0), |
141 | win, False, event_mask, GrabModeAsync, GrabModeAsync, | 139 | win, False, event_mask, GrabModeAsync, GrabModeAsync, |
142 | None, cursor); | 140 | 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: | |||
87 | */ | 87 | */ |
88 | static unsigned int keycodeToModmask(unsigned int keycode); | 88 | static unsigned int keycodeToModmask(unsigned int keycode); |
89 | int numlock() const { return m_numlock; } | 89 | int numlock() const { return m_numlock; } |
90 | int capslock() const { return m_capslock; } | 90 | int capslock() const { return LockMask; } |
91 | int scrolllock() const { return m_scrolllock; } | 91 | int scrolllock() const { return m_scrolllock; } |
92 | 92 | ||
93 | private: | 93 | private: |
94 | void loadModmap(); | 94 | void loadModmap(); |
95 | 95 | ||
96 | XModifierKeymap *m_modmap; | 96 | XModifierKeymap *m_modmap; |
97 | int m_capslock, m_numlock, m_scrolllock; | 97 | int m_numlock, m_scrolllock; |
98 | static std::auto_ptr<KeyUtil> s_keyutil; | 98 | static std::auto_ptr<KeyUtil> s_keyutil; |
99 | }; | 99 | }; |
100 | 100 | ||