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

View File

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