cosmetic changes only

This commit is contained in:
Glenn Maynard
2005-12-28 03:30:37 +00:00
parent fe3a68d5cd
commit bc372e308b
2 changed files with 84 additions and 86 deletions
@@ -51,72 +51,71 @@ static RageKeySym XSymToKeySym( int key )
switch( key ) switch( key )
{ {
/* These are needed because of the way X registers /* These are needed because of the way X registers the keypad. */
the keypad. */ case XK_KP_Insert: return KEY_KP_C0;
case XK_KP_Insert: return KEY_KP_C0; case XK_KP_End: return KEY_KP_C1;
case XK_KP_End: return KEY_KP_C1; case XK_KP_Down: return KEY_KP_C2;
case XK_KP_Down: return KEY_KP_C2; case XK_KP_Page_Down: return KEY_KP_C3;
case XK_KP_Page_Down: return KEY_KP_C3; case XK_KP_Left: return KEY_KP_C4;
case XK_KP_Left: return KEY_KP_C4; case XK_KP_Begin: return KEY_KP_C5;
case XK_KP_Begin: return KEY_KP_C5; case XK_KP_Right: return KEY_KP_C6;
case XK_KP_Right: return KEY_KP_C6; case XK_KP_Home: return KEY_KP_C7;
case XK_KP_Home: return KEY_KP_C7; case XK_KP_Up: return KEY_KP_C8;
case XK_KP_Up: return KEY_KP_C8; case XK_KP_Page_Up: return KEY_KP_C9;
case XK_KP_Page_Up: return KEY_KP_C9; case XK_KP_Decimal: return KEY_KP_PERIOD;
case XK_KP_Decimal: return KEY_KP_PERIOD; case XK_KP_Divide: return KEY_KP_SLASH;
case XK_KP_Divide: return KEY_KP_SLASH; case XK_KP_Multiply: return KEY_KP_ASTERISK;
case XK_KP_Multiply: return KEY_KP_ASTERISK; case XK_KP_Subtract: return KEY_KP_HYPHEN;
case XK_KP_Subtract: return KEY_KP_HYPHEN; case XK_KP_Add: return KEY_KP_PLUS;
case XK_KP_Add: return KEY_KP_PLUS; case XK_KP_Equal: return KEY_KP_EQUAL;
case XK_KP_Equal: return KEY_KP_EQUAL; case XK_KP_Enter: return KEY_KP_ENTER;
case XK_KP_Enter: return KEY_KP_ENTER; case XK_Up: return KEY_UP;
case XK_Up: return KEY_UP; case XK_Down: return KEY_DOWN;
case XK_Down: return KEY_DOWN; case XK_Right: return KEY_RIGHT;
case XK_Right: return KEY_RIGHT; case XK_Left: return KEY_LEFT;
case XK_Left: return KEY_LEFT; case XK_Insert: return KEY_INSERT;
case XK_Insert: return KEY_INSERT; case XK_Home: return KEY_HOME;
case XK_Home: return KEY_HOME; case XK_Delete: return KEY_DEL;
case XK_Delete: return KEY_DEL; case XK_End: return KEY_END;
case XK_End: return KEY_END; case XK_Page_Up: return KEY_PGUP;
case XK_Page_Up: return KEY_PGUP; case XK_Page_Down: return KEY_PGDN;
case XK_Page_Down: return KEY_PGDN; case XK_F1: return KEY_F1;
case XK_F1: return KEY_F1; case XK_F2: return KEY_F2;
case XK_F2: return KEY_F2; case XK_F3: return KEY_F3;
case XK_F3: return KEY_F3; case XK_F4: return KEY_F4;
case XK_F4: return KEY_F4; case XK_F5: return KEY_F5;
case XK_F5: return KEY_F5; case XK_F6: return KEY_F6;
case XK_F6: return KEY_F6; case XK_F7: return KEY_F7;
case XK_F7: return KEY_F7; case XK_F8: return KEY_F8;
case XK_F8: return KEY_F8; case XK_F9: return KEY_F9;
case XK_F9: return KEY_F9; case XK_F10: return KEY_F10;
case XK_F10: return KEY_F10; case XK_F11: return KEY_F11;
case XK_F11: return KEY_F11; case XK_F12: return KEY_F12;
case XK_F12: return KEY_F12; case XK_F13: return KEY_F13;
case XK_F13: return KEY_F13; case XK_F14: return KEY_F14;
case XK_F14: return KEY_F14; case XK_F15: return KEY_F15;
case XK_F15: return KEY_F15;
case XK_Num_Lock: return KEY_NUMLOCK; case XK_Num_Lock: return KEY_NUMLOCK;
case XK_Caps_Lock: return KEY_CAPSLOCK; case XK_Caps_Lock: return KEY_CAPSLOCK;
case XK_Scroll_Lock: return KEY_SCRLLOCK; case XK_Scroll_Lock: return KEY_SCRLLOCK;
case XK_Return: return KEY_ENTER; case XK_Return: return KEY_ENTER;
case XK_Sys_Req: return KEY_PRTSC; case XK_Sys_Req: return KEY_PRTSC;
case XK_Print: return KEY_PRTSC; case XK_Print: return KEY_PRTSC;
case XK_Shift_R: return KEY_RSHIFT; case XK_Shift_R: return KEY_RSHIFT;
case XK_Shift_L: return KEY_LSHIFT; case XK_Shift_L: return KEY_LSHIFT;
case XK_Control_R: return KEY_RCTRL; case XK_Control_R: return KEY_RCTRL;
case XK_Control_L: return KEY_LCTRL; case XK_Control_L: return KEY_LCTRL;
case XK_Alt_R: return KEY_RALT; case XK_Alt_R: return KEY_RALT;
case XK_Alt_L: return KEY_LALT; case XK_Alt_L: return KEY_LALT;
case XK_Meta_R: return KEY_RMETA; case XK_Meta_R: return KEY_RMETA;
case XK_Meta_L: return KEY_LMETA; case XK_Meta_L: return KEY_LMETA;
case XK_Super_L: return KEY_LSUPER; case XK_Super_L: return KEY_LSUPER;
case XK_Super_R: return KEY_RSUPER; case XK_Super_R: return KEY_RSUPER;
case XK_Menu: return KEY_MENU; case XK_Menu: return KEY_MENU;
} }
/* 0...31: */ /* 0...31: */
if( key - 0xFF00 < 0x20) if( key - 0xFF00 < 0x20 )
return ASCIIKeySyms[key - 0xFF00]; return ASCIIKeySyms[key - 0xFF00];
return KEY_INVALID; return KEY_INVALID;
@@ -126,17 +125,19 @@ InputHandler_X11::InputHandler_X11()
{ {
XKeyboardControl state; XKeyboardControl state;
state.auto_repeat_mode = AutoRepeatModeOff; state.auto_repeat_mode = AutoRepeatModeOff;
XChangeKeyboardControl(X11Helper::Dpy,KBAutoRepeatMode,&state); XChangeKeyboardControl( X11Helper::Dpy, KBAutoRepeatMode, &state );
X11Helper::Go(); X11Helper::Go();
X11Helper::OpenMask(KeyPressMask); X11Helper::OpenMask(KeyReleaseMask); X11Helper::OpenMask( KeyPressMask );
X11Helper::OpenMask( KeyReleaseMask );
} }
InputHandler_X11::~InputHandler_X11() InputHandler_X11::~InputHandler_X11()
{ {
XKeyboardControl state; XKeyboardControl state;
state.auto_repeat_mode = AutoRepeatModeDefault; state.auto_repeat_mode = AutoRepeatModeDefault;
XChangeKeyboardControl(X11Helper::Dpy,KBAutoRepeatMode,&state); XChangeKeyboardControl( X11Helper::Dpy, KBAutoRepeatMode, &state );
X11Helper::CloseMask(KeyPressMask); X11Helper::CloseMask(KeyReleaseMask); X11Helper::CloseMask( KeyPressMask );
X11Helper::CloseMask( KeyReleaseMask );
X11Helper::Stop(); X11Helper::Stop();
} }
@@ -144,35 +145,32 @@ void InputHandler_X11::Update()
{ {
XEvent event; XEvent event;
if (X11Helper::Win) if( X11Helper::Win )
while(XCheckTypedWindowEvent(X11Helper::Dpy, {
X11Helper::Win, KeyPress, &event) ) while( XCheckTypedWindowEvent(X11Helper::Dpy, X11Helper::Win, KeyPress, &event) )
{ {
LOG->Trace("key: sym %i, key %i, state true", LOG->Trace( "key: sym %i, key %i, state true",
XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0))); XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
DeviceInput di( DEVICE_KEYBOARD, DeviceInput di( DEVICE_KEYBOARD, XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
ButtonPressed(di, true); ButtonPressed(di, true);
} }
while(XCheckTypedWindowEvent(X11Helper::Dpy,
X11Helper::Win, KeyRelease, &event) ) while( XCheckTypedWindowEvent(X11Helper::Dpy, X11Helper::Win, KeyRelease, &event) )
{ {
LOG->Trace("key: sym %i, key %i, state false", LOG->Trace( "key: sym %i, key %i, state false",
XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0))); XLookupKeysym(&event.xkey,0), XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
DeviceInput di( DEVICE_KEYBOARD,
XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
ButtonPressed(di, false);
DeviceInput di( DEVICE_KEYBOARD, XSymToKeySym(XLookupKeysym(&event.xkey,0)) );
ButtonPressed( di, false );
} }
}
InputHandler::UpdateTimer(); InputHandler::UpdateTimer();
} }
void InputHandler_X11::GetDevicesAndDescriptions( void InputHandler_X11::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut )
vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut)
{ {
vDevicesOut.push_back( DEVICE_KEYBOARD ); vDevicesOut.push_back( DEVICE_KEYBOARD );
vDescriptionsOut.push_back( "Keyboard" ); vDescriptionsOut.push_back( "Keyboard" );
@@ -1,8 +1,8 @@
/* InputHandler_X11 - X-based keyboard input handler. */
#ifndef INPUT_HANDLER_X11_H #ifndef INPUT_HANDLER_X11_H
#define INPUT_HANDLER_X11_H #define INPUT_HANDLER_X11_H
/* Get keyboard (and possibly pointer in the future) input through X. */
#include "InputHandler.h" #include "InputHandler.h"
class InputHandler_X11: public InputHandler class InputHandler_X11: public InputHandler
@@ -11,7 +11,7 @@ public:
InputHandler_X11(); InputHandler_X11();
~InputHandler_X11(); ~InputHandler_X11();
void Update(); void Update();
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut );
}; };
#define USE_INPUT_HANDLER_X11 #define USE_INPUT_HANDLER_X11