diff options
| author | 2017-03-20 11:13:52 -0400 | |
|---|---|---|
| committer | 2017-03-20 11:13:52 -0400 | |
| commit | a48e5c64b65c99aea859f5941028f42b117fb8e4 (patch) | |
| tree | b23a5f598b6a0a4b7346e2be7839f2cd4b5de2a5 /src/input_common/keyboard.cpp | |
| parent | Merge pull request #2631 from wwylele/fix-unwrap (diff) | |
| parent | citra-qt: remove dead code (diff) | |
| download | yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.gz yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.tar.xz yuzu-a48e5c64b65c99aea859f5941028f42b117fb8e4.zip | |
Merge pull request #2630 from wwylele/qt-focus-loss-2
Qt: Release all pressed buttons when window focus is lost [rebased]
Diffstat (limited to 'src/input_common/keyboard.cpp')
| -rw-r--r-- | src/input_common/keyboard.cpp | 11 |
1 files changed, 11 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: | |||
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void ChangeAllKeyStatus(bool pressed) { | ||
| 57 | std::lock_guard<std::mutex> guard(mutex); | ||
| 58 | for (const KeyButtonPair& pair : list) { | ||
| 59 | pair.key_button->status.store(pressed); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 56 | private: | 63 | private: |
| 57 | std::mutex mutex; | 64 | std::mutex mutex; |
| 58 | std::list<KeyButtonPair> list; | 65 | std::list<KeyButtonPair> list; |
| @@ -79,4 +86,8 @@ void Keyboard::ReleaseKey(int key_code) { | |||
| 79 | key_button_list->ChangeKeyStatus(key_code, false); | 86 | key_button_list->ChangeKeyStatus(key_code, false); |
| 80 | } | 87 | } |
| 81 | 88 | ||
| 89 | void Keyboard::ReleaseAllKeys() { | ||
| 90 | key_button_list->ChangeAllKeyStatus(false); | ||
| 91 | } | ||
| 92 | |||
| 82 | } // namespace InputCommon | 93 | } // namespace InputCommon |