fix: client to server modifier press/release
Pressing a modifier on the client and moving to the server and releasing it breaks the modifier on the client. This resolves the issue.
This commit is contained in:
@ -103,6 +103,16 @@ public:
|
||||
*/
|
||||
virtual void fakeAllKeysUp() = 0;
|
||||
|
||||
//! Clear stale modifiers
|
||||
/*!
|
||||
Clears stuck modifier state in platform-specific keyboard tracking (e.g. XKB).
|
||||
Default implementation does nothing.
|
||||
*/
|
||||
virtual void clearStaleModifiers()
|
||||
{
|
||||
// Default implementation does nothing
|
||||
}
|
||||
|
||||
//! Fake ctrl+alt+del
|
||||
/*!
|
||||
Synthesize a press of ctrl+alt+del. Return true if processing is
|
||||
|
||||
@ -187,6 +187,7 @@ public:
|
||||
KeyModifierMask pollActiveModifiers() const override = 0;
|
||||
int32_t pollActiveGroup() const override = 0;
|
||||
void pollPressedKeys(KeyButtonSet &pressedKeys) const override = 0;
|
||||
void clearStaleModifiers() override = 0;
|
||||
|
||||
protected:
|
||||
//! Handle system event
|
||||
|
||||
@ -760,6 +760,7 @@ void KeyState::updateKeyState()
|
||||
}
|
||||
|
||||
// get the current modifier state
|
||||
clearStaleModifiers();
|
||||
m_mask = pollActiveModifiers();
|
||||
|
||||
// set active modifiers
|
||||
|
||||
@ -85,6 +85,11 @@ void PlatformScreen::pollPressedKeys(KeyButtonSet &pressedKeys) const
|
||||
getKeyState()->pollPressedKeys(pressedKeys);
|
||||
}
|
||||
|
||||
void PlatformScreen::clearStaleModifiers()
|
||||
{
|
||||
getKeyState()->clearStaleModifiers();
|
||||
}
|
||||
|
||||
int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const
|
||||
{
|
||||
return (m_invertScrollDirection ? -x : x);
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
KeyModifierMask pollActiveModifiers() const override;
|
||||
int32_t pollActiveGroup() const override;
|
||||
void pollPressedKeys(KeyButtonSet &pressedKeys) const override;
|
||||
void clearStaleModifiers() override;
|
||||
|
||||
// IPlatformScreen overrides
|
||||
void enable() override = 0;
|
||||
|
||||
@ -309,4 +309,13 @@ void EiKeyState::updateXkbState(uint32_t keyval, bool isPressed)
|
||||
xkb_state_update_key(m_xkbState, keyval, isPressed ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||
}
|
||||
|
||||
void EiKeyState::clearStaleModifiers()
|
||||
{
|
||||
// Recreate the XKB state to clear stuck modifiers that happen when
|
||||
// modifier keys are press on client and released on server
|
||||
if (m_xkbState) {
|
||||
xkb_state_unref(m_xkbState);
|
||||
}
|
||||
m_xkbState = xkb_state_new(m_xkbKeymap);
|
||||
}
|
||||
} // namespace deskflow
|
||||
|
||||
@ -35,6 +35,7 @@ public:
|
||||
void pollPressedKeys(KeyButtonSet &pressedKeys) const override;
|
||||
KeyID mapKeyFromKeyval(std::uint32_t keyval) const;
|
||||
void updateXkbState(std::uint32_t keyval, bool isPressed);
|
||||
void clearStaleModifiers() override;
|
||||
|
||||
protected:
|
||||
// KeyState overrides
|
||||
|
||||
Reference in New Issue
Block a user