merge input symbols
This commit is contained in:
@@ -153,13 +153,13 @@ void InputHandler_Linux_Joystick::InputThread()
|
||||
// In 2.6.11 using an EMS USB2, the event number for P1 Tri (the first button)
|
||||
// is being reported as 32 instead of 0. Correct for this.
|
||||
wrap( iNum, 32 ); // max number of joystick buttons. Make this a constant?
|
||||
ButtonPressed( DeviceInput(id, JOY_BUTTON_1 + iNum, 0, now), event.value );
|
||||
ButtonPressed( DeviceInput(id, enum_add2(JOY_BUTTON_1, iNum), 0, now), event.value );
|
||||
break;
|
||||
}
|
||||
|
||||
case JS_EVENT_AXIS: {
|
||||
JoystickButton neg = (JoystickButton)(JOY_LEFT+2*event.number);
|
||||
JoystickButton pos = (JoystickButton)(JOY_RIGHT+2*event.number);
|
||||
DeviceButton neg = enum_add2(JOY_LEFT, 2*event.number);
|
||||
DeviceButton pos = enum_add2(JOY_RIGHT, 2*event.number);
|
||||
ButtonPressed(DeviceInput(id, neg, 0, now), event.value < -16000);
|
||||
ButtonPressed(DeviceInput(id, pos, 0, now), event.value > +16000);
|
||||
break;
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
static RageKeySym XSymToKeySym( int key )
|
||||
static DeviceButton XSymToDeviceButton( int key )
|
||||
{
|
||||
#define KEY_INV KEY_INVALID
|
||||
const RageKeySym ASCIIKeySyms[] =
|
||||
#define KEY_INV DeviceButton_Invalid
|
||||
const DeviceButton ASCIIKeySyms[] =
|
||||
{
|
||||
KEY_INV , KEY_INV , KEY_INV , KEY_INV , KEY_INV , /* 0 - 4 */
|
||||
KEY_INV , KEY_INV , KEY_INV , KEY_BACK , KEY_TAB , /* 5 - 9 */
|
||||
@@ -47,7 +47,7 @@ static RageKeySym XSymToKeySym( int key )
|
||||
|
||||
/* XK_KP_0 ... XK_KP_9 to KEY_KP_C0 ... KEY_KP_C9 */
|
||||
if( key >= XK_KP_0 && key <= XK_KP_9 )
|
||||
return (RageKeySym) (key - XK_KP_0 + KEY_KP_C0);
|
||||
return enum_add2(KEY_KP_C0, key - XK_KP_0);
|
||||
|
||||
switch( key )
|
||||
{
|
||||
@@ -118,7 +118,7 @@ static RageKeySym XSymToKeySym( int key )
|
||||
if( key - 0xFF00 < 0x20 )
|
||||
return ASCIIKeySyms[key - 0xFF00];
|
||||
|
||||
return KEY_INVALID;
|
||||
return DeviceButton_Invalid;
|
||||
}
|
||||
|
||||
InputHandler_X11::InputHandler_X11()
|
||||
@@ -150,18 +150,18 @@ void InputHandler_X11::Update()
|
||||
while( XCheckTypedWindowEvent(X11Helper::Dpy, X11Helper::Win, KeyPress, &event) )
|
||||
{
|
||||
LOG->Trace( "key: sym %i, key %i, state true",
|
||||
XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
|
||||
XLookupKeysym(&event.xkey,0), XSymToDeviceButton(XLookupKeysym(&event.xkey,0)) );
|
||||
|
||||
DeviceInput di( DEVICE_KEYBOARD, XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
|
||||
DeviceInput di( DEVICE_KEYBOARD, XSymToDeviceButton(XLookupKeysym(&event.xkey,0)) );
|
||||
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)) );
|
||||
XLookupKeysym(&event.xkey,0), XSymToDeviceButton(XLookupKeysym(&event.xkey,0)) );
|
||||
|
||||
DeviceInput di( DEVICE_KEYBOARD, XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
|
||||
DeviceInput di( DEVICE_KEYBOARD, XSymToDeviceButton(XLookupKeysym(&event.xkey,0)) );
|
||||
ButtonPressed( di, false );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user