Always sleep some time after the keymap has changed.

This works around a problem where sometimes chars are typed as if some
random modifiers are pressed.
This commit is contained in:
Felix Geyer 2015-03-13 19:48:18 +01:00
parent b86b640860
commit 2631277184

View File

@ -484,6 +484,14 @@ void AutoTypePlatformX11::updateKeymap()
}
}
XFreeModifiermap(modifiers);
/* Xlib needs some time until the mapping is distributed to
all clients */
// TODO: we should probably only sleep while in the middle of typing something
timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 30 * 1000 * 1000;
nanosleep(&ts, Q_NULLPTR);
}
bool AutoTypePlatformX11::isRemapKeycodeValid()
@ -550,13 +558,6 @@ int AutoTypePlatformX11::AddKeysym(KeySym keysym)
XFlush(m_dpy);
updateKeymap();
/* Xlib needs some time until the mapping is distributed to
all clients */
timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 30 * 1000 * 1000;
nanosleep(&ts, Q_NULLPTR);
return m_remapKeycode;
}