From 185855ca87591f8852b1be17f5c3a30a1832f74f Mon Sep 17 00:00:00 2001 From: Sean Burke Date: Mon, 14 Mar 2005 10:14:04 +0000 Subject: [PATCH] InputHandler_X11 should now properly register input --- .../src/arch/InputHandler/InputHandler_X11.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stepmania/src/arch/InputHandler/InputHandler_X11.cpp b/stepmania/src/arch/InputHandler/InputHandler_X11.cpp index a15a50de26..887db572b6 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_X11.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_X11.cpp @@ -124,16 +124,20 @@ InputHandler_X11::~InputHandler_X11() void InputHandler_X11::Update(float fDeltaTime) { XEvent event; - while(XCheckTypedEvent(X11Helper::Dpy(), KeyPress, &event) - || XCheckTypedEvent(X11Helper::Dpy(), KeyRelease, &event) ) + /* XXX: This steals input from other windows, but XCheckMaskEvent won't return anything + * if it isn't called. */ + if (X11Helper::Win()) + XGrabKeyboard(X11Helper::Dpy(),X11Helper::Win(),true,GrabModeAsync,GrabModeAsync,CurrentTime); + while(XCheckMaskEvent(X11Helper::Dpy(), KeyPressMask, &event) + || XCheckMaskEvent(X11Helper::Dpy(), KeyReleaseMask, &event) ) { LOG->Trace("key: sym %i, key %i, state %i", - event.xkey.keycode, XSymToKeySym(event.xkey.keycode), - event.xkey.state ); + XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0)), + event.type == KeyPress ); DeviceInput di( DEVICE_KEYBOARD, - XSymToKeySym(event.xkey.keycode) ); - ButtonPressed(di, event.xkey.state); + XSymToKeySym(XLookupKeysym(&event.xkey,0)) ); + ButtonPressed(di, event.type == KeyPress); } InputHandler::UpdateTimer();