clang-format and cleaning up Key::GetName
This commit is contained in:
parent
3889e4d4b2
commit
6097d30288
|
@ -2,8 +2,8 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/ControllerInterface/Quartz/Quartz.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h"
|
||||
|
||||
namespace ciface
|
||||
|
@ -18,5 +18,5 @@ void Init(void* window)
|
|||
void DeInit()
|
||||
{
|
||||
}
|
||||
} // namespace Quartz
|
||||
} // namespace ciface
|
||||
} // namespace Quartz
|
||||
} // namespace ciface
|
||||
|
|
|
@ -24,7 +24,6 @@ private:
|
|||
|
||||
private:
|
||||
CGKeyCode m_keycode;
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
class Cursor : public Input
|
||||
|
@ -71,5 +70,5 @@ private:
|
|||
|
||||
uint32_t m_windowid;
|
||||
};
|
||||
} // namespace Quartz
|
||||
} // namespace ciface
|
||||
} // namespace Quartz
|
||||
} // namespace ciface
|
||||
|
|
|
@ -13,10 +13,18 @@ namespace ciface
|
|||
{
|
||||
namespace Quartz
|
||||
{
|
||||
|
||||
KeyboardAndMouse::Key::Key(CGKeyCode keycode) : m_keycode(keycode)
|
||||
{
|
||||
static const struct PrettyKeys
|
||||
}
|
||||
|
||||
ControlState KeyboardAndMouse::Key::GetState() const
|
||||
{
|
||||
return CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, m_keycode) != 0;
|
||||
}
|
||||
|
||||
std::string KeyboardAndMouse::Key::GetName() const
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
const CGKeyCode code;
|
||||
const char* const name;
|
||||
|
@ -122,27 +130,12 @@ KeyboardAndMouse::Key::Key(CGKeyCode keycode) : m_keycode(keycode)
|
|||
};
|
||||
|
||||
for (auto& named_key : named_keys)
|
||||
{
|
||||
if (named_key.code == m_keycode)
|
||||
{
|
||||
m_name = named_key.name;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return named_key.name;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Key " << keycode;
|
||||
m_name = ss.str();
|
||||
}
|
||||
|
||||
ControlState KeyboardAndMouse::Key::GetState() const
|
||||
{
|
||||
return CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, m_keycode) != 0;
|
||||
}
|
||||
|
||||
std::string KeyboardAndMouse::Key::GetName() const
|
||||
{
|
||||
return m_name;
|
||||
ss << "Key " << m_keycode;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
KeyboardAndMouse::KeyboardAndMouse(void* window)
|
||||
|
@ -231,5 +224,5 @@ std::string KeyboardAndMouse::Button::GetName() const
|
|||
return "Right Click";
|
||||
return std::string("Click ") + char('0' + m_button);
|
||||
}
|
||||
} // namespace Quartz
|
||||
} // namespace ciface
|
||||
} // namespace Quartz
|
||||
} // namespace ciface
|
||||
|
|
Loading…
Reference in New Issue