mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Merge pull request #6275 from german77/mousefocus
input_common: Release mouse buttons on out of focus
This commit is contained in:
commit
898aa5fb66
3 changed files with 18 additions and 1 deletions
|
@ -143,6 +143,15 @@ void Mouse::ReleaseButton(MouseButton button_) {
|
||||||
mouse_info[button_index].data.axis = {0, 0};
|
mouse_info[button_index].data.axis = {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mouse::ReleaseAllButtons() {
|
||||||
|
buttons = 0;
|
||||||
|
for (auto& info : mouse_info) {
|
||||||
|
info.tilt_speed = 0;
|
||||||
|
info.data.pressed = false;
|
||||||
|
info.data.axis = {0, 0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Mouse::BeginConfiguration() {
|
void Mouse::BeginConfiguration() {
|
||||||
buttons = 0;
|
buttons = 0;
|
||||||
last_button = MouseButton::Undefined;
|
last_button = MouseButton::Undefined;
|
||||||
|
|
|
@ -65,10 +65,16 @@ public:
|
||||||
void MouseMove(int x, int y, int center_x, int center_y);
|
void MouseMove(int x, int y, int center_x, int center_y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals that a motion sensor tilt has ended.
|
* Signals that a button is released.
|
||||||
|
* @param button_ the button pressed
|
||||||
*/
|
*/
|
||||||
void ReleaseButton(MouseButton button_);
|
void ReleaseButton(MouseButton button_);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signals that all buttons are released
|
||||||
|
*/
|
||||||
|
void ReleaseAllButtons();
|
||||||
|
|
||||||
[[nodiscard]] bool ToggleButton(std::size_t button_);
|
[[nodiscard]] bool ToggleButton(std::size_t button_);
|
||||||
[[nodiscard]] bool UnlockButton(std::size_t button_);
|
[[nodiscard]] bool UnlockButton(std::size_t button_);
|
||||||
|
|
||||||
|
|
|
@ -539,6 +539,8 @@ bool GRenderWindow::event(QEvent* event) {
|
||||||
void GRenderWindow::focusOutEvent(QFocusEvent* event) {
|
void GRenderWindow::focusOutEvent(QFocusEvent* event) {
|
||||||
QWidget::focusOutEvent(event);
|
QWidget::focusOutEvent(event);
|
||||||
input_subsystem->GetKeyboard()->ReleaseAllKeys();
|
input_subsystem->GetKeyboard()->ReleaseAllKeys();
|
||||||
|
input_subsystem->GetMouse()->ReleaseAllButtons();
|
||||||
|
this->TouchReleased(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::resizeEvent(QResizeEvent* event) {
|
void GRenderWindow::resizeEvent(QResizeEvent* event) {
|
||||||
|
|
Loading…
Reference in a new issue