Previous half-duplex fix fixed secondary screens with half
duplex keys but broke primary screens. This fixes both and also ensures that the primary screen updates its shadow toggle modifier state when leaving so the secondary screens get the correct toggle modifier state. Together these fix some strange inconsistencies in toggle state across screens.
This commit is contained in:
parent
3f7f946ab0
commit
9a1de9f105
|
@ -39,7 +39,7 @@ void
|
||||||
CKeyState::setKeyDown(KeyButton button, bool down)
|
CKeyState::setKeyDown(KeyButton button, bool down)
|
||||||
{
|
{
|
||||||
button &= kButtonMask;
|
button &= kButtonMask;
|
||||||
updateKeyState(button, button, down);
|
updateKeyState(button, button, down, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -149,7 +149,7 @@ CKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button)
|
||||||
fakeKeyEvents(keys, 1);
|
fakeKeyEvents(keys, 1);
|
||||||
|
|
||||||
// note that key is down
|
// note that key is down
|
||||||
updateKeyState((KeyButton)(button & kButtonMask), localID, true);
|
updateKeyState((KeyButton)(button & kButtonMask), localID, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -230,7 +230,7 @@ CKeyState::fakeKeyUp(KeyButton button)
|
||||||
fakeKeyEvents(keys, 1);
|
fakeKeyEvents(keys, 1);
|
||||||
|
|
||||||
// note that key is now up
|
// note that key is now up
|
||||||
updateKeyState(button, localID, false);
|
updateKeyState(button, localID, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -486,7 +486,8 @@ CKeyState::fakeKeyEvent(KeyButton button, bool press, bool isAutoRepeat)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CKeyState::updateKeyState(KeyButton serverID, KeyButton localID, bool press)
|
CKeyState::updateKeyState(KeyButton serverID, KeyButton localID,
|
||||||
|
bool press, bool fake)
|
||||||
{
|
{
|
||||||
// ignore bogus keys
|
// ignore bogus keys
|
||||||
if (serverID == 0 || localID == 0) {
|
if (serverID == 0 || localID == 0) {
|
||||||
|
@ -510,6 +511,16 @@ CKeyState::updateKeyState(KeyButton serverID, KeyButton localID, bool press)
|
||||||
// never report half-duplex keys as down
|
// never report half-duplex keys as down
|
||||||
if (isHalfDuplex(mask)) {
|
if (isHalfDuplex(mask)) {
|
||||||
m_keys[localID] &= ~kDown;
|
m_keys[localID] &= ~kDown;
|
||||||
|
// half-duplex keys on the primary screen don't send the
|
||||||
|
// usual press/release pairs but instead send the press
|
||||||
|
// when toggling on and the release when toggleing off.
|
||||||
|
// since we normally toggle our shadow state on the press
|
||||||
|
// we need to treat the release as a press on the primary
|
||||||
|
// screen. we know we're on the primary screen if fake is
|
||||||
|
// false. secondary screens always get press/release pairs.
|
||||||
|
if (!fake) {
|
||||||
|
press = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// toggle on the press
|
// toggle on the press
|
||||||
|
|
|
@ -152,7 +152,7 @@ private:
|
||||||
void fakeKeyEvents(const Keystrokes&, UInt32 count);
|
void fakeKeyEvents(const Keystrokes&, UInt32 count);
|
||||||
void fakeKeyEvent(KeyButton, bool press, bool isAutoRepeat);
|
void fakeKeyEvent(KeyButton, bool press, bool isAutoRepeat);
|
||||||
void updateKeyState(KeyButton serverID,
|
void updateKeyState(KeyButton serverID,
|
||||||
KeyButton localID, bool press);
|
KeyButton localID, bool press, bool fake);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -469,7 +469,10 @@ CScreen::enterSecondary(KeyModifierMask toggleMask)
|
||||||
void
|
void
|
||||||
CScreen::leavePrimary()
|
CScreen::leavePrimary()
|
||||||
{
|
{
|
||||||
// do nothing
|
// we don't track keys while on the primary screen so update our
|
||||||
|
// idea of them now. this is particularly to update the state of
|
||||||
|
// the toggle modifiers.
|
||||||
|
m_screen->updateKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue