This commit is contained in:
crs 2002-06-22 12:09:49 +00:00
parent ede18cb7f3
commit c961115686
1 changed files with 28 additions and 31 deletions

View File

@ -465,8 +465,8 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
unsigned int bit = (1 << i); unsigned int bit = (1 << i);
if ((outMask & bit) != (m_mask & bit)) { if ((outMask & bit) != (m_mask & bit)) {
// get list of keycodes for the modifier. if there isn't // get list of keycodes for the modifier. if there isn't
// one then there's no key mapped to this modifier. // one then there's no key mapped to this modifier and we
// we can't generate the desired key so bail. // can't generate the desired key so bail.
const KeyCode* modifierKeys = const KeyCode* modifierKeys =
&m_modifierToKeycode[i * m_keysPerModifier]; &m_modifierToKeycode[i * m_keysPerModifier];
KeyCode modifierKey = modifierKeys[0]; KeyCode modifierKey = modifierKeys[0];
@ -478,24 +478,26 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
return m_mask; return m_mask;
} }
if (modifierKey != 0 && (outMask & bit) != 0) { keystroke.m_keycode = modifierKey;
keystroke.m_repeat = false;
if ((outMask & bit) != 0) {
// modifier is not active but should be. if the // modifier is not active but should be. if the
// modifier is a toggle then toggle it on with a // modifier is a toggle then toggle it on with a
// press/release, otherwise activate it with a // press/release, otherwise activate it with a
// press. use the first keycode for the modifier. // press. use the first keycode for the modifier.
log((CLOG_DEBUG2 "modifier 0x%04x is not active", bit)); log((CLOG_DEBUG2 "modifier 0x%04x is not active", bit));
keystroke.m_keycode = modifierKey;
keystroke.m_press = True;
keystroke.m_repeat = false;
keys.push_back(keystroke);
if ((bit & m_toggleModifierMask) != 0) { if ((bit & m_toggleModifierMask) != 0) {
log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit)); log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
if ((bit == m_capsLockMask && m_capsLockHalfDuplex) || if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
(bit == m_numLockMask && m_numLockHalfDuplex)) { (bit == m_numLockMask && m_numLockHalfDuplex)) {
keystroke.m_press = True;
keys.push_back(keystroke);
keystroke.m_press = False; keystroke.m_press = False;
undo.push_back(keystroke); undo.push_back(keystroke);
} }
else { else {
keystroke.m_press = True;
keys.push_back(keystroke);
keystroke.m_press = False; keystroke.m_press = False;
keys.push_back(keystroke); keys.push_back(keystroke);
undo.push_back(keystroke); undo.push_back(keystroke);
@ -504,12 +506,14 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
} }
} }
else { else {
keystroke.m_press = True;
keys.push_back(keystroke);
keystroke.m_press = False; keystroke.m_press = False;
undo.push_back(keystroke); undo.push_back(keystroke);
} }
} }
else if ((outMask & bit) == 0) { else {
// modifier is active but should not be. if the // modifier is active but should not be. if the
// modifier is a toggle then toggle it off with a // modifier is a toggle then toggle it off with a
// press/release, otherwise deactivate it with a // press/release, otherwise deactivate it with a
@ -517,28 +521,22 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
// modifier if not a toggle. // modifier if not a toggle.
log((CLOG_DEBUG2 "modifier 0x%04x is active", bit)); log((CLOG_DEBUG2 "modifier 0x%04x is active", bit));
if ((bit & m_toggleModifierMask) != 0) { if ((bit & m_toggleModifierMask) != 0) {
if (modifierKey != 0) { log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit)); if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
keystroke.m_keycode = modifierKey; (bit == m_numLockMask && m_numLockHalfDuplex)) {
keystroke.m_repeat = false; keystroke.m_press = False;
if ((bit == m_capsLockMask && keys.push_back(keystroke);
m_capsLockHalfDuplex) || keystroke.m_press = True;
(bit == m_numLockMask && undo.push_back(keystroke);
m_numLockHalfDuplex)) { }
keystroke.m_press = False; else {
keys.push_back(keystroke); keystroke.m_press = True;
keystroke.m_press = True; keys.push_back(keystroke);
undo.push_back(keystroke); keystroke.m_press = False;
} keys.push_back(keystroke);
else { undo.push_back(keystroke);
keystroke.m_press = True; keystroke.m_press = True;
keys.push_back(keystroke); undo.push_back(keystroke);
keystroke.m_press = False;
keys.push_back(keystroke);
undo.push_back(keystroke);
keystroke.m_press = True;
undo.push_back(keystroke);
}
} }
} }
else { else {
@ -547,7 +545,6 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
if (key != 0 && m_keys[key]) { if (key != 0 && m_keys[key]) {
keystroke.m_keycode = key; keystroke.m_keycode = key;
keystroke.m_press = False; keystroke.m_press = False;
keystroke.m_repeat = false;
keys.push_back(keystroke); keys.push_back(keystroke);
keystroke.m_press = True; keystroke.m_press = True;
undo.push_back(keystroke); undo.push_back(keystroke);