[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: do not signal `interfaceAlwaysOnTopChanged()` if there is no change in `MainCtx`

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Mar 11 06:18:16 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b359d5b8 by Fatih Uzunoglu at 2025-03-11T06:02:54+00:00
qt: do not signal `interfaceAlwaysOnTopChanged()` if there is no change in `MainCtx`

- - - - -
d1409377 by Fatih Uzunoglu at 2025-03-11T06:02:54+00:00
qt: fix always on top not working properly on windows

- - - - -


1 changed file:

- modules/gui/qt/maininterface/mainctx.cpp


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -712,6 +712,9 @@ void MainCtx::setGrouping(Grouping grouping)
 
 void MainCtx::setInterfaceAlwaysOnTop( bool on_top )
 {
+    if (b_interfaceOnTop == on_top)
+        return;
+
     b_interfaceOnTop = on_top;
     emit interfaceAlwaysOnTopChanged(on_top);
 }
@@ -1103,21 +1106,30 @@ bool WindowStateHolder::holdOnTop(QWindow *window, Source source, bool hold)
     else
         onTopCounter &= ~source;
 
-    Qt::WindowStates oldStates = window->windowStates();
-    Qt::WindowFlags oldflags = window->flags();
-    Qt::WindowFlags newflags;
+#ifdef _WIN32
+    if (!window->handle()) // do not call hold on top if there is no platform window
+        return false;
+#endif
 
     if( onTopCounter != 0 )
-        newflags = oldflags | Qt::WindowStaysOnTopHint;
+    {
+#ifdef _WIN32
+        // Qt::WindowStaysOnTopHint is broken on Windows: QTBUG-133034, QTBUG-132522.
+        // Reported to be fixed by Qt 6.9, but needs additional checking if the solution does not interfere with `CSDWin32EventHandler`.
+        SetWindowPos(reinterpret_cast<HWND>(window->winId()), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+#else
+        window->setFlag(Qt::WindowStaysOnTopHint, true);
+#endif
+    }
     else
-        newflags = oldflags & ~Qt::WindowStaysOnTopHint;
-    if( newflags != oldflags )
     {
-
-        window->setFlags( newflags );
-        window->setVisible(true); /* necessary to apply window flags */
-        //workaround: removing onTop state might drop fullscreen state
-        window->setWindowStates(oldStates);
+#ifdef _WIN32
+        // Qt::WindowStaysOnTopHint is broken on Windows: QTBUG-133034, QTBUG-132522.
+        // Reported to be fixed by Qt 6.9, but needs additional checking if the solution does not interfere with `CSDWin32EventHandler`.
+        SetWindowPos(reinterpret_cast<HWND>(window->winId()), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+#else
+        window->setFlag(Qt::WindowStaysOnTopHint, false);
+#endif
     }
 
     window->setProperty("__windowOnTop", QVariant::fromValue(onTopCounter));



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d01eace0064cf11965ead478c8fccda73b768e82...d1409377c3ec442dac183c5e6ca5aafc25491315

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d01eace0064cf11965ead478c8fccda73b768e82...d1409377c3ec442dac183c5e6ca5aafc25491315
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list