qt: fix mouse grab on opengl renderer (for windows)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
|
#include <86box/plat.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwareRenderer::resizeGL(int w, int h)
|
void HardwareRenderer::resizeGL(int w, int h)
|
||||||
@@ -45,3 +46,19 @@ void HardwareRenderer::resizeEvent(QResizeEvent *event) {
|
|||||||
onResize(width(), height());
|
onResize(width(), height());
|
||||||
QOpenGLWindow::resizeEvent(event);
|
QOpenGLWindow::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HardwareRenderer::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture)
|
||||||
|
{
|
||||||
|
plat_mouse_capture(1);
|
||||||
|
this->setCursor(Qt::BlankCursor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mouse_capture && event->button() == Qt::MiddleButton)
|
||||||
|
{
|
||||||
|
plat_mouse_capture(0);
|
||||||
|
this->setCursor(Qt::ArrowCursor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@@ -49,4 +49,5 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user