diff options
Diffstat (limited to 'src/input_common/keyboard.cpp')
| -rw-r--r-- | src/input_common/keyboard.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp index 525fe6abc..078374be5 100644 --- a/src/input_common/keyboard.cpp +++ b/src/input_common/keyboard.cpp | |||
| @@ -36,18 +36,18 @@ struct KeyButtonPair { | |||
| 36 | class KeyButtonList { | 36 | class KeyButtonList { |
| 37 | public: | 37 | public: |
| 38 | void AddKeyButton(int key_code, KeyButton* key_button) { | 38 | void AddKeyButton(int key_code, KeyButton* key_button) { |
| 39 | std::lock_guard<std::mutex> guard(mutex); | 39 | std::lock_guard guard{mutex}; |
| 40 | list.push_back(KeyButtonPair{key_code, key_button}); | 40 | list.push_back(KeyButtonPair{key_code, key_button}); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void RemoveKeyButton(const KeyButton* key_button) { | 43 | void RemoveKeyButton(const KeyButton* key_button) { |
| 44 | std::lock_guard<std::mutex> guard(mutex); | 44 | std::lock_guard guard{mutex}; |
| 45 | list.remove_if( | 45 | list.remove_if( |
| 46 | [key_button](const KeyButtonPair& pair) { return pair.key_button == key_button; }); | 46 | [key_button](const KeyButtonPair& pair) { return pair.key_button == key_button; }); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | void ChangeKeyStatus(int key_code, bool pressed) { | 49 | void ChangeKeyStatus(int key_code, bool pressed) { |
| 50 | std::lock_guard<std::mutex> guard(mutex); | 50 | std::lock_guard guard{mutex}; |
| 51 | for (const KeyButtonPair& pair : list) { | 51 | for (const KeyButtonPair& pair : list) { |
| 52 | if (pair.key_code == key_code) | 52 | if (pair.key_code == key_code) |
| 53 | pair.key_button->status.store(pressed); | 53 | pair.key_button->status.store(pressed); |
| @@ -55,7 +55,7 @@ public: | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | void ChangeAllKeyStatus(bool pressed) { | 57 | void ChangeAllKeyStatus(bool pressed) { |
| 58 | std::lock_guard<std::mutex> guard(mutex); | 58 | std::lock_guard guard{mutex}; |
| 59 | for (const KeyButtonPair& pair : list) { | 59 | for (const KeyButtonPair& pair : list) { |
| 60 | pair.key_button->status.store(pressed); | 60 | pair.key_button->status.store(pressed); |
| 61 | } | 61 | } |