diff --git a/plugins/onepad/keyboard.cpp b/plugins/onepad/keyboard.cpp index 1d0423da94..2426bbd9f1 100644 --- a/plugins/onepad/keyboard.cpp +++ b/plugins/onepad/keyboard.cpp @@ -23,7 +23,7 @@ * Theoretically, this header is for anything to do with keyboard input. * Pragmatically, event handing's going in here too. */ - + #include #include #include "keyboard.h" @@ -197,7 +197,6 @@ void PollForX11KeyboardInput(int pad) { keyEvent evt; XEvent E; - XButtonEvent* BE; // Keyboard input send by PCSX2 while (!ev_fifo.empty()) { @@ -211,17 +210,22 @@ void PollForX11KeyboardInput(int pad) while (XPending(GSdsp) > 0) { XNextEvent(GSdsp, &E); - evt.evt = E.type; - evt.key = (int)XLookupKeysym((XKeyEvent *) & E, 0); + // Change the format of the structure to be compatible with GSOpen2 // mode (event come from pcsx2 not X) - BE = (XButtonEvent*)&E; - switch (evt.evt) { - case MotionNotify: evt.key = (BE->x & 0xFFFF) | (BE->y << 16); break; + evt.evt = E.type; + switch (E.type) { + case MotionNotify: + evt.key = (E.xbutton.x & 0xFFFF) | (E.xbutton.y << 16); + break; case ButtonRelease: - case ButtonPress: evt.key = BE->button; break; - default: break; + case ButtonPress: + evt.key = E.xbutton.button; + break; + default: + evt.key = (int)XLookupKeysym(&E.xkey, 0); } + AnalyzeKeyEvent(pad, evt); } }