[vlc-commits] Qt: force XCB platform so we do not crash if QT_QPA_PLATFORM is set

Rémi Denis-Courmont git at videolan.org
Wed Aug 20 23:01:59 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 21 00:01:40 2014 +0300| [9a76128f6c86db806ba54f39007db826a7f9e533] | committer: Rémi Denis-Courmont

Qt: force XCB platform so we do not crash if QT_QPA_PLATFORM is set

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9a76128f6c86db806ba54f39007db826a7f9e533
---

 modules/gui/qt4/qt4.cpp |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 2beda6f..fa77a4a 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -42,7 +42,7 @@
 #include "util/qvlcapp.hpp"     /* QVLCApplication definition */
 #include "components/playlist/playlist_model.hpp" /* for ~PLModel() */
 
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
+#if defined (QT5_HAS_X11) || defined (Q_WS_X11)
  #include <vlc_xlib.h>
 #endif
 
@@ -317,7 +317,7 @@ vlc_module_begin ()
     add_submodule ()
         set_capability( "vout window nsobject", 0 )
         set_callbacks( WindowOpen, WindowClose )
-#elif defined (Q_OS_UNIX)
+#elif defined (QT5_HAS_X11) || defined (Q_WS_X11)
     add_submodule ()
         set_capability( "vout window xid", 0 )
         set_callbacks( WindowOpen, WindowClose )
@@ -360,7 +360,7 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
+#if defined (QT5_HAS_X11) || defined (Q_WS_X11)
     if( !vlc_xlib_init( p_this ) )
         return VLC_EGENERIC;
 
@@ -466,8 +466,18 @@ static void *Thread( void *obj )
 {
     intf_thread_t *p_intf = (intf_thread_t *)obj;
     MainInterface *p_mi;
-    char dummy[] = "vlc"; /* for WM_CLASS */
-    char *argv[] = { dummy, NULL, };
+    char vlc_name[] = "vlc"; /* for WM_CLASS */
+#ifdef QT5_HAS_X11
+    char platform_parm[] = "-platform";
+    char platform_value[] = "xcb";
+#endif
+    char *argv[] = {
+        vlc_name,
+#ifdef QT5_HAS_X11
+        platform_parm, platform_value,
+#endif
+        NULL,
+    };
     int argc = sizeof(argv) / sizeof(argv[0]) - 1;
 
     Q_INIT_RESOURCE( vlc );
@@ -529,7 +539,7 @@ static void *Thread( void *obj )
 
     /* Check window type from the Qt platform back-end */
     p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_INVALID;
-#if defined (Q_WS_QPA) || HAS_QT5
+#if HAS_QT5 || defined (Q_WS_QPA)
     QString platform = app.platformName();
     if( platform == qfu("xcb") )
         p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID;



More information about the vlc-commits mailing list