From 54853c2d624993a3f41934364d19c5c9fb628529 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 5 Feb 2022 01:43:12 +0600 Subject: [PATCH] Fix for capture on closing/double-clicking at selection on file dialogs By lemondrops --- src/qt/qt_rendererstack.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index d11b4a0b5..db19e6a7d 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -86,29 +86,33 @@ void RendererStack::mousePoll() #endif } -int ignoreNextMouseEvent = 1; +static int ignoreNextMouseEvent = 1, isButtonDown = 0; void RendererStack::mouseReleaseEvent(QMouseEvent *event) { - if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture) + if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture && (isButtonDown & 1)) { plat_mouse_capture(1); this->setCursor(Qt::BlankCursor); if (!ignoreNextMouseEvent) ignoreNextMouseEvent++; // Avoid jumping cursor when moved. + isButtonDown &= ~1; return; } if (mouse_capture && event->button() == Qt::MiddleButton && mouse_get_buttons() < 3) { plat_mouse_capture(0); this->setCursor(Qt::ArrowCursor); + isButtonDown &= ~1; return; } if (mouse_capture) { mousedata.mousebuttons &= ~event->button(); } + isButtonDown &= ~1; } void RendererStack::mousePressEvent(QMouseEvent *event) { + isButtonDown |= 1; if (mouse_capture) { mousedata.mousebuttons |= event->button();