]> git.sesse.net Git - vlc/commitdiff
Qt4: only reset main interface window flags if needed
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 30 May 2010 14:04:32 +0000 (17:04 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 30 May 2010 14:04:32 +0000 (17:04 +0300)
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.

modules/gui/qt4/main_interface.cpp

index d70e6f8f3d6a9c014cb7c09449b145a1adc2aa98..495667c695cbad4afdb7f702d5c2fb172a9d9459 100644 (file)
@@ -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 */
+        }
     }
 }