summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/bootmanager.cpp5
-rw-r--r--src/citra_qt/bootmanager.h2
-rw-r--r--src/input_common/keyboard.cpp11
-rw-r--r--src/input_common/keyboard.h2
4 files changed, 20 insertions, 0 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 28264df9a..e212433d9 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -235,6 +235,11 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
235 motion_emu->EndTilt(); 235 motion_emu->EndTilt();
236} 236}
237 237
238void GRenderWindow::focusOutEvent(QFocusEvent* event) {
239 QWidget::focusOutEvent(event);
240 InputCommon::GetKeyboard()->ReleaseAllKeys();
241}
242
238void GRenderWindow::ReloadSetKeymaps() {} 243void GRenderWindow::ReloadSetKeymaps() {}
239 244
240void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) { 245void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 923a5b456..d1c00fc18 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -128,6 +128,8 @@ public:
128 void mouseMoveEvent(QMouseEvent* event) override; 128 void mouseMoveEvent(QMouseEvent* event) override;
129 void mouseReleaseEvent(QMouseEvent* event) override; 129 void mouseReleaseEvent(QMouseEvent* event) override;
130 130
131 void focusOutEvent(QFocusEvent* event) override;
132
131 void ReloadSetKeymaps(); 133 void ReloadSetKeymaps();
132 134
133 void OnClientAreaResized(unsigned width, unsigned height); 135 void OnClientAreaResized(unsigned width, unsigned height);
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
56private: 63private:
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
89void Keyboard::ReleaseAllKeys() {
90 key_button_list->ChangeAllKeyStatus(false);
91}
92
82} // namespace InputCommon 93} // 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:
38 */ 38 */
39 void ReleaseKey(int key_code); 39 void ReleaseKey(int key_code);
40 40
41 void ReleaseAllKeys();
42
41private: 43private:
42 std::shared_ptr<KeyButtonList> key_button_list; 44 std::shared_ptr<KeyButtonList> key_button_list;
43}; 45};