InputCommon: Clean up brace placements
This commit is contained in:
parent
55a0034dd5
commit
bc14d6966f
|
@ -136,7 +136,8 @@ public:
|
|||
std::string name;
|
||||
name += c;
|
||||
|
||||
while (it != expr.end()) {
|
||||
while (it != expr.end())
|
||||
{
|
||||
c = *it;
|
||||
if (!isalpha(c))
|
||||
break;
|
||||
|
@ -569,7 +570,8 @@ ExpressionParseStatus ParseExpression(std::string str, ControlFinder &finder, Ex
|
|||
qualifier.has_device = false;
|
||||
|
||||
Device::Control *control = finder.FindControl(qualifier);
|
||||
if (control) {
|
||||
if (control)
|
||||
{
|
||||
*expr_out = new Expression(new ControlExpression(qualifier, control));
|
||||
return EXPRESSION_PARSE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ void DeviceElementDebugPrint(const void *value, void *context)
|
|||
recurse = *(bool*)context;
|
||||
|
||||
std::string type = "";
|
||||
switch (IOHIDElementGetType(e)) {
|
||||
switch (IOHIDElementGetType(e))
|
||||
{
|
||||
case kIOHIDElementTypeInput_Axis:
|
||||
type = "axis";
|
||||
break;
|
||||
|
@ -57,7 +58,8 @@ void DeviceElementDebugPrint(const void *value, void *context)
|
|||
std::string c_type = "";
|
||||
if (type == "collection")
|
||||
{
|
||||
switch (IOHIDElementGetCollectionType(e)) {
|
||||
switch (IOHIDElementGetCollectionType(e))
|
||||
{
|
||||
case kIOHIDElementCollectionTypePhysical:
|
||||
c_type = "physical";
|
||||
break;
|
||||
|
|
|
@ -64,12 +64,15 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index)
|
|||
(IOHIDElementRef)CFArrayGetValueAtIndex(axes, i);
|
||||
//DeviceElementDebugPrint(e, nullptr);
|
||||
|
||||
if (IOHIDElementGetUsage(e) == kHIDUsage_GD_Hatswitch) {
|
||||
if (IOHIDElementGetUsage(e) == kHIDUsage_GD_Hatswitch)
|
||||
{
|
||||
AddInput(new Hat(e, m_device, Hat::up));
|
||||
AddInput(new Hat(e, m_device, Hat::right));
|
||||
AddInput(new Hat(e, m_device, Hat::down));
|
||||
AddInput(new Hat(e, m_device, Hat::left));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
AddAnalogInputs(new Axis(e, m_device, Axis::negative),
|
||||
new Axis(e, m_device, Axis::positive));
|
||||
}
|
||||
|
@ -212,7 +215,8 @@ Joystick::Hat::Hat(IOHIDElementRef element, IOHIDDeviceRef device, direction dir
|
|||
, m_device(device)
|
||||
, m_direction(dir)
|
||||
{
|
||||
switch (dir) {
|
||||
switch (dir)
|
||||
{
|
||||
case up:
|
||||
m_name = "Up";
|
||||
break;
|
||||
|
@ -239,7 +243,8 @@ ControlState Joystick::Hat::GetState() const
|
|||
{
|
||||
position = IOHIDValueGetIntegerValue(value);
|
||||
|
||||
switch (position) {
|
||||
switch (position)
|
||||
{
|
||||
case 0:
|
||||
if (m_direction == up)
|
||||
return 1;
|
||||
|
|
|
@ -116,7 +116,8 @@ Keyboard::Key::Key(IOHIDElementRef element, IOHIDDeviceRef device)
|
|||
: m_element(element)
|
||||
, m_device(device)
|
||||
{
|
||||
static const struct PrettyKeys {
|
||||
static const struct PrettyKeys
|
||||
{
|
||||
const uint32_t code;
|
||||
const char *const name;
|
||||
} named_keys[] = {
|
||||
|
@ -224,14 +225,17 @@ Keyboard::Key::Key(IOHIDElementRef element, IOHIDDeviceRef device)
|
|||
{ kHIDUsage_KeyboardRightGUI, "Right Command" },
|
||||
{ 184, "Eject" },
|
||||
};
|
||||
|
||||
|
||||
const uint32_t keycode = IOHIDElementGetUsage(m_element);
|
||||
for (auto & named_key : named_keys)
|
||||
if (named_key.code == keycode) {
|
||||
{
|
||||
if (named_key.code == keycode)
|
||||
{
|
||||
m_name = named_key.name;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Key " << keycode;
|
||||
m_name = ss.str();
|
||||
|
|
Loading…
Reference in New Issue