mirror of https://github.com/PCSX2/pcsx2.git
onepad: use union instead of stange cast
Nicer this way. Beside it removes the strict aliasing issue.
This commit is contained in:
parent
43e854fece
commit
4f957feacd
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue