cleanup.
This commit is contained in:
parent
ede18cb7f3
commit
c961115686
|
@ -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,14 +521,9 @@ 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));
|
||||||
keystroke.m_keycode = modifierKey;
|
if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
|
||||||
keystroke.m_repeat = false;
|
(bit == m_numLockMask && m_numLockHalfDuplex)) {
|
||||||
if ((bit == m_capsLockMask &&
|
|
||||||
m_capsLockHalfDuplex) ||
|
|
||||||
(bit == m_numLockMask &&
|
|
||||||
m_numLockHalfDuplex)) {
|
|
||||||
keystroke.m_press = False;
|
keystroke.m_press = False;
|
||||||
keys.push_back(keystroke);
|
keys.push_back(keystroke);
|
||||||
keystroke.m_press = True;
|
keystroke.m_press = True;
|
||||||
|
@ -540,14 +539,12 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||||
undo.push_back(keystroke);
|
undo.push_back(keystroke);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
for (unsigned int j = 0; j < m_keysPerModifier; ++j) {
|
for (unsigned int j = 0; j < m_keysPerModifier; ++j) {
|
||||||
const KeyCode key = modifierKeys[j];
|
const KeyCode key = modifierKeys[j];
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue