diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 1d9c4187e..6749da29f 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -49,13 +49,6 @@ add_library(ui STATIC qt_softwarerenderer.hpp qt_hardwarerenderer.cpp qt_hardwarerenderer.hpp - qt_openglrenderer.cpp - qt_openglrenderer.hpp - qt_opengloptions.cpp - qt_opengloptions.hpp - qt_opengloptionsdialog.cpp - qt_opengloptionsdialog.hpp - qt_opengloptionsdialog.ui qt_settings.cpp qt_settings.hpp @@ -137,6 +130,19 @@ add_library(ui STATIC ../qt_resources.qrc ) +if(NOT APPLE) + target_sources(ui PRIVATE + qt_openglrenderer.cpp + qt_openglrenderer.hpp + qt_opengloptions.cpp + qt_opengloptions.hpp + qt_opengloptionsdialog.cpp + qt_opengloptionsdialog.hpp + qt_opengloptionsdialog.ui + ) +else() + target_sources(ui PRIVATE qt_opengldummy.hpp) +endif() if(WIN32) enable_language(RC) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index e9e7548cf..655fe5b58 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -231,6 +231,9 @@ MainWindow::MainWindow(QWidget *parent) : ui->actionHardware_Renderer_OpenGL_ES->setVisible(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES); if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES && vid_api == 2) vid_api = 1; #endif +#ifdef Q_OS_MACOS + ui->actionOpenGL_3_0_Core->setVisible(false); +#endif if (QApplication::platformName().contains("eglfs") && vid_api >= 1) { fprintf(stderr, "OpenGL renderers are unsupported on EGLFS.\n"); diff --git a/src/qt/qt_opengldummy.hpp b/src/qt/qt_opengldummy.hpp new file mode 100644 index 000000000..6ff9a79b9 --- /dev/null +++ b/src/qt/qt_opengldummy.hpp @@ -0,0 +1,40 @@ +#ifndef QT_OPENGLDUMMY_HPP +#define QT_OPENGLDUMMY_HPP + +#include +#include +#include + +#include +#include +#include + +#include "qt_renderercommon.hpp" + +/* Dummy implementation of OpenGLRenderer so macOS builds. */ +class OpenGLRenderer : public QWindow, public RendererCommon { + Q_OBJECT +public: + OpenGLRenderer(QWidget *parent = nullptr) { emit errorInitializing(); } + virtual std::vector> getBuffers() { return std::vector>(); } + +signals: + void initialized(); + void errorInitializing(); + +public slots: + void onBlit(int buf_idx, int x, int y, int w, int h) { } + +protected: + void exposeEvent(QExposeEvent *event) override + { + if (!done) + emit errorInitializing(); + done = true; + } + +private: + bool done = false; +}; + +#endif \ No newline at end of file diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index be783864d..07762c5ef 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -22,15 +22,21 @@ #include "ui_qt_rendererstack.h" #include "qt_hardwarerenderer.hpp" -#include "qt_openglrenderer.hpp" #include "qt_softwarerenderer.hpp" +#ifndef Q_OS_MACOS +# include "qt_openglrenderer.hpp" +#else +# include "qt_opengldummy.hpp" +#endif + #include "qt_mainwindow.hpp" #include "qt_util.hpp" #include "evdev_mouse.hpp" #include +#include #ifdef __APPLE__ # include