diff --git a/os/x11/window.cpp b/os/x11/window.cpp index b08166b01..3de5fe430 100644 --- a/os/x11/window.cpp +++ b/os/x11/window.cpp @@ -1042,7 +1042,19 @@ void WindowX11::processX11Event(XEvent& event) KEY_TRACE("Xutf8LookupString %s\n", &buf[0]); } - // Key event used by the input method (e.g. when the user + // Check if the key has been pressed, + // and if yes - check if it's the same one key + // as in the previous event. If it's the same one + // - it means key is being held, so set repeat to 1. + if (event.type == KeyPress) { + if (keysym == m_pressedKeySym) + ev.setRepeat(1); + m_pressedKeySym = keysym; + } + else + m_pressedKeySym = 0; + + // Key event used by the input method (e.g. when the users // presses a dead key). if (XFilterEvent(&event, m_window)) break; diff --git a/os/x11/window.h b/os/x11/window.h index 1625d5d1a..5fd9d637b 100644 --- a/os/x11/window.h +++ b/os/x11/window.h @@ -128,6 +128,8 @@ class WindowX11 : public Window { bool m_resizable = false; bool m_transparent = false; + KeySym m_pressedKeySym = 0; + // Double-click info Event::MouseButton m_doubleClickButton; base::tick_t m_doubleClickTick;