mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 22:55:53 +08:00
Now turning off auto-repeat when on an X11 client. This prevents
the server from auto-repeating fake events, which is undesired since synergy will do the auto-repeating itself. This also disables auto-repeat on any keys locally configured on X11 to not auto-repeat. That's mainly to suppress auto-repeat on modifier keys, which auto-repeat on win32 but not X11.
This commit is contained in:
@@ -139,6 +139,11 @@ CXWindowsSecondaryScreen::keyRepeat(KeyID key,
|
||||
return;
|
||||
}
|
||||
|
||||
// if this keycode shouldn't auto-repeat then ignore
|
||||
if ((m_keyControl.auto_repeats[keycode >> 3] & (1 << (keycode & 7))) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if we've seen this button (and we should have) then make sure
|
||||
// we release the same key we pressed when we saw it.
|
||||
if (index != m_serverKeyMap.end() && keycode != index->second) {
|
||||
@@ -367,6 +372,10 @@ void
|
||||
CXWindowsSecondaryScreen::onPostOpen()
|
||||
{
|
||||
assert(m_window != None);
|
||||
|
||||
// get the keyboard control state
|
||||
CDisplayLock display(m_screen);
|
||||
XGetKeyboardControl(display, &m_keyControl);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -375,10 +384,35 @@ CXWindowsSecondaryScreen::onPreEnter()
|
||||
assert(m_window != None);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::onPostEnter()
|
||||
{
|
||||
assert(m_window != None);
|
||||
|
||||
// get the keyboard control state
|
||||
CDisplayLock display(m_screen);
|
||||
XGetKeyboardControl(display, &m_keyControl);
|
||||
|
||||
// turn off auto-repeat. we do this so fake key press events don't
|
||||
// cause the local server to generate their own auto-repeats of
|
||||
// those keys.
|
||||
XAutoRepeatOff(display);
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsSecondaryScreen::onPreLeave()
|
||||
{
|
||||
assert(m_window != None);
|
||||
|
||||
// restore the previous keyboard auto-repeat state. if the user
|
||||
// changed the auto-repeat configuration while on the client then
|
||||
// that state is lost. that's because we can't get notified by
|
||||
// the X server when the auto-repeat configuration is changed so
|
||||
// we can't track the desired configuration.
|
||||
if (m_keyControl.global_auto_repeat == AutoRepeatModeOn) {
|
||||
CDisplayLock display(m_screen);
|
||||
XAutoRepeatOn(display);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user