Showing the changes to interface/src/Application.cpp (1 of 24 files). Show all
Unified · Split
| @@ -101,6 +101,7 @@ · 100 unmodified lines | ||
| 101 | 101 | #include <VrMenu.h> |
| 102 | 102 | #include <recording/Deck.h> |
| 103 | 103 | #include <recording/Recorder.h> |
| 104 | +#include <QmlWebWindowClass.h> | |
| 104 | 105 | |
| 105 | 106 | #include "AnimDebugDraw.h" |
| 106 | 107 | #include "AudioClient.h" |
| @@ -362,6 +363,17 @@ Cube3DOverlay* _keyboardFocusHighlight{ nullptr }; · 255 unmodified lines | ||
| 362 | 363 | int _keyboardFocusHighlightID{ -1 }; |
| 363 | 364 | PluginContainer* _pluginContainer; |
| 364 | 365 | |
| 366 | + | |
| 367 | +// FIXME hack access to the internal share context for the Chromium helper | |
| 368 | +// Normally we'd want to use QWebEngine::initialize(), but we can't because | |
| 369 | +// our primary context is a QGLWidget, which can't easily be initialized to share | |
| 370 | +// from a QOpenGLContext. | |
| 371 | +// | |
| 372 | +// So instead we create a new offscreen context to share with the QGLWidget, | |
| 373 | +// and manually set THAT to be the shared context for the Chromium helper | |
| 374 | +OffscreenGLCanvas* _chromiumShareContext { nullptr }; | |
| 375 | +Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); | |
| 376 | + | |
| 365 | 377 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : |
| 366 | 378 | QApplication(argc, argv), |
| 367 | 379 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), |
| @@ -623,6 +635,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 255 unmodified lines | ||
| 623 | 635 | _glWidget->makeCurrent(); |
| 624 | 636 | _glWidget->initializeGL(); |
| 625 | 637 | |
| 638 | + _chromiumShareContext = new OffscreenGLCanvas(); | |
| 639 | + _chromiumShareContext->create(_glWidget->context()->contextHandle()); | |
| 640 | + _chromiumShareContext->makeCurrent(); | |
| 641 | + qt_gl_set_global_share_context(_chromiumShareContext->getContext()); | |
| 642 | + | |
| 626 | 643 | _offscreenContext = new OffscreenGLCanvas(); |
| 627 | 644 | _offscreenContext->create(_glWidget->context()->contextHandle()); |
| 628 | 645 | _offscreenContext->makeCurrent(); |
| @@ -4138,6 +4155,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 3509 unmodified lines | ||
| 4138 | 4155 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, |
| 4139 | 4156 | LocationScriptingInterface::locationSetter); |
| 4140 | 4157 | |
| 4158 | + scriptEngine->registerFunction("QmlWebWindow", QmlWebWindowClass::constructor); | |
| 4141 | 4159 | scriptEngine->registerFunction("WebWindow", WebWindowClass::constructor, 1); |
| 4142 | 4160 | |
| 4143 | 4161 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); |