#endif
#include <QApplication>
-#include <QLocale>
-#include <QTranslator>
#include <QDate>
-#include <QMutex>
-#include <QMutexLocker>
-#include <QWaitCondition>
#include "qt4.hpp"
#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
#include "../../../share/vlc32x32-christmas.xpm"
#include <vlc_plugin.h>
-#ifdef WIN32
+#ifdef WIN32 /* For static builds */
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
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 )
/* 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
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" );
return VLC_EGENERIC;
}
XCloseDisplay( p_display );
+ putenv( (char *)"XLIB_SKIP_ARGB_VISUALS=1" );
#endif
/* Allocations of p_sys */
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys = p_intf->p_sys;
- var_Destroy (p_this->p_libvlc, "qt4-iface");
+ if( !p_sys->b_isDialogProvider )
+ var_Destroy (p_this->p_libvlc, "qt4-iface");
+
QVLCApp::triggerQuit();
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 )
intf_thread_t *p_intf = (intf_thread_t *)obj;
MainInterface *p_mi;
char dummy[] = "vlc"; /* for WM_CLASS */
- char *argv[] = { dummy, NULL, };
+ char *argv[4] = { dummy, NULL, };
int argc = 1;
Q_INIT_RESOURCE( vlc );
/* 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
/* Icon setting */
if( QDate::currentDate().dayOfYear() >= 352 ) /* One Week before Xmas */
- app.setWindowIcon( QIcon( QPixmap(vlc_christmas_xpm) ) );
+ app.setWindowIcon( QIcon(vlc_christmas_xpm) );
else
- app.setWindowIcon( QIcon( QPixmap(vlc_xpm) ) );
+ app.setWindowIcon( QIcon(vlc_xpm) );
/* Initialize timers and the Dialog Provider */
DialogsProvider::getInstance( p_intf );
MainInputManager::killInstance();
-
/* Delete the application automatically */
#ifdef Q_WS_X11
- free( display );
+ free( x11_display );
#endif
return NULL;
}
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;
msg_Dbg( p_obj, "releasing video..." );
p_mi->releaseVideo();
}
+