mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 22:20:14 +00:00
citra-qt: release all buttons when render window focus is lost
This commit is contained in:
parent
372db835f4
commit
218ad5c89e
@ -230,6 +230,10 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
|
||||
motion_emu->EndTilt();
|
||||
}
|
||||
|
||||
void GRenderWindow::focusOutEvent(QFocusEvent* event) {
|
||||
KeyMap::ReleaseAllKeys(*this);
|
||||
}
|
||||
|
||||
void GRenderWindow::ReloadSetKeymaps() {
|
||||
KeyMap::ClearKeyMapping(keyboard_id);
|
||||
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
|
||||
|
@ -127,6 +127,8 @@ public:
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
|
||||
void ReloadSetKeymaps() override;
|
||||
|
||||
void OnClientAreaResized(unsigned width, unsigned height);
|
||||
|
@ -149,4 +149,16 @@ void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReleaseAllKeys(EmuWindow& emu_window) {
|
||||
// Release "all" of the buttons.
|
||||
emu_window.ButtonReleased({0xFFFFFFFF});
|
||||
|
||||
circle_pad_up = false;
|
||||
circle_pad_right = false;
|
||||
circle_pad_left = false;
|
||||
circle_pad_right = false;
|
||||
circle_pad_modifier = false;
|
||||
UpdateCirclePad(emu_window);
|
||||
}
|
||||
}
|
||||
|
@ -90,4 +90,9 @@ void PressKey(EmuWindow& emu_window, HostDeviceKey key);
|
||||
* Maps a key release action and call the corresponding function in EmuWindow
|
||||
*/
|
||||
void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key);
|
||||
|
||||
/**
|
||||
* Releases all pressed keys and resets the circle pad state to the center.
|
||||
*/
|
||||
void ReleaseAllKeys(EmuWindow& emu_window);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user