summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorMichael Maltese <michael.joseph.maltese@gmail.com>2016-08-09 17:23:30 -0700
committerMichael Maltese <michael.joseph.maltese@gmail.com>2016-08-09 17:23:30 -0700
commit6097d30288429637b4c49613c6a1535403c73c69 (patch)
treef1a4bbd82b93d6e1a787ce7ab04b8da0e4362a0d /Source/Core/InputCommon/ControllerInterface
parent3889e4d4b28a4d0a3ba495bffeaa95a13a97744f (diff)
clang-format and cleaning up Key::GetName
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Quartz/Quartz.mm6
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h5
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm37
3 files changed, 20 insertions, 28 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/Quartz.mm b/Source/Core/InputCommon/ControllerInterface/Quartz/Quartz.mm
index 99b31bf3ef..6fdac0e798 100644
--- a/Source/Core/InputCommon/ControllerInterface/Quartz/Quartz.mm
+++ b/Source/Core/InputCommon/ControllerInterface/Quartz/Quartz.mm
@@ -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
diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h
index 209e6d8436..0f5eafc895 100644
--- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h
+++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h
@@ -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
diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm
index d3a8b8d535..0a00337a00 100644
--- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm
+++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm
@@ -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