From 800bbfbb709f28813034eb17a1a6c87a1b18e12f Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Thu, 17 Mar 2005 04:40:14 +0000 Subject: [PATCH] Always process all KeyPress events before all KeyRelease events. KeyPress are more timing-sensitive, and this makes race conditions causing sticky keys a little less likely. --- .../arch/InputHandler/InputHandler_X11.cpp | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/stepmania/src/arch/InputHandler/InputHandler_X11.cpp b/stepmania/src/arch/InputHandler/InputHandler_X11.cpp index 26264a296e..4a5806b765 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_X11.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_X11.cpp @@ -133,17 +133,25 @@ void InputHandler_X11::Update(float fDeltaTime) if (X11Helper::Win) while(XCheckTypedWindowEvent(X11Helper::Dpy, - X11Helper::Win, KeyPress, &event) - || XCheckTypedWindowEvent(X11Helper::Dpy, - X11Helper::Win, KeyRelease, &event) ) + X11Helper::Win, KeyPress, &event) ) { - LOG->Trace("key: sym %i, key %i, state %i", - XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0)), - event.type == KeyPress ); + LOG->Trace("key: sym %i, key %i, state true", + XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0))); DeviceInput di( DEVICE_KEYBOARD, XSymToKeySym(XLookupKeysym(&event.xkey,0)) ); - ButtonPressed(di, event.type == KeyPress); + ButtonPressed(di, true); + } + while(XCheckTypedWindowEvent(X11Helper::Dpy, + X11Helper::Win, KeyRelease, &event) ) + { + LOG->Trace("key: sym %i, key %i, state false", + XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0))); + + DeviceInput di( DEVICE_KEYBOARD, + XSymToKeySym(XLookupKeysym(&event.xkey,0)) ); + ButtonPressed(di, false); + } InputHandler::UpdateTimer();