style fixes
This commit is contained in:
parent
3dc8136e14
commit
3889e4d4b2
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2010 Dolphin Emulator Project
|
// Copyright 2016 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
// Copyright 2013 Dolphin Emulator Project
|
// Copyright 2016 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <Cocoa/Cocoa.h>
|
|
||||||
#include <Foundation/Foundation.h>
|
|
||||||
#include <IOKit/hid/IOHIDLib.h>
|
|
||||||
|
|
||||||
#include "Common/StringUtil.h"
|
|
||||||
|
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
#include "InputCommon/ControllerInterface/Quartz/Quartz.h"
|
#include "InputCommon/ControllerInterface/Quartz/Quartz.h"
|
||||||
#include "InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h"
|
#include "InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h"
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace ciface
|
namespace ciface
|
||||||
{
|
{
|
||||||
namespace Quartz
|
namespace Quartz
|
||||||
|
@ -26,5 +18,5 @@ void Init(void* window)
|
||||||
void DeInit()
|
void DeInit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
} // namespace Quartz
|
||||||
}
|
} // namespace ciface
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
// Copyright 2010 Dolphin Emulator Project
|
// Copyright 2016 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QuartzCore/QuartzCore.h>
|
||||||
|
|
||||||
#include "InputCommon/ControllerInterface/Device.h"
|
#include "InputCommon/ControllerInterface/Device.h"
|
||||||
|
|
||||||
namespace ciface
|
namespace ciface
|
||||||
|
@ -16,7 +18,7 @@ private:
|
||||||
class Key : public Input
|
class Key : public Input
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Key(CGKeyCode keycode);
|
explicit Key(CGKeyCode keycode);
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
ControlState GetState() const override;
|
ControlState GetState() const override;
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ private:
|
||||||
class Button : public Input
|
class Button : public Input
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Button(CGMouseButton button) : m_button(button) {}
|
explicit Button(CGMouseButton button) : m_button(button) {}
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
ControlState GetState() const override;
|
ControlState GetState() const override;
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ private:
|
||||||
public:
|
public:
|
||||||
void UpdateInput() override;
|
void UpdateInput() override;
|
||||||
|
|
||||||
KeyboardAndMouse(void* window);
|
explicit KeyboardAndMouse(void* window);
|
||||||
|
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
std::string GetSource() const override;
|
std::string GetSource() const override;
|
||||||
|
@ -69,5 +71,5 @@ private:
|
||||||
|
|
||||||
uint32_t m_windowid;
|
uint32_t m_windowid;
|
||||||
};
|
};
|
||||||
}
|
} // namespace Quartz
|
||||||
}
|
} // namespace ciface
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
// Copyright 2016 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
#include <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
#include "InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h"
|
#include "InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h"
|
||||||
|
|
||||||
|
@ -87,7 +86,6 @@ KeyboardAndMouse::Key::Key(CGKeyCode keycode) : m_keycode(keycode)
|
||||||
{kVK_F10, "F10"},
|
{kVK_F10, "F10"},
|
||||||
{kVK_F11, "F11"},
|
{kVK_F11, "F11"},
|
||||||
{kVK_F12, "F12"},
|
{kVK_F12, "F12"},
|
||||||
// {kHIDUsage_KeyboardInsert, "Insert"},
|
|
||||||
{kVK_Home, "Home"},
|
{kVK_Home, "Home"},
|
||||||
{kVK_PageUp, "Page Up"},
|
{kVK_PageUp, "Page Up"},
|
||||||
{kVK_ForwardDelete, "Delete"},
|
{kVK_ForwardDelete, "Delete"},
|
||||||
|
@ -113,17 +111,14 @@ KeyboardAndMouse::Key::Key(CGKeyCode keycode) : m_keycode(keycode)
|
||||||
{kVK_ANSI_Keypad9, "Keypad 9"},
|
{kVK_ANSI_Keypad9, "Keypad 9"},
|
||||||
{kVK_ANSI_Keypad0, "Keypad 0"},
|
{kVK_ANSI_Keypad0, "Keypad 0"},
|
||||||
{kVK_ANSI_KeypadDecimal, "Keypad ."},
|
{kVK_ANSI_KeypadDecimal, "Keypad ."},
|
||||||
// {kHIDUsage_KeyboardNonUSBackslash, "Paragraph"},
|
|
||||||
{kVK_ANSI_KeypadEquals, "Keypad ="},
|
{kVK_ANSI_KeypadEquals, "Keypad ="},
|
||||||
// {kHIDUsage_KeypadComma, "Keypad ,"},
|
|
||||||
{kVK_Control, "Left Control"},
|
{kVK_Control, "Left Control"},
|
||||||
{kVK_Shift, "Left Shift"},
|
{kVK_Shift, "Left Shift"},
|
||||||
{kVK_Option, "Left Alt"},
|
{kVK_Option, "Left Alt"},
|
||||||
{kVK_Command, "Left Command"},
|
{kVK_Command, "Command"},
|
||||||
{kVK_RightControl, "Right Control"},
|
{kVK_RightControl, "Right Control"},
|
||||||
{kVK_RightShift, "Right Shift"},
|
{kVK_RightShift, "Right Shift"},
|
||||||
{kVK_RightOption, "Right Alt"},
|
{kVK_RightOption, "Right Alt"},
|
||||||
// {kVK_RightCommand, "Right Command"},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto& named_key : named_keys)
|
for (auto& named_key : named_keys)
|
||||||
|
@ -170,16 +165,16 @@ KeyboardAndMouse::KeyboardAndMouse(void* window)
|
||||||
void KeyboardAndMouse::UpdateInput()
|
void KeyboardAndMouse::UpdateInput()
|
||||||
{
|
{
|
||||||
CGRect bounds = CGRectZero;
|
CGRect bounds = CGRectZero;
|
||||||
uint32_t windowid[1] = {m_windowid};
|
CGWindowID windowid[1] = {m_windowid};
|
||||||
CFArrayRef windowArray = CFArrayCreate(nullptr, (const void**)windowid, 1, nullptr);
|
CFArrayRef windowArray = CFArrayCreate(nullptr, (const void**)windowid, 1, nullptr);
|
||||||
CFArrayRef windowDescriptions = CGWindowListCreateDescriptionFromArray(windowArray);
|
CFArrayRef windowDescriptions = CGWindowListCreateDescriptionFromArray(windowArray);
|
||||||
CFDictionaryRef windowDescription =
|
CFDictionaryRef windowDescription =
|
||||||
(CFDictionaryRef)CFArrayGetValueAtIndex((CFArrayRef)windowDescriptions, 0);
|
static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(windowDescriptions, 0));
|
||||||
|
|
||||||
if (CFDictionaryContainsKey(windowDescription, kCGWindowBounds))
|
if (CFDictionaryContainsKey(windowDescription, kCGWindowBounds))
|
||||||
{
|
{
|
||||||
CFDictionaryRef boundsDictionary =
|
CFDictionaryRef boundsDictionary =
|
||||||
(CFDictionaryRef)CFDictionaryGetValue(windowDescription, kCGWindowBounds);
|
static_cast<CFDictionaryRef>(CFDictionaryGetValue(windowDescription, kCGWindowBounds));
|
||||||
|
|
||||||
if (boundsDictionary != nullptr)
|
if (boundsDictionary != nullptr)
|
||||||
CGRectMakeWithDictionaryRepresentation(boundsDictionary, &bounds);
|
CGRectMakeWithDictionaryRepresentation(boundsDictionary, &bounds);
|
||||||
|
@ -216,7 +211,6 @@ ControlState KeyboardAndMouse::Cursor::GetState() const
|
||||||
ControlState KeyboardAndMouse::Button::GetState() const
|
ControlState KeyboardAndMouse::Button::GetState() const
|
||||||
{
|
{
|
||||||
return CGEventSourceButtonState(kCGEventSourceStateHIDSystemState, m_button) != 0;
|
return CGEventSourceButtonState(kCGEventSourceStateHIDSystemState, m_button) != 0;
|
||||||
// return (m_button != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string KeyboardAndMouse::Cursor::GetName() const
|
std::string KeyboardAndMouse::Cursor::GetName() const
|
||||||
|
@ -237,5 +231,5 @@ std::string KeyboardAndMouse::Button::GetName() const
|
||||||
return "Right Click";
|
return "Right Click";
|
||||||
return std::string("Click ") + char('0' + m_button);
|
return std::string("Click ") + char('0' + m_button);
|
||||||
}
|
}
|
||||||
}
|
} // namespace Quartz
|
||||||
}
|
} // namespace ciface
|
||||||
|
|
Loading…
Reference in New Issue