one of these days, I'd like for Caps Lock to work...

This commit is contained in:
AJ Kelly
2011-01-09 18:00:47 -06:00
parent 28084a1609
commit 101711b965
4 changed files with 46 additions and 44 deletions
+6 -9
View File
@@ -1,7 +1,5 @@
/*
* Define all of the input devices we know about. This is the public
* interface for describing input devices.
*/
/* Define all of the input devices we know about. This is the public interface
* for describing input devices. */
#include "global.h"
#include "RageInputDevice.h"
@@ -106,7 +104,7 @@ static void InitNames()
g_mapNamesToString[JOY_UP] = "Up1";
g_mapNamesToString[JOY_DOWN] = "Down1";
/* Secondary sticks: */
// Secondary sticks:
g_mapNamesToString[JOY_LEFT_2] = "Left2";
g_mapNamesToString[JOY_RIGHT_2] = "Right2";
g_mapNamesToString[JOY_UP_2] = "Up2";
@@ -143,13 +141,13 @@ static void InitNames()
g_mapStringToNames[m->second] = m->first;
}
/* Return a reversible representation of a DeviceButton. This is not affected
/* Return a reversible representation of a DeviceButton. This is not affected
* by InputDrivers, localization or the keyboard language. */
RString DeviceButtonToString( DeviceButton key )
{
InitNames();
/* All printable ASCII except for uppercase alpha characters line up. */
// All printable ASCII except for uppercase alpha characters line up.
if( key >= 33 && key < 127 &&
!(key >= 'A' && key <= 'Z' ) )
return ssprintf( "%c", key );
@@ -194,7 +192,6 @@ DeviceButton StringToDeviceButton( const RString& s )
return DeviceButton_Invalid;
}
static const char *InputDeviceNames[] = {
"Key",
"Joy1",
@@ -237,7 +234,7 @@ static const char *InputDeviceNames[] = {
XToString( InputDevice );
StringToX( InputDevice );
/* Return a reversible representation of a DeviceInput. This is not affected by
/* Return a reversible representation of a DeviceInput. This is not affected by
* InputDrivers, localization or the keyboard language. */
RString DeviceInput::ToString() const
{
+2
View File
@@ -69,6 +69,8 @@ wchar_t InputHandler::DeviceButtonToChar( DeviceButton button, bool bUseCurrentK
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL));
// todo: handle Caps Lock -freem
if( bHoldingShift && !bHoldingCtrl )
{
MakeUpper( &c, 1 );
@@ -733,6 +733,7 @@ wchar_t InputHandler_DInput::DeviceButtonToChar( DeviceButton button, bool bUseC
ZERO( keys );
if( bUseCurrentKeyModifiers )
GetKeyboardState(keys);
// todo: handle Caps Lock -freem
wchar_t c = ScancodeAndKeysToChar( i->ofs, keys );
if( c )
return c;
@@ -182,7 +182,7 @@ void InputHandler_MacOSX_HID::AddDevices( int usagePage, int usage, InputDevice
io_iterator_t iter;
CFDictionaryRef dict = GetMatchingDictionary( usagePage, usage );
kern_return_t ret = IOServiceAddMatchingNotification( m_NotifyPort, kIOFirstMatchNotification, dict,
InputHandler_MacOSX_HID::DeviceAdded, this, &iter );
InputHandler_MacOSX_HID::DeviceAdded, this, &iter );
io_object_t device;
if( ret != KERN_SUCCESS )
@@ -394,6 +394,8 @@ wchar_t InputHandler_MacOSX_HID::DeviceButtonToChar( DeviceButton button, bool b
if( bUseCurrentKeyModifiers )
modifiers = GetCurrentKeyModifiers();
// todo: handle Caps Lock -freem
SInt16 iCurrentKeyScript = GetScriptManagerVariable( smKeyScript );
SInt16 iCurrentKeyLayoutID = GetScriptVariable( iCurrentKeyScript, smScriptKeys );
static SInt16 iLastKeyLayoutID = !iCurrentKeyLayoutID; // Just be different.