Qt: Fix some Qt display driver race conditions

This commit is contained in:
Vicki Pfau 2019-05-08 13:50:30 -07:00
parent 6562e1cfec
commit e6f34e01f1
3 changed files with 6 additions and 1 deletions

View File

@ -37,6 +37,7 @@ Other fixes:
- Qt: Fix adjusting magnification in tile viewer when not fitting to window
- FFmpeg: Improve initialization reliability and cleanup
- Wii: Fix aspect ratio (fixes mgba.io/i/500)
- Qt: Fix some Qt display driver race conditions
Misc:
- GBA Savedata: EEPROM performance fixes
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash

View File

@ -37,6 +37,7 @@ DisplayGL::DisplayGL(const QGLFormat& format, QWidget* parent)
m_painter = new PainterGL(format.majorVersion() < 2 ? 1 : m_gl->format().majorVersion(), m_gl);
m_gl->setMouseTracking(true);
m_gl->setAttribute(Qt::WA_TransparentForMouseEvents); // This doesn't seem to work?
setUpdatesEnabled(false); // Prevent paint events, which can cause race conditions
}
DisplayGL::~DisplayGL() {
@ -219,6 +220,9 @@ PainterGL::PainterGL(int majorVersion, QGLWidget* parent)
#endif
m_backend->swap = [](VideoBackend* v) {
PainterGL* painter = static_cast<PainterGL*>(v->user);
if (!painter->m_gl->isVisible()) {
return;
}
painter->m_gl->swapBuffers();
};

View File

@ -32,7 +32,7 @@ public:
EmptyGLWidget(const QGLFormat& format, QWidget* parent) : QGLWidget(format, parent) { setAutoBufferSwap(false); }
protected:
void paintEvent(QPaintEvent*) override {}
void paintEvent(QPaintEvent* event) override { event->ignore(); }
void resizeEvent(QResizeEvent*) override {}
void mouseMoveEvent(QMouseEvent* event) override { event->ignore(); }
};