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:
parent
75729cef46
commit
af110dbce2
|
@ -139,6 +139,11 @@ CXWindowsSecondaryScreen::keyRepeat(KeyID key,
|
||||||
return;
|
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
|
// if we've seen this button (and we should have) then make sure
|
||||||
// we release the same key we pressed when we saw it.
|
// we release the same key we pressed when we saw it.
|
||||||
if (index != m_serverKeyMap.end() && keycode != index->second) {
|
if (index != m_serverKeyMap.end() && keycode != index->second) {
|
||||||
|
@ -367,6 +372,10 @@ void
|
||||||
CXWindowsSecondaryScreen::onPostOpen()
|
CXWindowsSecondaryScreen::onPostOpen()
|
||||||
{
|
{
|
||||||
assert(m_window != None);
|
assert(m_window != None);
|
||||||
|
|
||||||
|
// get the keyboard control state
|
||||||
|
CDisplayLock display(m_screen);
|
||||||
|
XGetKeyboardControl(display, &m_keyControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -375,10 +384,35 @@ CXWindowsSecondaryScreen::onPreEnter()
|
||||||
assert(m_window != None);
|
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
|
void
|
||||||
CXWindowsSecondaryScreen::onPreLeave()
|
CXWindowsSecondaryScreen::onPreLeave()
|
||||||
{
|
{
|
||||||
assert(m_window != None);
|
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
|
void
|
||||||
|
|
|
@ -62,6 +62,7 @@ protected:
|
||||||
virtual void onPreOpen();
|
virtual void onPreOpen();
|
||||||
virtual void onPostOpen();
|
virtual void onPostOpen();
|
||||||
virtual void onPreEnter();
|
virtual void onPreEnter();
|
||||||
|
virtual void onPostEnter();
|
||||||
virtual void onPreLeave();
|
virtual void onPreLeave();
|
||||||
virtual void createWindow();
|
virtual void createWindow();
|
||||||
virtual void destroyWindow();
|
virtual void destroyWindow();
|
||||||
|
@ -170,6 +171,9 @@ private:
|
||||||
|
|
||||||
// map server key buttons to local keycodes
|
// map server key buttons to local keycodes
|
||||||
ServerKeyMap m_serverKeyMap;
|
ServerKeyMap m_serverKeyMap;
|
||||||
|
|
||||||
|
// the keyboard control state the last time this screen was entered
|
||||||
|
XKeyboardState m_keyControl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue