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