summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-03-20 16:13:52 +0100
committerGitHub <noreply@github.com>2017-03-20 16:13:52 +0100
commita48e5c64b65c99aea859f5941028f42b117fb8e4 (patch)
treeb23a5f598b6a0a4b7346e2be7839f2cd4b5de2a5 /src/input_common
parentMerge pull request #2631 from wwylele/fix-unwrap (diff)
parentcitra-qt: remove dead code (diff)
downloadyuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar
yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.gz
yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.bz2
yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.lz
yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.xz
yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.zst
yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.zip
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/keyboard.cpp11
-rw-r--r--src/input_common/keyboard.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp
index a8fc01f2e..0f0d10f23 100644
--- a/src/input_common/keyboard.cpp
+++ b/src/input_common/keyboard.cpp
@@ -53,6 +53,13 @@ public:
}
}
+ void ChangeAllKeyStatus(bool pressed) {
+ std::lock_guard<std::mutex> guard(mutex);
+ for (const KeyButtonPair& pair : list) {
+ pair.key_button->status.store(pressed);
+ }
+ }
+
private:
std::mutex mutex;
std::list<KeyButtonPair> list;
@@ -79,4 +86,8 @@ void Keyboard::ReleaseKey(int key_code) {
key_button_list->ChangeKeyStatus(key_code, false);
}
+void Keyboard::ReleaseAllKeys() {
+ key_button_list->ChangeAllKeyStatus(false);
+}
+
} // namespace InputCommon
diff --git a/src/input_common/keyboard.h b/src/input_common/keyboard.h
index 76359aa30..861950472 100644
--- a/src/input_common/keyboard.h
+++ b/src/input_common/keyboard.h
@@ -38,6 +38,8 @@ public:
*/
void ReleaseKey(int key_code);
+ void ReleaseAllKeys();
+
private:
std::shared_ptr<KeyButtonList> key_button_list;
};