From db8c237f6adcf88443e20aa72c9488b4d2b02d59 Mon Sep 17 00:00:00 2001 From: binary1248 Date: Mon, 20 Apr 2015 01:36:45 +0200 Subject: [PATCH] Fixed Unix key repeat not being disabled even after setKeyRepeatEnabled(false) is called. (#871) --- src/SFML/Window/Unix/WindowImplX11.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index 40d511cc..d8c26e06 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -768,6 +768,24 @@ void WindowImplX11::processEvents() { free(lastKeyReleaseEvent); lastKeyReleaseEvent = NULL; + + // If key repeat is disabled, discard the matching key press event as well + if (!m_keyRepeat) + { + free(event); + + if (!m_xcbEvents.empty()) + { + event = m_xcbEvents.front(); + m_xcbEvents.pop_front(); + } + else + { + event = xcb_poll_for_event(m_connection); + } + + continue; + } } }