[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: compositor_dcomp: avoid using a private header to call dcomp

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Feb 1 13:16:24 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3d39b13a by Steve Lhomme at 2025-02-01T12:53:46+00:00
qt: compositor_dcomp: avoid using a private header to call dcomp

This is standard Windows API calls that we can call manually.

- - - - -
b409e038 by Steve Lhomme at 2025-02-01T12:53:46+00:00
qt: don't check private Qt core

We don't use it anymore.

- - - - -


3 changed files:

- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/meson.build
- modules/gui/qt/qt6.pro


Changes:

=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -30,12 +30,7 @@
 #warning "QRhiD3D11 and QRhi headers are required for DirectComposition compositor."
 #endif
 
-#ifndef QT_CORE_PRIVATE
-#warning "QSystemLibrary private header is required for DirectComposition compositor."
-#endif
-
 #include <QtGui/qpa/qplatformnativeinterface.h>
-#include <QtCore/private/qsystemlibrary_p.h>
 
 #if __has_include(<d3d11_1.h>)
 #define QRhiD3D11_ACTIVE
@@ -56,6 +51,9 @@
 #include "compositor_dcomp_acrylicsurface.hpp"
 #include "maininterface/interface_window_handler.hpp"
 
+#include <memory>
+#include <type_traits>
+
 namespace vlc {
 
 int CompositorDirectComposition::windowEnable(const vlc_window_cfg_t *)
@@ -120,14 +118,19 @@ bool CompositorDirectComposition::init()
             return false;
     }
 
-    QSystemLibrary dcomplib(QLatin1String("dcomp"));
+    std::unique_ptr<std::remove_pointer_t<HMODULE>, BOOL WINAPI (*)(HMODULE)>
+        dcomplib(::LoadLibraryEx(TEXT("dcomp.dll"), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32), ::FreeLibrary);
 
     typedef HRESULT (__stdcall *DCompositionCreateDeviceFuncPtr)(
         _In_opt_ IDXGIDevice *dxgiDevice,
         _In_ REFIID iid,
         _Outptr_ void **dcompositionDevice);
-    DCompositionCreateDeviceFuncPtr func = reinterpret_cast<DCompositionCreateDeviceFuncPtr>(
-        dcomplib.resolve("DCompositionCreateDevice"));
+    DCompositionCreateDeviceFuncPtr func = nullptr;
+    if (dcomplib)
+    {
+        func = reinterpret_cast<DCompositionCreateDeviceFuncPtr>(
+            GetProcAddress(dcomplib.get(), "DCompositionCreateDevice"));
+    }
 
     Microsoft::WRL::ComPtr<IDCompositionDevice> device;
     if (!func || FAILED(func(nullptr, IID_PPV_ARGS(&device))))


=====================================
modules/gui/qt/meson.build
=====================================
@@ -1060,10 +1060,6 @@ if qt6_dep.found()
         qt_extra_flags += '-DQT_GUI_PRIVATE'
     endif
 
-    if cpp.has_header('private/qobject_p.h', dependencies: qt6_dep)
-        qt_extra_flags += '-DQT_CORE_PRIVATE'
-    endif
-
     if host_system == 'windows'
         qt_cppargs += libcom_cppflags
     endif


=====================================
modules/gui/qt/qt6.pro
=====================================
@@ -34,11 +34,6 @@ QT += gui-private
 DEFINES += QT_GUI_PRIVATE
 }
 
-qtHaveModule(core-private) {
-QT += core-private
-DEFINES += QT_CORE_PRIVATE
-}
-
 qtHaveModule(quick-private) {
 QT += quick-private
 DEFINES += QT_DECLARATIVE_PRIVATE



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f32d2d323f370d801c140560292993e335307b3e...b409e038783fe18fd2488def82e0bd2400f5af18

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f32d2d323f370d801c140560292993e335307b3e...b409e038783fe18fd2488def82e0bd2400f5af18
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