Fix unsolicited mouse captures after a double-click in an file selection dialog
This commit is contained in:
@@ -89,26 +89,30 @@ void RendererStack::mousePoll()
|
|||||||
int ignoreNextMouseEvent = 1;
|
int ignoreNextMouseEvent = 1;
|
||||||
void RendererStack::mouseReleaseEvent(QMouseEvent *event)
|
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 && (isMouseDown & 1))
|
||||||
{
|
{
|
||||||
plat_mouse_capture(1);
|
plat_mouse_capture(1);
|
||||||
this->setCursor(Qt::BlankCursor);
|
this->setCursor(Qt::BlankCursor);
|
||||||
if (!ignoreNextMouseEvent) ignoreNextMouseEvent++; // Avoid jumping cursor when moved.
|
if (!ignoreNextMouseEvent) ignoreNextMouseEvent++; // Avoid jumping cursor when moved.
|
||||||
|
isMouseDown &= ~1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mouse_capture && event->button() == Qt::MiddleButton && mouse_get_buttons() < 3)
|
if (mouse_capture && event->button() == Qt::MiddleButton && mouse_get_buttons() < 3)
|
||||||
{
|
{
|
||||||
plat_mouse_capture(0);
|
plat_mouse_capture(0);
|
||||||
this->setCursor(Qt::ArrowCursor);
|
this->setCursor(Qt::ArrowCursor);
|
||||||
|
isMouseDown &= ~1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mouse_capture)
|
if (mouse_capture)
|
||||||
{
|
{
|
||||||
mousedata.mousebuttons &= ~event->button();
|
mousedata.mousebuttons &= ~event->button();
|
||||||
}
|
}
|
||||||
|
isMouseDown &= ~1;
|
||||||
}
|
}
|
||||||
void RendererStack::mousePressEvent(QMouseEvent *event)
|
void RendererStack::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
isMouseDown |= 1;
|
||||||
if (mouse_capture)
|
if (mouse_capture)
|
||||||
{
|
{
|
||||||
mousedata.mousebuttons |= event->button();
|
mousedata.mousebuttons |= event->button();
|
||||||
|
@@ -64,6 +64,7 @@ private:
|
|||||||
int x, y, w, h, sx, sy, sw, sh;
|
int x, y, w, h, sx, sy, sw, sh;
|
||||||
|
|
||||||
int currentBuf = 0;
|
int currentBuf = 0;
|
||||||
|
int isMouseDown = 0;
|
||||||
std::vector<std::tuple<uint8_t*, std::atomic_flag*>> imagebufs;
|
std::vector<std::tuple<uint8_t*, std::atomic_flag*>> imagebufs;
|
||||||
|
|
||||||
std::unique_ptr<QWidget> current;
|
std::unique_ptr<QWidget> current;
|
||||||
|
Reference in New Issue
Block a user