Cleanup and changed some DEBUG1 messages to DEBUG2.
This commit is contained in:
parent
0ab692a8e8
commit
eda93fc20d
|
@ -268,7 +268,6 @@ CXWindowsSecondaryScreen::onPostOpen()
|
||||||
m_capsLockHalfDuplex = false;
|
m_capsLockHalfDuplex = false;
|
||||||
// m_numLockHalfDuplex = true;
|
// m_numLockHalfDuplex = true;
|
||||||
// m_capsLockHalfDuplex = true;
|
// m_capsLockHalfDuplex = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -438,7 +437,7 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||||
// keysym with that mask. we override the bits in the mask
|
// keysym with that mask. we override the bits in the mask
|
||||||
// that cannot be accomodated.
|
// that cannot be accomodated.
|
||||||
|
|
||||||
// note if the key is the caps lock and it's "half-duplex"
|
// note if the key is "half-duplex"
|
||||||
const bool isHalfDuplex = ((id == kKeyCapsLock && m_capsLockHalfDuplex) ||
|
const bool isHalfDuplex = ((id == kKeyCapsLock && m_capsLockHalfDuplex) ||
|
||||||
(id == kKeyNumLock && m_numLockHalfDuplex));
|
(id == kKeyNumLock && m_numLockHalfDuplex));
|
||||||
|
|
||||||
|
@ -452,6 +451,7 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||||
KeyCodeIndex keyIndex = findKey(id, outMask);
|
KeyCodeIndex keyIndex = findKey(id, outMask);
|
||||||
if (keyIndex == noKey()) {
|
if (keyIndex == noKey()) {
|
||||||
// cannot convert id to keysym
|
// cannot convert id to keysym
|
||||||
|
LOG((CLOG_DEBUG2 "no keysym for key"));
|
||||||
return m_mask;
|
return m_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,28 +490,27 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||||
// keys affected by CapsLock.
|
// keys affected by CapsLock.
|
||||||
bool desireShift = (getBits(desired, ShiftMask) != 0);
|
bool desireShift = (getBits(desired, ShiftMask) != 0);
|
||||||
bool invertShift = false;
|
bool invertShift = false;
|
||||||
LOG((CLOG_DEBUG1 "desire shift 1: %s", desireShift?"yes":"no"));
|
LOG((CLOG_DEBUG2 "desire shift: %s", desireShift ? "yes" : "no"));
|
||||||
if (adjustForNumLock(keysym)) {
|
if (adjustForNumLock(keysym)) {
|
||||||
LOG((CLOG_DEBUG1 "num lock sensitive"));
|
LOG((CLOG_DEBUG2 "num lock sensitive"));
|
||||||
if (m_numLockMask != 0) {
|
if (m_numLockMask != 0) {
|
||||||
LOG((CLOG_DEBUG1 "we have num lock"));
|
LOG((CLOG_DEBUG2 "we have num lock"));
|
||||||
if (getBits(desired, m_numLockMask) != 0) {
|
if (getBits(desired, m_numLockMask) != 0) {
|
||||||
LOG((CLOG_DEBUG1 "num lock desired, invert shift"));
|
LOG((CLOG_DEBUG2 "num lock desired, invert shift"));
|
||||||
invertShift = true;
|
invertShift = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (adjustForCapsLock(keysym)) {
|
else if (adjustForCapsLock(keysym)) {
|
||||||
LOG((CLOG_DEBUG1 "caps lock sensitive"));
|
LOG((CLOG_DEBUG2 "caps lock sensitive"));
|
||||||
if (m_capsLockMask != 0) {
|
if (m_capsLockMask != 0) {
|
||||||
LOG((CLOG_DEBUG1 "we have caps lock"));
|
LOG((CLOG_DEBUG2 "we have caps lock"));
|
||||||
if (getBits(desired, m_capsLockMask) != 0) {
|
if (getBits(desired, m_capsLockMask) != 0) {
|
||||||
LOG((CLOG_DEBUG1 "caps lock desired, invert shift"));
|
LOG((CLOG_DEBUG2 "caps lock desired, invert shift"));
|
||||||
invertShift = true;
|
invertShift = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
|
|
||||||
if (desireShift != invertShift) {
|
if (desireShift != invertShift) {
|
||||||
index[0] ^= 1;
|
index[0] ^= 1;
|
||||||
index[1] ^= 1;
|
index[1] ^= 1;
|
||||||
|
@ -538,7 +537,7 @@ LOG((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
|
||||||
|
|
||||||
// get the keycode
|
// get the keycode
|
||||||
keycode = entry.m_keycode[bestIndex];
|
keycode = entry.m_keycode[bestIndex];
|
||||||
LOG((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
|
LOG((CLOG_DEBUG2 "bestIndex = %d, keycode = %d", bestIndex, keycode));
|
||||||
|
|
||||||
// note if the key is a modifier
|
// note if the key is a modifier
|
||||||
ModifierMap::const_iterator modIndex = m_keycodeToModifier.find(keycode);
|
ModifierMap::const_iterator modIndex = m_keycodeToModifier.find(keycode);
|
||||||
|
@ -553,13 +552,13 @@ LOG((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
|
||||||
// though.
|
// though.
|
||||||
if (modifierBit != 0) {
|
if (modifierBit != 0) {
|
||||||
if (action == kRepeat) {
|
if (action == kRepeat) {
|
||||||
LOG((CLOG_DEBUG1 "ignore repeating modifier"));
|
LOG((CLOG_DEBUG2 "ignore repeating modifier"));
|
||||||
return m_mask;
|
return m_mask;
|
||||||
}
|
}
|
||||||
if (getBits(m_toggleModifierMask, modifierBit) == 0) {
|
if (getBits(m_toggleModifierMask, modifierBit) == 0) {
|
||||||
if ((action == kPress && (m_mask & modifierBit) != 0) ||
|
if ((action == kPress && (m_mask & modifierBit) != 0) ||
|
||||||
(action == kRelease && (m_mask & modifierBit) == 0)) {
|
(action == kRelease && (m_mask & modifierBit) == 0)) {
|
||||||
LOG((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
|
LOG((CLOG_DEBUG2 "modifier in proper state: 0x%04x", m_mask));
|
||||||
return m_mask;
|
return m_mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -594,7 +593,7 @@ LOG((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
|
||||||
// the same bit in m_mask, meaning it's already in the right state.
|
// the same bit in m_mask, meaning it's already in the right state.
|
||||||
desired = assignBits(desired, modifierBit, m_mask);
|
desired = assignBits(desired, modifierBit, m_mask);
|
||||||
required = clearBits(required, modifierBit);
|
required = clearBits(required, modifierBit);
|
||||||
LOG((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
|
LOG((CLOG_DEBUG2 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
|
||||||
|
|
||||||
// add the key events required to get to the modifier state
|
// add the key events required to get to the modifier state
|
||||||
// necessary to generate an event yielding id. also save the
|
// necessary to generate an event yielding id. also save the
|
||||||
|
@ -607,13 +606,13 @@ LOG((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
|
||||||
for (unsigned int i = 0; i < 8; ++i) {
|
for (unsigned int i = 0; i < 8; ++i) {
|
||||||
unsigned int bit = (1 << i);
|
unsigned int bit = (1 << i);
|
||||||
if (getBits(desired, bit) != getBits(m_mask, bit)) {
|
if (getBits(desired, bit) != getBits(m_mask, bit)) {
|
||||||
LOG((CLOG_DEBUG1 "fix modifier %d", i));
|
LOG((CLOG_DEBUG2 "fix modifier %d", i));
|
||||||
// get the keycode we're using for this modifier. if
|
// get the keycode we're using for this modifier. if
|
||||||
// there isn't one then bail if the modifier is required
|
// there isn't one then bail if the modifier is required
|
||||||
// or ignore it if not required.
|
// or ignore it if not required.
|
||||||
KeyCode modifierKey = m_modifierToKeycode[i];
|
KeyCode modifierKey = m_modifierToKeycode[i];
|
||||||
if (modifierKey == 0) {
|
if (modifierKey == 0) {
|
||||||
LOG((CLOG_DEBUG1 "no key mapped to modifier 0x%04x", bit));
|
LOG((CLOG_DEBUG2 "no key mapped to modifier 0x%04x", bit));
|
||||||
if (getBits(required, bit) != 0) {
|
if (getBits(required, bit) != 0) {
|
||||||
keys.clear();
|
keys.clear();
|
||||||
return m_mask;
|
return m_mask;
|
||||||
|
@ -773,7 +772,7 @@ LOG((CLOG_DEBUG1 "fix modifier %d", i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG((CLOG_DEBUG1 "final mask: 0x%04x", mask));
|
LOG((CLOG_DEBUG2 "final mask: 0x%04x", mask));
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +820,6 @@ CXWindowsSecondaryScreen::doKeystrokes(const Keystrokes& keys, SInt32 count)
|
||||||
unsigned int
|
unsigned int
|
||||||
CXWindowsSecondaryScreen::maskToX(KeyModifierMask inMask) const
|
CXWindowsSecondaryScreen::maskToX(KeyModifierMask inMask) const
|
||||||
{
|
{
|
||||||
// FIXME -- should be configurable. also not using Mod3Mask.
|
|
||||||
unsigned int outMask = 0;
|
unsigned int outMask = 0;
|
||||||
if (inMask & KeyModifierShift) {
|
if (inMask & KeyModifierShift) {
|
||||||
outMask |= ShiftMask;
|
outMask |= ShiftMask;
|
||||||
|
@ -961,7 +959,6 @@ CXWindowsSecondaryScreen::updateKeycodeMap(Display* display)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize
|
// initialize
|
||||||
// KeyCodeMask entry;
|
|
||||||
m_keycodeMap.clear();
|
m_keycodeMap.clear();
|
||||||
|
|
||||||
// insert keys
|
// insert keys
|
||||||
|
@ -1011,31 +1008,6 @@ CXWindowsSecondaryScreen::updateKeycodeMap(Display* display)
|
||||||
// save keycode for keysym and modifiers
|
// save keycode for keysym and modifiers
|
||||||
entry.m_keycode[j] = static_cast<KeyCode>(minKeycode + i);
|
entry.m_keycode[j] = static_cast<KeyCode>(minKeycode + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// compute mask over all mapped keysyms. if a keycode has, say,
|
|
||||||
// no shifted keysym then we can ignore the shift state when
|
|
||||||
// synthesizing an event to generate it.
|
|
||||||
entry.m_keyMaskMask = 0;
|
|
||||||
for (int j = 0; j < numKeysyms; ++j) {
|
|
||||||
const KeySym keysym = keysyms[i * keysymsPerKeycode + j];
|
|
||||||
if (keysym != NoSymbol) {
|
|
||||||
entry.m_keyMaskMask |= indexToModifierMask(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add entries for this keycode
|
|
||||||
entry.m_keycode = static_cast<KeyCode>(minKeycode + i);
|
|
||||||
for (int j = 0; j < numKeysyms; ++j) {
|
|
||||||
const KeySym keysym = keysyms[i * keysymsPerKeycode + j];
|
|
||||||
if (keysym != NoSymbol) {
|
|
||||||
// FIXME
|
|
||||||
// entry.m_keyMask = indexToModifierMask(j) & ~LockMask;
|
|
||||||
entry.m_keyMask = 0;
|
|
||||||
m_keycodeMap[i].insert(std::make_pair(keysym, entry));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
|
Loading…
Reference in New Issue