Skip to content

Commit

Permalink
Bring back RHI hack for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed May 11, 2024
1 parent 9efcacb commit caf8bb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
26 changes: 11 additions & 15 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,22 +508,18 @@ PSI_EXPORT_FUNC int main(int argc, char *argv[])
QCoreApplication::addLibraryPath(appPath);
#endif

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) && QT_VERSION <= QT_VERSION_CHECK(6, 8, 0) && defined(WEBENGINE)
// let's hope https://bugreports.qt.io/browse/QTBUG-119221 is going to be fixed before 6.8.0
// Qt::WA_NativeWindow is already added to WebView::WebView.
// Note, it can be highly unstable on some systems. If you enable this, then also remove AA_UseSoftwareOpenGL
// below.
//
// qputenv("QT_WIDGETS_RHI", "1");
// #ifdef Q_OS_WIN
// qputenv("QT_WIDGETS_RHI_BACKEND", "d3d11");
// #elif defined(Q_OS_MAC)
// qputenv("QT_WIDGETS_RHI_BACKEND", "metal");
// #else
// qputenv("QT_WIDGETS_RHI_BACKEND", "opengl");
// #endif
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) && defined(WEBENGINE)
#ifdef Q_OS_WIN
// https://bugreports.qt.io/browse/QTBUG-119221
// See also Qt::WA_NativeWindow in WebView::WebView.
// Note, it can be highly unstable on some systems. If you enable this, then also remove AA_UseSoftwareOpenGL
// below.
qputenv("QT_WIDGETS_RHI", "1");
qputenv("QT_WIDGETS_RHI_BACKEND", "d3d11"); // macos: metal, linux: opengl
#else
QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
#endif
#endif

PsiApplication app(argc, argv);
QApplication::setApplicationName(ApplicationInfo::name());
Expand Down
4 changes: 3 additions & 1 deletion src/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ WebView::WebView(QWidget *parent) :
setAcceptDrops(false);

#ifdef WEBENGINE
// setAttribute(Qt::WA_NativeWindow); // see https://bugreports.qt.io/browse/QTBUG-119221 (potentially unstable)
#ifdef Q_OS_WIN
setAttribute(Qt::WA_NativeWindow); // see https://bugreports.qt.io/browse/QTBUG-119221 (potentially unstable)
#endif
settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
// TODO cache cotrol
Expand Down

0 comments on commit caf8bb1

Please sign in to comment.