diff options
author | Ameer <aj662@drexel.edu> | 2020-06-21 18:36:28 +0200 |
---|---|---|
committer | Ameer <aj662@drexel.edu> | 2020-06-21 18:36:28 +0200 |
commit | 0248614add99c1df1bc7c9ff97091f678ff75aca (patch) | |
tree | e7a4a8e629039f940b4bef76e69d51ddbf2a0639 /src/input_common/keyboard.cpp | |
parent | Merge pull request #4120 from lioncash/arb (diff) | |
download | yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.gz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.bz2 yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.lz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.xz yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.tar.zst yuzu-0248614add99c1df1bc7c9ff97091f678ff75aca.zip |
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 { class KeyButton final : public Input::ButtonDevice { public: explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) - : key_button_list(std::move(key_button_list_)) {} + : key_button_list(std::move(key_button_list_)) { + } ~KeyButton() override; @@ -49,8 +50,10 @@ public: void ChangeKeyStatus(int key_code, bool pressed) { std::lock_guard guard{mutex}; for (const KeyButtonPair& pair : list) { - if (pair.key_code == key_code) + if (pair.key_code == key_code) { pair.key_button->status.store(pressed); + break; + } } } @@ -66,7 +69,9 @@ private: std::list<KeyButtonPair> list; }; -Keyboard::Keyboard() : key_button_list{std::make_shared<KeyButtonList>()} {} +Keyboard::Keyboard() + : key_button_list{std::make_shared<KeyButtonList>()} { +} KeyButton::~KeyButton() { key_button_list->RemoveKeyButton(this); @@ -76,7 +81,7 @@ std::unique_ptr<Input::ButtonDevice> Keyboard::Create(const Common::ParamPackage int key_code = params.Get("code", 0); std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list); key_button_list->AddKeyButton(key_code, button.get()); - return button; + return std::move(button); } void Keyboard::PressKey(int key_code) { |