[vlc-commits] commit: Qt4: only reset main interface window flags if needed ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun May 30 16:09:23 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 30 17:04:32 2010 +0300| [99b7cf3c3f0d554bf3175082a32722e78bb0f4e8] | committer: Rémi Denis-Courmont 

Qt4: only reset main interface window flags if needed

Unfortunately, according to the Qt4 documentation, changing the window
flags hides the window (until show() is called). So I guess there is no
way to toggle the on-top mode without the ugly blinking effect. Then,
try to minimize its occurences.

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

 modules/gui/qt4/main_interface.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index d70e6f8..495667c 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1039,11 +1039,17 @@ void MainInterface::customEvent( QEvent *event )
     if ( event->type() == (int)SetVideoOnTopEvent_Type )
     {
         SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event;
+        Qt::WindowFlags oldflags = windowFlags(), newflags;
+
         if( p_event->OnTop() )
-            setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint );
+            newflags = oldflags | Qt::WindowStaysOnTopHint;
         else
-            setWindowFlags( windowFlags() & ~Qt::WindowStaysOnTopHint );
-        show(); /* necessary to apply window flags */
+            newflags = oldflags & ~Qt::WindowStaysOnTopHint;
+        if( newflags != oldflags )
+        {
+            setWindowFlags( newflags );
+            show(); /* necessary to apply window flags */
+        }
     }
 }
 



More information about the vlc-commits mailing list