changed caps lock detection to use LockMask, so the actual key can be used for Mod4, etc.
This commit is contained in:
parent
e89d4aa219
commit
b09aae8579
3 changed files with 11 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<KeyUtil> s_keyutil;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue