From a4812891d2ab7ff4413eee68dceb53f2dc3597a1 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 16 Mar 2021 13:09:21 +1100 Subject: [PATCH] only show nouveau warning once --- app/window/mainwindow/mainwindow.cpp | 28 ++++++++++++++++++---------- app/window/mainwindow/mainwindow.h | 4 ++++ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index d45098abc..53c1c5ece 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -50,6 +50,10 @@ MainWindow::MainWindow(QWidget *parent) : taskbar_interface_ = nullptr; #endif +#ifdef Q_OS_LINUX + checked_graphics_vendor_ = false; +#endif + // Create empty central widget - we don't actually want a central widget (so we set its maximum // size to 0,0) but some of Qt's docking/undocking fails without it QWidget* centralWidget = new QWidget(this); @@ -632,16 +636,20 @@ void MainWindow::showEvent(QShowEvent *e) QMainWindow::showEvent(e); #ifdef Q_OS_LINUX - // Check for nouveau since that driver really doesn't work with Olive - QOffscreenSurface surface; - surface.create(); - QOpenGLContext context; - context.create(); - context.makeCurrent(&surface); - const char* vendor = reinterpret_cast(context.functions()->glGetString(GL_VENDOR)); - qDebug() << "Using graphics driver:" << vendor; - if (!strcmp(vendor, "nouveau")) { - QMetaObject::invokeMethod(this, "ShowNouveauWarning", Qt::QueuedConnection); + if (!checked_graphics_vendor_) { + // Check for nouveau since that driver really doesn't work with Olive + QOffscreenSurface surface; + surface.create(); + QOpenGLContext context; + context.create(); + context.makeCurrent(&surface); + const char* vendor = reinterpret_cast(context.functions()->glGetString(GL_VENDOR)); + qDebug() << "Using graphics driver:" << vendor; + if (!strcmp(vendor, "nouveau")) { + QMetaObject::invokeMethod(this, "ShowNouveauWarning", Qt::QueuedConnection); + } + + checked_graphics_vendor_ = true; } #endif } diff --git a/app/window/mainwindow/mainwindow.h b/app/window/mainwindow/mainwindow.h index 240216d1e..19760b8bf 100644 --- a/app/window/mainwindow/mainwindow.h +++ b/app/window/mainwindow/mainwindow.h @@ -156,6 +156,10 @@ private: ITaskbarList3* taskbar_interface_; #endif +#ifdef Q_OS_LINUX + bool checked_graphics_vendor_; +#endif + private slots: void FocusedPanelChanged(PanelWidget* panel);