Qt4 - Hide/Show from taskBar for Windows.
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 11 Aug 2007 12:10:38 +0000 (12:10 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 11 Aug 2007 12:10:38 +0000 (12:10 +0000)
Patch from Hannes Domani.

modules/gui/qt4/main_interface.cpp

index d3b8bd7..da58c5e 100644 (file)
@@ -463,10 +463,24 @@ void MainInterface::toggleUpdateSystrayMenu()
     if( isHidden() )
     {
         show();
+        activateWindow();
     }
     else
     {
+#ifdef WIN32
+        /* check if any visible window is above vlc in the z-order,
+         * but ignore the ones always on top */
+        WINDOWINFO wi;
+        HWND hwnd;
+        wi.cbSize = sizeof( WINDOWINFO );
+        for( hwnd = GetNextWindow( internalWinId(), GW_HWNDPREV );
+                hwnd && !IsWindowVisible( hwnd );
+                hwnd = GetNextWindow( hwnd, GW_HWNDPREV ) );
+        if( !hwnd || !GetWindowInfo( hwnd, &wi ) ||
+                (wi.dwExStyle&WS_EX_TOPMOST) )
+#else
         if( isActiveWindow() )
+#endif
         {
             hide();
         }