[vlc-commits] [Git][videolan/vlc][master] qt: decouple scene graph and CompositorDirectComposition
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Mon May 6 18:42:28 UTC 2024
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
3529e880 by Fatih Uzunoglu at 2024-05-06T18:23:27+00:00
qt: decouple scene graph and CompositorDirectComposition
- - - - -
2 changed files:
- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/maininterface/compositor_dcomp.hpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -231,17 +231,9 @@ bool CompositorDirectComposition::makeMainInterface(MainCtx* mainCtx)
&QQuickWindow::frameSwapped, // At this stage, we can be sure that QRhi and QRhiSwapChain are valid.
this,
&CompositorDirectComposition::setup,
- static_cast<Qt::ConnectionType>(Qt::SingleShotConnection | Qt::DirectConnection));
+ Qt::SingleShotConnection);
- connect(quickViewPtr,
- &QQuickWindow::sceneGraphInvalidated,
- this,
- [this]() {
- m_videoVisual.Reset();
- delete m_acrylicSurface.data();
- m_rootVisual.Reset();
- },
- Qt::DirectConnection);
+ m_quickView->installEventFilter(this);
bool appropriateGraphicsApi = true;
@@ -391,4 +383,28 @@ QQuickItem * CompositorDirectComposition::activeFocusItem() const /* override */
return m_quickView->activeFocusItem();
}
+bool CompositorDirectComposition::eventFilter(QObject *watched, QEvent *event)
+{
+ switch (event->type())
+ {
+ case QEvent::PlatformSurface:
+ if (watched == m_quickView.get() &&
+ static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed)
+ {
+ m_videoVisual.Reset();
+ delete m_acrylicSurface.data();
+ // Just in case root visual deletes its children
+ // when it is deleted: (Qt's UI visual should be
+ // deleted by Qt itself)
+ m_rootVisual->RemoveVisual(m_uiVisual);
+ m_rootVisual.Reset();
+ }
+ break;
+ default:
+ break;
+ }
+
+ return QObject::eventFilter(watched, event);
+}
+
}
=====================================
modules/gui/qt/maininterface/compositor_dcomp.hpp
=====================================
@@ -65,6 +65,8 @@ public:
QQuickItem * activeFocusItem() const override;
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
private slots:
void onSurfacePositionChanged(const QPointF& position) override;
void onSurfaceSizeChanged(const QSizeF& size) override;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3529e880b22a15115973de0329fd76bcf6a679da
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3529e880b22a15115973de0329fd76bcf6a679da
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list