]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/qt4.cpp
Remove useless header check
[vlc] / modules / gui / qt4 / qt4.cpp
index 87055924b8ca967ef76919d37ae0814424151d46..b804f507f87b7e8a9a08765fadf5158fa9dc2a99 100644 (file)
@@ -38,7 +38,7 @@
 #include "recents.hpp"          /* Recents Item destruction */
 #include "util/qvlcapp.hpp"     /* QVLCApplication definition */
 
-#ifdef HAVE_X11_XLIB_H
+#ifdef Q_WS_X11
  #include <X11/Xlib.h>
 #endif
 
@@ -243,11 +243,11 @@ vlc_module_begin ()
 
         set_callbacks( OpenDialogs, Close )
 
-#if defined(Q_WS_X11) || defined(WIN32)
+#if defined(Q_WS_X11) || defined(Q_WS_WIN)
     add_submodule ()
 #if defined(Q_WS_X11)
         set_capability( "vout window xid", 50 )
-#elif defined(WIN32)
+#elif defined(Q_WS_WIN)
         set_capability( "vout window hwnd", 50 )
 #endif
         set_callbacks( WindowOpen, WindowClose )
@@ -259,6 +259,9 @@ vlc_module_end ()
 
 /* Ugly, but the Qt4 interface assumes single instance anyway */
 static vlc_sem_t ready;
+#ifdef Q_WS_X11
+static char *x11_display = NULL;
+#endif
 
 /*****************************************************************************
  * Module callbacks
@@ -270,9 +273,8 @@ static int Open( vlc_object_t *p_this )
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
 #ifdef Q_WS_X11
-    char *psz_display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
-    Display *p_display = XOpenDisplay( psz_display );
-    free( psz_display );
+    x11_display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
+    Display *p_display = XOpenDisplay( x11_display );
     if( !p_display )
     {
         msg_Err( p_intf, "Could not connect to X server" );
@@ -338,6 +340,9 @@ static void Close( vlc_object_t *p_this )
     vlc_join (p_sys->thread, NULL);
     pl_Release (p_this);
     delete p_sys;
+#ifdef Q_WS_X11
+    free (x11_display);
+#endif
 }
 
 static void *Thread( void *obj )
@@ -352,11 +357,10 @@ static void *Thread( void *obj )
 
     /* Start the QApplication here */
 #ifdef Q_WS_X11
-    char *display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
-    if( display )
+    if( x11_display != NULL )
     {
         argv[argc++] = const_cast<char *>("-display");
-        argv[argc++] = display;
+        argv[argc++] = x11_display;
         argv[argc] = NULL;
     }
 #endif
@@ -473,7 +477,7 @@ static void *Thread( void *obj )
 
     /* Delete the application automatically */
 #ifdef Q_WS_X11
-    free( display );
+    free( x11_display );
 #endif
     return NULL;
 }
@@ -528,14 +532,17 @@ static int WindowOpen( vlc_object_t *p_obj )
     unsigned i_height = p_wnd->cfg->height;
 
 #if defined (Q_WS_X11)
-    p_wnd->handle.xid = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
-    if( !p_wnd->handle.xid )
+    p_wnd->xid = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
+    if( !p_wnd->xid )
         return VLC_EGENERIC;
+    p_wnd->x11_display = x11_display;
 
-#elif defined (WIN32)
-    p_wnd->handle.hwnd = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
-    if( !p_wnd->handle.hwnd )
+#elif defined (Q_WS_WIN)
+    p_wnd->hwnd = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
+    if( !p_wnd->hwnd )
         return VLC_EGENERIC;
+#else
+# error FIXME
 #endif
 
     p_wnd->control = WindowControl;