[vlc-commits] qt: enable window provider only if when supported
Rémi Denis-Courmont
git at videolan.org
Tue Nov 29 22:47:23 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 29 23:45:58 2016 +0200| [11f58819d00c70e29b363bcca2d7fa746acd2825] | committer: Rémi Denis-Courmont
qt: enable window provider only if when supported
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11f58819d00c70e29b363bcca2d7fa746acd2825
---
modules/gui/qt/qt.cpp | 64 ++++++++++++++++++++++-----------------------------
1 file changed, 27 insertions(+), 37 deletions(-)
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 9a09824..3af00c0 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -387,15 +387,6 @@ static bool HasWayland( void )
}
#endif
-static void RegisterIntf( intf_thread_t *p_this )
-{
- playlist_t *pl = p_this->p_sys->p_playlist;
- var_Create (pl, "qt4-iface", VLC_VAR_ADDRESS);
- var_SetAddress (pl, "qt4-iface", p_this);
- var_Create (pl, "window", VLC_VAR_STRING);
- var_SetString (pl, "window", "qt,any");
-}
-
/* Open Interface */
static int Open( vlc_object_t *p_this, bool isDialogProvider )
{
@@ -460,11 +451,6 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
vlc_sem_destroy (&ready);
busy = active = true;
-#ifndef Q_OS_MAC
- if( !isDialogProvider )
- RegisterIntf( p_intf );
-#endif
-
return VLC_SUCCESS;
}
@@ -489,8 +475,6 @@ static void Close( vlc_object_t *p_this )
{
playlist_t *pl = THEPL;
- var_Destroy (pl, "window");
- var_Destroy (pl, "qt4-iface");
playlist_Deactivate (pl); /* release window provider if needed */
}
@@ -596,41 +580,44 @@ static void *ThreadPlatform( void *obj, char *platform_name )
{
p_mi = new MainInterface( p_intf );
p_sys->p_mi = p_mi;
- }
- /* Explain how to show a dialog :D */
- p_intf->pf_show_dialog = ShowDialog;
-
- /* Check window type from the Qt platform back-end */
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_INVALID;
+ /* Check window type from the Qt platform back-end */
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_INVALID;
#if HAS_QT5 || defined (Q_WS_QPA)
- QString platform = app.platformName();
- if( platform == qfu("xcb") )
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID;
- else if( platform == qfu("windows") )
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND;
- else if( platform == qfu("cocoa" ) )
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT;
- else
- msg_Err( p_intf, "unknown Qt platform: %s", qtu(platform) );
+ QString platform = app.platformName();
+ if( platform == qfu("xcb") )
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID;
+ else if( platform == qfu("windows") )
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND;
+ else if( platform == qfu("cocoa" ) )
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT;
+ else
+ msg_Err( p_intf, "unknown Qt platform: %s", qtu(platform) );
#elif defined (Q_WS_X11)
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID;
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID;
#elif defined (Q_WS_WIN) || defined (Q_WS_PM)
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND;
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND;
#elif defined (Q_WS_MAC)
- p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT;
+ p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT;
#endif
+ var_Create( THEPL, "qt4-iface", VLC_VAR_ADDRESS );
+ var_SetAddress( THEPL, "qt4-iface", p_intf );
+ var_Create( THEPL, "window", VLC_VAR_STRING );
+ if( p_sys->voutWindowType != VOUT_WINDOW_TYPE_INVALID )
+ var_SetString( THEPL, "window", "qt,any" );
+ }
+
+ /* Explain how to show a dialog :D */
+ p_intf->pf_show_dialog = ShowDialog;
+
/* Tell the main LibVLC thread we are ready */
vlc_sem_post (&ready);
#ifdef Q_OS_MAC
/* We took over main thread, register and start here */
if( !p_sys->b_isDialogProvider )
- {
- RegisterIntf( p_intf );
playlist_Play( THEPL );
- }
#endif
/* Last settings */
@@ -651,6 +638,9 @@ static void *ThreadPlatform( void *obj, char *platform_name )
msg_Dbg( p_intf, "QApp exec() finished" );
if (p_mi != NULL)
{
+ var_Destroy( THEPL, "window" );
+ var_Destroy( THEPL, "qt4-iface" );
+
QMutexLocker locker (&lock);
active = false;
More information about the vlc-commits
mailing list