More fixes for X11 client keyboard handling.
This commit is contained in:
parent
92539f2ccc
commit
a6f21bff90
|
@ -224,8 +224,10 @@ CXWindowsSecondaryScreen::keyUp(KeyID key,
|
||||||
m_mask = mapKey(keys, keycode, key, mask, kRelease);
|
m_mask = mapKey(keys, keycode, key, mask, kRelease);
|
||||||
|
|
||||||
// if there are no keys to generate then we should at least generate
|
// if there are no keys to generate then we should at least generate
|
||||||
// a key release for the key we pressed.
|
// a key release for the key we pressed. this does not apply to
|
||||||
if (keys.empty()) {
|
// half-duplex modifiers.
|
||||||
|
if (keys.empty() &&!((key == kKeyCapsLock && m_capsLockHalfDuplex) ||
|
||||||
|
(key == kKeyNumLock && m_numLockHalfDuplex))) {
|
||||||
Keystroke keystroke;
|
Keystroke keystroke;
|
||||||
keycode = index->second;
|
keycode = index->second;
|
||||||
keystroke.m_keycode = keycode;
|
keystroke.m_keycode = keycode;
|
||||||
|
@ -686,9 +688,11 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||||
return m_mask;
|
return m_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the id to a keysym and adjust the mask if necessary
|
// requested notes the modifiers requested by the server.
|
||||||
unsigned int outMask = m_mask;
|
unsigned int requested = maskToX(mask);
|
||||||
KeyCodeIndex keyIndex = findKey(id, outMask);
|
|
||||||
|
// convert the id to a keysym
|
||||||
|
KeyCodeIndex keyIndex = findKey(id, requested);
|
||||||
if (keyIndex == noKey()) {
|
if (keyIndex == noKey()) {
|
||||||
// cannot convert id to keysym
|
// cannot convert id to keysym
|
||||||
LOG((CLOG_DEBUG2 "no keysym for key"));
|
LOG((CLOG_DEBUG2 "no keysym for key"));
|
||||||
|
@ -739,13 +743,11 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
|
||||||
// keysym is affected by num lock it is not affected by caps
|
// keysym is affected by num lock it is not affected by caps
|
||||||
// lock. no other modifiers have any effect.
|
// lock. no other modifiers have any effect.
|
||||||
//
|
//
|
||||||
// requested notes the modifiers requested by the server and
|
|
||||||
// desired notes the modifier state we ultimately want to match.
|
// desired notes the modifier state we ultimately want to match.
|
||||||
// only the bits in desired indicated by sensitive are relevant.
|
// only the bits in desired indicated by sensitive are relevant.
|
||||||
// we assign the num lock and caps lock bits here if relevant.
|
// we assign the num lock and caps lock bits here if relevant.
|
||||||
// we'll assign shift and mode switch later.
|
// we'll assign shift and mode switch later.
|
||||||
unsigned int sensitive = ShiftMask | m_modeSwitchMask;
|
unsigned int sensitive = ShiftMask | m_modeSwitchMask;
|
||||||
unsigned int requested = maskToX(mask);
|
|
||||||
unsigned int desired = 0;
|
unsigned int desired = 0;
|
||||||
if (adjustForNumLock(keysym)) {
|
if (adjustForNumLock(keysym)) {
|
||||||
sensitive |= m_numLockMask;
|
sensitive |= m_numLockMask;
|
||||||
|
@ -1553,7 +1555,7 @@ static const KeySym g_mapE000[] =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CXWindowsSecondaryScreen::KeyCodeIndex
|
CXWindowsSecondaryScreen::KeyCodeIndex
|
||||||
CXWindowsSecondaryScreen::findKey(KeyID id, KeyModifierMask& mask) const
|
CXWindowsSecondaryScreen::findKey(KeyID id, KeyModifierMask mask) const
|
||||||
{
|
{
|
||||||
// convert id to keysym
|
// convert id to keysym
|
||||||
KeySym keysym = NoSymbol;
|
KeySym keysym = NoSymbol;
|
||||||
|
@ -1600,7 +1602,6 @@ CXWindowsSecondaryScreen::findKey(KeyID id, KeyModifierMask& mask) const
|
||||||
// XK_ISO_Left_Tab sending events to secondary screens that do.
|
// XK_ISO_Left_Tab sending events to secondary screens that do.
|
||||||
if (keysym == XK_Tab && (mask & ShiftMask) != 0) {
|
if (keysym == XK_Tab && (mask & ShiftMask) != 0) {
|
||||||
keysym = XK_ISO_Left_Tab;
|
keysym = XK_ISO_Left_Tab;
|
||||||
mask &= ~ShiftMask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the keycodes that generate the keysym
|
// find the keycodes that generate the keysym
|
||||||
|
@ -1663,7 +1664,6 @@ CXWindowsSecondaryScreen::findKey(KeyID id, KeyModifierMask& mask) const
|
||||||
|
|
||||||
case XK_ISO_Left_Tab:
|
case XK_ISO_Left_Tab:
|
||||||
keysym = XK_Tab;
|
keysym = XK_Tab;
|
||||||
mask |= ShiftMask;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -111,7 +111,7 @@ private:
|
||||||
void toggleKey(Display*, KeySym, unsigned int mask);
|
void toggleKey(Display*, KeySym, unsigned int mask);
|
||||||
static bool isToggleKeysym(KeySym);
|
static bool isToggleKeysym(KeySym);
|
||||||
|
|
||||||
KeyCodeIndex findKey(KeyID keysym, KeyModifierMask& mask) const;
|
KeyCodeIndex findKey(KeyID keysym, KeyModifierMask mask) const;
|
||||||
KeyCodeIndex noKey() const;
|
KeyCodeIndex noKey() const;
|
||||||
bool adjustForNumLock(KeySym) const;
|
bool adjustForNumLock(KeySym) const;
|
||||||
bool adjustForCapsLock(KeySym) const;
|
bool adjustForCapsLock(KeySym) const;
|
||||||
|
|
Loading…
Reference in New Issue