Added hack to handle "half-duplex" caps-lock key on powerbook.

That key only reports press when pressed and released when
caps-lock is activated and only reports release when pressed
and released when caps-lock is deactivated.  I don't know of a
way to detect this behavior so it may have to be configured by
the user.  The code assumes normal behavior;  will have to add
code to set the flag (perhaps from a user configuration).
This commit is contained in:
crs 2002-04-26 20:12:55 +00:00
parent 419eadfaf9
commit 242109d430
2 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,8 @@
#include <assert.h>
#include <X11/X.h>
#include <X11/Xutil.h>
#define XK_MISCELLANY
#include <X11/keysymdef.h>
//
// CXWindowsPrimaryScreen
@ -54,6 +56,8 @@ void CXWindowsPrimaryScreen::run()
const KeyID key = mapKey(&xevent.xkey);
if (key != kKeyNone) {
m_server->onKeyDown(key, mask);
if (key == XK_Caps_Lock && m_capsLockHalfDuplex)
m_server->onKeyUp(key, mask | KeyModifierCapsLock);
}
break;
}
@ -65,6 +69,8 @@ void CXWindowsPrimaryScreen::run()
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
const KeyID key = mapKey(&xevent.xkey);
if (key != kKeyNone) {
if (key == XK_Caps_Lock && m_capsLockHalfDuplex)
m_server->onKeyDown(key, mask);
m_server->onKeyUp(key, mask);
}
break;
@ -193,6 +199,11 @@ void CXWindowsPrimaryScreen::open(CServer* server)
// open the display
openDisplay();
// check for peculiarities
// FIXME -- may have to get these from some database
m_capsLockHalfDuplex = false;
// m_capsLockHalfDuplex = true;
}
void CXWindowsPrimaryScreen::close()

View File

@ -43,6 +43,8 @@ class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
CServer* m_server;
bool m_active;
Window m_window;
bool m_capsLockHalfDuplex;
};
#endif