clang-format and cleaning up Key::GetName

This commit is contained in:
Michael Maltese 2016-08-09 17:23:30 -07:00
parent 3889e4d4b2
commit 6097d30288
3 changed files with 20 additions and 28 deletions

View File

@ -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

View File

@ -24,7 +24,6 @@ private:
private:
CGKeyCode m_keycode;
std::string m_name;
};
class Cursor : public Input

View File

@ -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)