diff options
| author | 2020-06-21 12:36:28 -0400 | |
|---|---|---|
| committer | 2020-06-21 12:36:28 -0400 | |
| commit | 0248614add99c1df1bc7c9ff97091f678ff75aca (patch) | |
| tree | e7a4a8e629039f940b4bef76e69d51ddbf2a0639 /src/input_common/keyboard.cpp | |
| parent | Merge pull request #4120 from lioncash/arb (diff) | |
| download | yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.gz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.xz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.zip | |
GC Adapter Implementation
Diffstat (limited to 'src/input_common/keyboard.cpp')
| -rw-r--r-- | src/input_common/keyboard.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp index afb8e6612..d76791860 100644 --- a/src/input_common/keyboard.cpp +++ b/src/input_common/keyboard.cpp | |||
| @@ -13,7 +13,8 @@ namespace InputCommon { | |||
| 13 | class KeyButton final : public Input::ButtonDevice { | 13 | class KeyButton final : public Input::ButtonDevice { |
| 14 | public: | 14 | public: |
| 15 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) | 15 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) |
| 16 | : key_button_list(std::move(key_button_list_)) {} | 16 | : key_button_list(std::move(key_button_list_)) { |
| 17 | } | ||
| 17 | 18 | ||
| 18 | ~KeyButton() override; | 19 | ~KeyButton() override; |
| 19 | 20 | ||
| @@ -49,8 +50,10 @@ public: | |||
| 49 | void ChangeKeyStatus(int key_code, bool pressed) { | 50 | void ChangeKeyStatus(int key_code, bool pressed) { |
| 50 | std::lock_guard guard{mutex}; | 51 | std::lock_guard guard{mutex}; |
| 51 | for (const KeyButtonPair& pair : list) { | 52 | for (const KeyButtonPair& pair : list) { |
| 52 | if (pair.key_code == key_code) | 53 | if (pair.key_code == key_code) { |
| 53 | pair.key_button->status.store(pressed); | 54 | pair.key_button->status.store(pressed); |
| 55 | break; | ||
| 56 | } | ||
| 54 | } | 57 | } |
| 55 | } | 58 | } |
| 56 | 59 | ||
| @@ -66,7 +69,9 @@ private: | |||
| 66 | std::list<KeyButtonPair> list; | 69 | std::list<KeyButtonPair> list; |
| 67 | }; | 70 | }; |
| 68 | 71 | ||
| 69 | Keyboard::Keyboard() : key_button_list{std::make_shared<KeyButtonList>()} {} | 72 | Keyboard::Keyboard() |
| 73 | : key_button_list{std::make_shared<KeyButtonList>()} { | ||
| 74 | } | ||
| 70 | 75 | ||
| 71 | KeyButton::~KeyButton() { | 76 | KeyButton::~KeyButton() { |
| 72 | key_button_list->RemoveKeyButton(this); | 77 | key_button_list->RemoveKeyButton(this); |
| @@ -76,7 +81,7 @@ std::unique_ptr<Input::ButtonDevice> Keyboard::Create(const Common::ParamPackage | |||
| 76 | int key_code = params.Get("code", 0); | 81 | int key_code = params.Get("code", 0); |
| 77 | std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list); | 82 | std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list); |
| 78 | key_button_list->AddKeyButton(key_code, button.get()); | 83 | key_button_list->AddKeyButton(key_code, button.get()); |
| 79 | return button; | 84 | return std::move(button); |
| 80 | } | 85 | } |
| 81 | 86 | ||
| 82 | void Keyboard::PressKey(int key_code) { | 87 | void Keyboard::PressKey(int key_code) { |