Skip to content

Instantly share code, notes, and snippets.

@ehabkost
Created June 23, 2012 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehabkost/2979345 to your computer and use it in GitHub Desktop.
Save ehabkost/2979345 to your computer and use it in GitHub Desktop.
keymap loading debugging patch
From a88cd3fb96e8c53853e65f58a7ef6105cda70341 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@raisama.net>
Date: Sat, 23 Jun 2012 15:20:42 -0300
Subject: [PATCH] extra debug messages to debug dead key handing on OS X
Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
---
src/lib/platform/COSXKeyState.cpp | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/lib/platform/COSXKeyState.cpp b/src/lib/platform/COSXKeyState.cpp
index 03b6046..bbc5b77 100644
--- a/src/lib/platform/COSXKeyState.cpp
+++ b/src/lib/platform/COSXKeyState.cpp
@@ -626,6 +626,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap,
for (UInt32 j = 0; j < r.getNumTables(); ++j) {
buttonKeys[j].first = r.getKey(j, i);
buttonKeys[j].second = CKeyMap::isDeadKey(buttonKeys[j].first);
+ LOG((CLOG_DEBUG3 "getKey(%04x, %04x) = %04x (dead: %s)", j, i, buttonKeys[j].first, buttonKeys[j].second?"yes":"no"));
}
// iterate over each character table
@@ -710,6 +711,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap,
for (std::set<UInt32>::iterator k = required.begin();
k != required.end(); ++k) {
item.m_required = mapModifiersFromCarbon(*k << 8);
+ LOG((CLOG_DEBUG3 "will add key entry for key ID %04x", item.m_id));
keyMap.addKeyEntry(item);
}
}
@@ -1189,6 +1191,7 @@ COSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const
m_cti->keyToCharTableOffsets[table]);
const UCKeyOutput c = cPtr[button];
+ LOG((CLOG_DEBUG3 "key output for button %04x is %04x", button, c));
KeySequence keys;
switch (c & kUCKeyOutputTestForIndexMask) {
@@ -1218,6 +1221,8 @@ bool
COSXKeyState::CUCHRKeyResource::getDeadKey(
KeySequence& keys, UInt16 index) const
{
+ LOG((CLOG_DEBUG3 "getDeadKey(%04x) called", index));
+
if (m_sri == NULL || index >= m_sri->keyStateRecordCount) {
// XXX -- should we be using some other fallback?
return false;
@@ -1251,9 +1256,13 @@ COSXKeyState::CUCHRKeyResource::getDeadKey(
// convert keys to their dead counterparts
for (KeySequence::iterator i = keys.begin(); i != keys.end(); ++i) {
+ LOG((CLOG_DEBUG3 "key seq for dead key: %04x", *i));
*i = CKeyMap::getDeadKey(*i);
+ LOG((CLOG_DEBUG3 "key translated to: %04x", *i));
}
+ LOG((CLOG_DEBUG3 "getDeadKey(%04x) is true", index));
+
return true;
}
--
1.7.7.5 (Apple Git-26)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment