Changes of Revision 27
_service:obs_scm:vlc-beta-20240906.a52a78e6cd.obscpio/modules/gui/qt/maininterface/compositor_dcomp.cpp -> _service:obs_scm:vlc-beta-20240906.1b69314318.obscpio/modules/gui/qt/maininterface/compositor_dcomp.cpp
Changed
x
1
2
return false;
3
}
4
5
+ const QString& sceneGraphBackend = qEnvironmentVariable("QT_QUICK_BACKEND");
6
+ if (!sceneGraphBackend.isEmpty() /* if empty, RHI is used */ &&
7
+ sceneGraphBackend != QLatin1String("rhi"))
8
+ {
9
+ // No RHI means no D3D11 or D3D12, the graphics API check
10
+ // below is only relevant when RHI is in use.
11
+ // If QT_QUICK_BACKEND is set to software or openvg, then
12
+ // `QQuickWindow::graphicsApi()` might still report D3D11 or
13
+ // D3D12 until the scene graph is initialized.
14
+ // Unlike `QQuickWindow::graphicsApi()`, `sceneGraphBackend()`
15
+ // is only valid after the window is constructed, so instead
16
+ // of using `QQuickWindow::sceneGraphBackend()`, simply probe
17
+ // the environment variable.
18
+ return false;
19
+ }
20
+
21
+ const auto graphicsApi = QQuickWindow::graphicsApi();
22
+ if (graphicsApi != QSGRendererInterface::Direct3D11 &&
23
+ graphicsApi != QSGRendererInterface::Direct3D12)
24
+ return false;
25
+
26
return true;
27
}
28
29
30
31
bool appropriateGraphicsApi = true;
32
33
- QEventLoop eventLoop;
34
connect(quickViewPtr,
35
- &QQuickWindow::sceneGraphInitialized,
36
- &eventLoop,
37
- &eventLoop, &appropriateGraphicsApi, quickViewPtr, this() {
38
- if (QQuickWindow::graphicsApi() == QSGRendererInterface::Direct3D11 ||
39
- QQuickWindow::graphicsApi() == QSGRendererInterface::Direct3D12)
40
- {
41
- connect(quickViewPtr,
42
- &QQuickWindow::frameSwapped, // At this stage, we can be sure that QRhi and QRhiSwapChain are valid.
43
- this,
44
- this, &eventLoop() {
45
- setup();
46
- eventLoop.quit();
47
- },
48
- Qt::SingleShotConnection);
49
- }
50
- else
51
- {
52
- appropriateGraphicsApi = false;
53
- eventLoop.quit();
54
- }
55
- }, static_cast<Qt::ConnectionType>(Qt::SingleShotConnection | Qt::DirectConnection));
56
-
57
- connect(quickViewPtr,
58
- &QQuickWindow::sceneGraphError,
59
- &eventLoop,
60
- &eventLoop, &appropriateGraphicsApi(QQuickWindow::SceneGraphError error, const QString &message) {
61
- qWarning() << "CompositorDComp: Scene Graph Error: " << error << ", Message: " << message;
62
- appropriateGraphicsApi = false;
63
- eventLoop.quit();
64
- }, static_cast<Qt::ConnectionType>(Qt::SingleShotConnection | Qt::DirectConnection));
65
-
66
- CompositorVideo::Flags flags = CompositorVideo::CAN_SHOW_PIP | CompositorVideo::HAS_ACRYLIC;
67
+ &QQuickWindow::frameSwapped, // At this stage, we can be sure that QRhi and QRhiSwapChain are valid.
68
+ this,
69
+ &CompositorDirectComposition::setup,
70
+ Qt::SingleShotConnection);
71
72
m_quickView->create();
73
74
- const bool ret = commonGUICreate(quickViewPtr, quickViewPtr, flags);
75
+ const bool ret = commonGUICreate(quickViewPtr, quickViewPtr, CompositorVideo::CAN_SHOW_PIP | CompositorVideo::HAS_ACRYLIC);
76
77
- if (ret)
78
- m_quickView->show();
79
- else
80
+ if (!ret)
81
return false;
82
83
- if (!m_quickView->isSceneGraphInitialized())
84
- eventLoop.exec();
85
- return (ret && appropriateGraphicsApi);
86
+ m_quickView->show();
87
+
88
+ return true;
89
}
90
91
void CompositorDirectComposition::onSurfacePositionChanged(const QPointF& position)
92
_service:obs_scm:vlc-beta-20240906.a52a78e6cd.obscpio/modules/gui/qt/maininterface/compositor_platform.cpp -> _service:obs_scm:vlc-beta-20240906.1b69314318.obscpio/modules/gui/qt/maininterface/compositor_platform.cpp
Changed
39
1
2
m_quickWindow->setOpacity(0.0);
3
m_quickWindow->setOpacity(1.0);
4
5
+ m_rootWindow->installEventFilter(this);
6
+
7
m_rootWindow->show();
8
m_videoWindow->show();
9
m_quickWindow->show();
10
11
return m_quickWindow->activeFocusItem();
12
}
13
14
+bool CompositorPlatform::eventFilter(QObject *watched, QEvent *event)
15
+{
16
+ // Forward drag events to the child quick window,
17
+ // as it is not done automatically by Qt with
18
+ // nested windows:
19
+ if (m_quickWindow && watched == m_rootWindow.get())
20
+ {
21
+ switch (event->type()) {
22
+ case QEvent::DragEnter:
23
+ case QEvent::DragLeave:
24
+ case QEvent::DragMove:
25
+ case QEvent::DragResponse:
26
+ case QEvent::Drop:
27
+ QApplication::sendEvent(m_quickWindow, event);
28
+ return true;
29
+ default:
30
+ break;
31
+ };
32
+ }
33
+ return false;
34
+}
35
+
36
int CompositorPlatform::windowEnable(const vlc_window_cfg_t *)
37
{
38
commonWindowEnable();
39
_service:obs_scm:vlc-beta-20240906.a52a78e6cd.obscpio/modules/gui/qt/maininterface/compositor_platform.hpp -> _service:obs_scm:vlc-beta-20240906.1b69314318.obscpio/modules/gui/qt/maininterface/compositor_platform.hpp
Changed
10
1
2
Type type() const override;
3
QQuickItem * activeFocusItem() const override;
4
5
+ bool eventFilter(QObject *watched, QEvent *event) override;
6
+
7
private:
8
int windowEnable(const vlc_window_cfg_t *) override;
9
void windowDisable() override;
10
_service:obs_scm:vlc-beta.obsinfo
Changed
9
1
2
name: vlc-beta
3
-version: 20240906.a52a78e6cd
4
-mtime: 1725645638
5
-commit: a52a78e6cd05217939e29abbc6ba88b73891f3ff
6
+version: 20240906.1b69314318
7
+mtime: 1725652245
8
+commit: 1b693143180a914ba54b4a87fbe1739e31e13fd1
9