[vlc-commits] [Git][videolan/vlc][3.0.x] 7 commits: configure: fix X11 pre-libraries typo X_PRE_LIBS

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Aug 8 05:21:40 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
faa6468e by Nathan E. Egge at 2026-08-07T10:09:11-04:00
configure: fix X11 pre-libraries typo X_PRE_LIBS

- - - - -
79c995dd by Nathan E. Egge at 2026-08-07T10:09:23-04:00
qt: rename QT5_HAS_XCB to QT_HAS_XCB

- - - - -
7e044b61 by Nathan E. Egge at 2026-08-07T10:09:32-04:00
qt: rename QT5_HAS_X11 to QT_HAS_X11

- - - - -
e5de9e15 by Nathan E. Egge at 2026-08-07T10:09:44-04:00
configure: add qt6_configured flag

- - - - -
35f126b6 by Nathan E. Egge at 2026-08-07T10:10:33-04:00
qt: add vlcQtIsX11() helper function to qt_x11.hpp

QX11Info was removed in Qt6 and the X11 platform is now queried through
 QNativeInterface::QX11Application which is part of QtGui.
The vlcQtIsX11() helper function abstracts detecting if the platform is
 X11 and works on both Qt5 and Qt6.

- - - - -
62bd21db by Nathan E. Egge at 2026-08-07T10:10:45-04:00
qt: add vlcQtX11Display() helper function

The vlcQtX11Display() helper function abstracts getting the X11 Display
 and works on both Qt5 and Qt6.

- - - - -
71cd28c4 by Nathan E. Egge at 2026-08-07T10:10:54-04:00
configure: enable X11 support with Qt6

- - - - -


6 changed files:

- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/components/interface_widgets.cpp
- modules/gui/qt/main_interface.cpp
- modules/gui/qt/qt.cpp
- + modules/gui/qt/qt_x11.hpp


Changes:

=====================================
configure.ac
=====================================
@@ -3924,6 +3924,7 @@ AC_ARG_ENABLE(qt, [
   ])
 ])
 have_qt5_x11="no"
+qt6_configured="no"
 AS_IF([test "${enable_qt}" != "no"], [
   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.5.0 Qt5Widgets Qt5Gui Qt5Svg], [
       PKG_CHECK_MODULES([QT5_X11], [Qt5X11Extras], [
@@ -3940,6 +3941,7 @@ AS_IF([test "${enable_qt}" != "no"], [
     ], [
       dnl use any qmake that is available, including from contrib tools
       AC_PATH_PROGS(QMAKE6, [qmake6 qmake], qmake6, ["${CONTRIB_DIR}/../bin:$PATH"])
+      QT_QMAKE_MAJOR="$(${QMAKE6} -query QT_VERSION 2>/dev/null | cut -d. -f1)"
 
       AC_ARG_WITH([qtconf],
         AS_HELP_STRING([--with-qtconf=PATH], [location of Qt6 qt.conf file (auto)])
@@ -4030,6 +4032,8 @@ AS_IF([test "${enable_qt}" != "no"], [
           AC_MSG_RESULT([no])
         ])
         rm -f ${ac_pwd}/modules/gui/qt/qmake-private-gui
+
+        AS_IF([test "${QT_QMAKE_MAJOR}" = "6"], [qt6_configured="yes"])
       ],[
         AS_IF([test -n "${enable_qt}"],[
           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
@@ -4046,6 +4050,18 @@ AS_IF([test "${enable_qt}" != "no"], [
 ])
 AC_SUBST(QT_VERSION)
 AM_CONDITIONAL(ENABLE_QT, [test "$enable_qt" != "no"])
+dnl HAVE_QT_X11 enables the helper code that abstracts Qt5 v Qt6 access to X11
+have_qt_x11="no"
+AS_IF([test "${enable_qt}" != "no"], [
+  AS_IF([test "${qt6_configured}" = "yes"], [
+    AS_IF([test "${no_x}" != "yes"], [
+      have_qt_x11="yes"
+    ])
+  ], [
+    have_qt_x11="${have_qt5_x11}"
+  ])
+])
+AM_CONDITIONAL([HAVE_QT_X11], [test "${have_qt_x11}" = "yes"])
 AM_CONDITIONAL([HAVE_QT5_X11], [test "${have_qt5_x11}" = "yes"])
 AM_CONDITIONAL([HAVE_QT_GUI_PRIVATE], [test "${have_qt_gui_private}" = "yes"])
 


=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -22,12 +22,17 @@ libqt_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(guidir)'
 if HAVE_DARWIN
 libqt_plugin_la_LDFLAGS += -Wl,-framework,Cocoa
 endif
+if HAVE_QT_X11
+libqt_plugin_la_CXXFLAGS += -DQT_HAS_X11
+libqt_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIBS) -lX11
+endif
 if HAVE_QT5_X11
-libqt_plugin_la_CXXFLAGS += $(QT5_X11_CFLAGS) -DQT5_HAS_X11
-libqt_plugin_la_LIBADD += $(QT5_X11_LIBS) $(X_LIBS) $(X_PRE_LIB) -lX11
+# Qt5 needs Qt5X11Extras for QX11Info
+libqt_plugin_la_CXXFLAGS += $(QT5_X11_CFLAGS)
+libqt_plugin_la_LIBADD += $(QT5_X11_LIBS)
 endif
 if HAVE_XCB
-libqt_plugin_la_CXXFLAGS += -DQT5_HAS_XCB
+libqt_plugin_la_CXXFLAGS += -DQT_HAS_XCB
 endif
 if HAVE_WIN32
 libqt_plugin_la_LIBADD += $(LIBCOM) -lcomctl32 -luuid
@@ -41,7 +46,7 @@ libqt_plugin_la_CPPFLAGS += -DQT_GUI_PRIVATE $(QT_GUI_PRIVATE_CFLAGS)
 endif
 
 libqt_plugin_la_SOURCES = \
-	gui/qt/qt.cpp gui/qt/qt.hpp \
+	gui/qt/qt.cpp gui/qt/qt.hpp gui/qt/qt_x11.hpp \
 	gui/qt/menus.cpp gui/qt/menus.hpp \
 	gui/qt/main_interface.cpp gui/qt/main_interface.hpp \
 	gui/qt/dialogs_provider.cpp gui/qt/dialogs_provider.hpp \


=====================================
modules/gui/qt/components/interface_widgets.cpp
=====================================
@@ -52,10 +52,10 @@ static inline int qrand() {
 }
 #endif
 
-#if defined (QT5_HAS_X11)
+#if defined (QT_HAS_X11)
 # include <X11/Xlib.h>
-# include <QX11Info>
-# if defined(QT5_HAS_XCB)
+# include "qt_x11.hpp"
+# if defined(QT_HAS_XCB)
 #  include <xcb/xproto.h>
 # endif
 #endif
@@ -102,9 +102,9 @@ void VideoWidget::sync( void )
     /* Make sure the X server has processed all requests.
      * This protects other threads using distinct connections from getting
      * the video widget window in an inconsistent states. */
-#ifdef QT5_HAS_X11
-    if( QX11Info::isPlatformX11() )
-        XSync( QX11Info::display(), False );
+#ifdef QT_HAS_X11
+    if( vlcQtIsX11() )
+        XSync( vlcQtX11Display(), False );
 #endif
 }
 
@@ -136,7 +136,7 @@ bool VideoWidget::request( struct vout_window_t *p_wnd )
        management */
     /* This is currently disabled on X11 as it does not seem to improve
      * performance, but causes the video widget to be transparent... */
-#if !defined (QT5_HAS_X11)
+#if !defined (QT_HAS_X11)
     stable->setAttribute( Qt::WA_PaintOnScreen, true );
 #else
     stable->setMouseTracking( true );
@@ -170,10 +170,10 @@ bool VideoWidget::request( struct vout_window_t *p_wnd )
 
 QSize VideoWidget::physicalSize() const
 {
-#ifdef QT5_HAS_X11
-    if ( QX11Info::isPlatformX11() )
+#ifdef QT_HAS_X11
+    if ( vlcQtIsX11() )
     {
-        Display *p_x_display = QX11Info::display();
+        Display *p_x_display = vlcQtX11Display();
         Window x_window = stable->winId();
         XWindowAttributes x_attributes;
 
@@ -251,8 +251,8 @@ bool VideoWidget::nativeEventFilter(const QByteArray &eventType, void *message,
 bool VideoWidget::nativeEventFilter(const QByteArray &eventType, void *message, long *)
 #endif
 {
-#if defined(QT5_HAS_X11)
-# if defined(QT5_HAS_XCB)
+#if defined(QT_HAS_X11)
+# if defined(QT_HAS_XCB)
     if ( eventType == "xcb_generic_event_t" )
     {
         const xcb_generic_event_t* xev = static_cast<const xcb_generic_event_t*>( message );


=====================================
modules/gui/qt/main_interface.cpp
=====================================
@@ -68,7 +68,7 @@
 # include <QStatusBar>
 #endif
 
-#if ! HAS_QT510 && defined(QT5_HAS_X11)
+#if ! HAS_QT510 && defined(QT_HAS_X11)
 # include <QX11Info>
 # include <X11/Xlib.h>
 #endif
@@ -1351,7 +1351,7 @@ void MainInterface::toggleUpdateSystrayMenuWhenVisible()
 
 void MainInterface::resizeWindow(int w, int h)
 {
-#if ! HAS_QT510 && defined(QT5_HAS_X11)
+#if ! HAS_QT510 && defined(QT_HAS_X11)
     if( QX11Info::isPlatformX11() )
     {
 #if HAS_QT56


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -365,9 +365,9 @@ static void Abort( void *obj )
 }
 #endif
 
-#if defined (QT5_HAS_X11)
+#if defined (QT_HAS_X11)
 # include <vlc_xlib.h>
-# include <QX11Info>
+# include "qt_x11.hpp"
 
 static void *ThreadXCB( void *data )
 {
@@ -453,7 +453,7 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
     void *(*thread)(void *) = Thread;
 
-#ifdef QT5_HAS_X11
+#ifdef QT_HAS_X11
     if( HasX11( p_this ) )
         thread = ThreadXCB;
     else
@@ -756,7 +756,7 @@ static int WindowControl( vout_window_t *, int i_query, va_list );
 
 typedef struct {
     MainInterface *mi;
-#ifdef QT5_HAS_X11
+#ifdef QT_HAS_X11
     Display *dpy;
 #endif
     QMutex lock;
@@ -797,10 +797,10 @@ static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
     p_wnd->sys = (vout_window_sys_t *)sys;
     msg_Dbg( p_wnd, "requesting video window..." );
 
-#ifdef QT5_HAS_X11
+#ifdef QT_HAS_X11
     Window xid;
 
-    if (QX11Info::isPlatformX11())
+    if (vlcQtIsX11())
     {
         sys->dpy = XOpenDisplay(NULL);
         if (unlikely(sys->dpy == NULL))
@@ -820,16 +820,16 @@ static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
 
     if (!sys->mi->getVideo(p_wnd, cfg->width, cfg->height, cfg->is_fullscreen))
     {
-#ifdef QT5_HAS_X11
-        if (QX11Info::isPlatformX11())
+#ifdef QT_HAS_X11
+        if (vlcQtIsX11())
             XCloseDisplay(sys->dpy);
 #endif
         delete sys;
         return VLC_EGENERIC;
     }
 
-#ifdef QT5_HAS_X11
-    if (QX11Info::isPlatformX11())
+#ifdef QT_HAS_X11
+    if (vlcQtIsX11())
     {
         QMutexLocker locker2(&sys->lock);
 
@@ -846,10 +846,10 @@ static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
 
 void WindowResized(vout_window_t *wnd, const QSize& size)
 {
-#ifdef QT5_HAS_X11
+#ifdef QT_HAS_X11
     vout_window_qt_t *sys = (vout_window_qt_t *)wnd->sys;
 
-    if (QX11Info::isPlatformX11())
+    if (vlcQtIsX11())
     {
         XResizeWindow(sys->dpy, wnd->handle.xid, size.width(), size.height());
         XSync(sys->dpy, True);
@@ -877,8 +877,8 @@ void WindowOrphaned(vout_window_t *wnd)
     QMutexLocker locker(&sys->lock);
 
     msg_Warn(wnd, "orphaned video window");
-#if defined (QT5_HAS_X11)
-    if (QX11Info::isPlatformX11())
+#if defined (QT_HAS_X11)
+    if (vlcQtIsX11())
     {   /* In the unlikely event that WindowOpen() has not yet reparented the
          * window, WindowOpen() will skip reparenting. Then this call will be
          * a no-op.
@@ -913,8 +913,8 @@ static void WindowClose( vout_window_t *p_wnd )
     else
         msg_Warn (p_wnd, "video already released");
 
-#if defined (QT5_HAS_X11)
-    if (QX11Info::isPlatformX11())
+#if defined (QT_HAS_X11)
+    if (vlcQtIsX11())
         XCloseDisplay(sys->dpy);
 #endif
     delete sys;


=====================================
modules/gui/qt/qt_x11.hpp
=====================================
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * qt_x11.hpp : X11 helper functions
+ ****************************************************************************
+ * Copyright (C) 2006-2026 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Nathan E. Egge <unlord at videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef QVLC_X11_H_
+#define QVLC_X11_H_
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <QGuiApplication>
+#include <QtGui/qguiapplication_platform.h>
+/* QNativeInterface::QX11Application returns nullptr when platform is not X11 */
+static inline bool vlcQtIsX11()
+{
+    return qApp->nativeInterface<QNativeInterface::QX11Application>() != nullptr;
+}
+static inline Display *vlcQtX11Display()
+{
+    auto *x11App = qApp->nativeInterface<QNativeInterface::QX11Application>();
+    return x11App ? x11App->display() : nullptr;
+}
+#else
+#include <QX11Info>
+static inline bool vlcQtIsX11()
+{
+    return QX11Info::isPlatformX11();
+}
+static inline Display *vlcQtX11Display()
+{
+    return QX11Info::display();
+}
+#endif
+
+#endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/77ec12254b7122b54b137a3ad0604eddf3079dfb...71cd28c41d7aebbcf9b56302d98879f059a9fd13

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/77ec12254b7122b54b137a3ad0604eddf3079dfb...71cd28c41d7aebbcf9b56302d98879f059a9fd13
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list