From 242109d430bce63c325679c213d5c5f4f4219a6a Mon Sep 17 00:00:00 2001 From: crs Date: Fri, 26 Apr 2002 20:12:55 +0000 Subject: [PATCH] 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). --- server/CXWindowsPrimaryScreen.cpp | 11 +++++++++++ server/CXWindowsPrimaryScreen.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/server/CXWindowsPrimaryScreen.cpp b/server/CXWindowsPrimaryScreen.cpp index cd8d736a..2f1efaa9 100644 --- a/server/CXWindowsPrimaryScreen.cpp +++ b/server/CXWindowsPrimaryScreen.cpp @@ -5,6 +5,8 @@ #include #include #include +#define XK_MISCELLANY +#include // // 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() diff --git a/server/CXWindowsPrimaryScreen.h b/server/CXWindowsPrimaryScreen.h index a0a1b9c8..562f9048 100644 --- a/server/CXWindowsPrimaryScreen.h +++ b/server/CXWindowsPrimaryScreen.h @@ -43,6 +43,8 @@ class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen { CServer* m_server; bool m_active; Window m_window; + + bool m_capsLockHalfDuplex; }; #endif