[vlc-devel] Regarding VLC + Xfce Fullscreen

Jogy Antony simula67 at gmail.com
Fri Mar 1 15:28:57 CET 2013


On Thu, Feb 28, 2013 at 9:00 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le jeudi 28 février 2013 15:40:00, Jogy Antony a écrit :
>> QT stores the windowstate as a bitmap, maximized and fullscreen being
>> the important windowstates. VLC attempts to go fullscreen like this :
>>
>> setWindowState( windowState() | Qt::WindowFullScreen );
>>
>> This is unfortunate, since if the windowState was already maximized,
>> this will set it maxmized _and_ fullscreen.
>
> No. It will set fullscreen and leaves the other bits untouched. That seems
> correct

Clearly you can see that Qt folks disagree.

>From http://mailman.videolan.org/pipermail/vlc-devel/2012-May/088372.html
>But in any case, VLC does not touch the maximized bits.

Atleast for Linux this is not true.

$ git diff
diff --git a/modules/gui/qt4/main_interface.cpp
b/modules/gui/qt4/main_interface.cpp
index 2f2ca1a..9b00e45 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1413,6 +1413,8 @@ void MainInterface::toolBarConfUpdated()

 void MainInterface::setInterfaceFullScreen( bool fs )
 {
+    int maximized = windowState() & Qt::WindowMaximized;
+    fprintf(stderr, "Maxmized : %d\n", maximized);
     if( fs )
         setWindowState( windowState() | Qt::WindowFullScreen );
     else


$ ./vlc KDQXH8DizTc.mp4
VLC media player 2.1.0-git Rincewind (revision 1.3.0-git-5680-ge0de50a)
[0x114a368] main libvlc: Running vlc with the default interface. Use
'cvlc' to use vlc without interface.
[0x7ff840001308] xcb_xv vout display error: no available XVideo adaptor
Maxmized : 2
Maxmized : 2
Maxmized : 0
Maxmized : 0
Maxmized : 0
Maxmized : 0

I looked at the commit that introduced these lines:

$ git show 3f02af55
commit 3f02af55066ffad01869bce27761da117580d6a3
Author: Jean-Baptiste Kempf <jb at videolan.org>
Date:   Sun Jun 13 00:55:54 2010 +0200

    Qt: try to fix hangout on win32

    Signed-off-by: Laurent Aimar <fenrir at videolan.org>

diff --git a/modules/gui/qt4/main_interface.cpp
b/modules/gui/qt4/main_interface.cpp
index 1a86e34..ef0bce8 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1144,9 +1144,9 @@ void MainInterface::closeEvent( QCloseEvent *e )
 void MainInterface::setInterfaceFullScreen( bool fs )
 {
     if( fs )
-        showFullScreen();
+        setWindowState( windowState() | Qt::WindowFullScreen );
     else
-        showNormal();
+        setWindowState( windowState() & ~Qt::WindowFullScreen );
 }
 void MainInterface::toggleInterfaceFullScreen()
 {

I suspect that showFullScreen()/showNormal() was doing something
undesirable for win32.
Unfortunately I could not find any reference to "hangout" in forums/trac etc.

My question is, whether the problem was with showFullScreen only?
Will the following patch be good ? (works with Ubuntu 12.04)

diff --git a/modules/gui/qt4/main_interface.cpp
b/modules/gui/qt4/main_interface.cpp
index 2f2ca1a..3f7db0c 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -259,6 +259,7 @@ MainInterface::MainInterface( intf_thread_t
*_p_intf ) : QVLCMW( _p_intf )
     /* Switch to minimal view if needed, must be called after the show() */
     if( b_minimalView )
         toggleMinimalView( true );
+    stateBeforeFullScreen = windowState();
 }

 MainInterface::~MainInterface()
@@ -1413,10 +1414,14 @@ void MainInterface::toolBarConfUpdated()

 void MainInterface::setInterfaceFullScreen( bool fs )
 {
-    if( fs )
-        setWindowState( windowState() | Qt::WindowFullScreen );
-    else
-        setWindowState( windowState() & ~Qt::WindowFullScreen );
+    if( fs ) {
+      stateBeforeFullScreen = windowState();
+      setWindowState((windowState() & ~(Qt::WindowMinimized |
Qt::WindowMaximized)) | Qt::WindowFullScreen);
+    }
+    else {
+      showNormal();
+      setWindowState(stateBeforeFullScreen);
+    }
 }
 void MainInterface::toggleInterfaceFullScreen()
 {
diff --git a/modules/gui/qt4/main_interface.hpp
b/modules/gui/qt4/main_interface.hpp
index 4c5b1fd..c3e1b16 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -173,6 +173,7 @@ private:

     bool                 b_hasPausedWhenMinimized;
     bool                 b_statusbarVisible;
+    Qt::WindowStates     stateBeforeFullScreen;  ///< The window
state before switching to fullscreen

 #ifdef WIN32
     HIMAGELIST himl;

Thanks
Joji Antony



More information about the vlc-devel mailing list