diff --git a/src/autotype/x11/AutoTypeX11.cpp b/src/autotype/x11/AutoTypeX11.cpp index e2d877bae..47ab9127a 100644 --- a/src/autotype/x11/AutoTypeX11.cpp +++ b/src/autotype/x11/AutoTypeX11.cpp @@ -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; }