summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/citra_qt/bootmanager.cpp5
-rw-r--r--src/citra_qt/bootmanager.h2
-rw-r--r--src/citra_qt/main.cpp1
-rw-r--r--src/input_common/keyboard.cpp11
-rw-r--r--src/input_common/keyboard.h2
5 files changed, 18 insertions, 3 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 28264df9a..bae576d6a 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -235,7 +235,10 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
motion_emu->EndTilt();
}
-void GRenderWindow::ReloadSetKeymaps() {}
+void GRenderWindow::focusOutEvent(QFocusEvent* event) {
+ QWidget::focusOutEvent(event);
+ InputCommon::GetKeyboard()->ReleaseAllKeys();
+}
void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
NotifyClientAreaSizeChanged(std::make_pair(width, height));
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 923a5b456..9d39f1af8 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -128,7 +128,7 @@ public:
void mouseMoveEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
- void ReloadSetKeymaps();
+ void focusOutEvent(QFocusEvent* event) override;
void OnClientAreaResized(unsigned width, unsigned height);
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index fd51659b9..2723a0217 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -612,7 +612,6 @@ void GMainWindow::OnConfigure() {
auto result = configureDialog.exec();
if (result == QDialog::Accepted) {
configureDialog.applyConfiguration();
- render_window->ReloadSetKeymaps();
config->Save();
}
}
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;
};