[vlc-commits] [Git][videolan/vlc][master] qt: use `QWindow::setVisible()` instead of `QWindow::show()`
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Jan 5 13:59:11 UTC 2025
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
90471d6e by Fatih Uzunoglu at 2025-01-05T13:36:44+00:00
qt: use `QWindow::setVisible()` instead of `QWindow::show()`
`QWindow::show()` does not necessarily care about the state
of the window, but rather uses the default behavior for the
platform.
Since we adjust the window geometry and states before the
window is shown (which is the expected behavior, as otherwise
the window would get adjusted immediately after shown), using
`QWindow::show()` potentially overrides the window states
nullifying the behavior of the interface starting maximized.
- - - - -
8 changed files:
- modules/gui/qt/maininterface/compositor_dummy.cpp
- modules/gui/qt/maininterface/compositor_platform.cpp
- modules/gui/qt/maininterface/compositor_wayland.cpp
- modules/gui/qt/maininterface/compositor_win7.cpp
- modules/gui/qt/maininterface/compositor_x11.cpp
- modules/gui/qt/maininterface/compositor_x11_renderwindow.cpp
- modules/gui/qt/maininterface/interface_window_handler.cpp
- modules/gui/qt/maininterface/mainctx.cpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor_dummy.cpp
=====================================
@@ -60,7 +60,7 @@ bool CompositorDummy::makeMainInterface(MainCtx* mainCtx)
if (m_qmlWidget->status() != QQuickView::Ready)
return false;
- m_qmlWidget->show();
+ m_qmlWidget->setVisible(true);
return true;
}
=====================================
modules/gui/qt/maininterface/compositor_platform.cpp
=====================================
@@ -97,9 +97,9 @@ bool CompositorPlatform::makeMainInterface(MainCtx *mainCtx)
m_rootWindow->installEventFilter(this);
- m_rootWindow->show();
- m_videoWindow->show();
- m_quickWindow->show();
+ m_rootWindow->setVisible(true);
+ m_videoWindow->setVisible(true);
+ m_quickWindow->setVisible(true);
m_quickWindow->raise(); // Make sure quick window is above the video window.
=====================================
modules/gui/qt/maininterface/compositor_wayland.cpp
=====================================
@@ -140,7 +140,7 @@ bool CompositorWayland::makeMainInterface(MainCtx* mainCtx)
const bool ret = commonGUICreate(m_qmlView.get(), m_qmlView.get(), flags);
if (ret)
- m_qmlView->show();
+ m_qmlView->setVisible(true);
return ret;
}
=====================================
modules/gui/qt/maininterface/compositor_win7.cpp
=====================================
@@ -84,7 +84,7 @@ bool CompositorWin7::makeMainInterface(MainCtx* mainCtx)
m_stable->setAttribute( Qt::WA_ShowWithoutActivating );
m_stable->setVisible(true);
- m_videoWidget->show();
+ m_videoWidget->setVisible(true);
m_videoWindowHWND = (HWND)m_videoWidget->winId();
BOOL excluseFromPeek = TRUE;
@@ -106,7 +106,7 @@ bool CompositorWin7::makeMainInterface(MainCtx* mainCtx)
const bool ret = commonGUICreate(m_qmlView.get(), m_qmlView.get(), CompositorVideo::CAN_SHOW_PIP);
if (ret)
- m_qmlView->show();
+ m_qmlView->setVisible(true);
return ret;
}
@@ -178,7 +178,7 @@ bool CompositorWin7::eventFilter(QObject*, QEvent* ev)
m_videoWidget->hide();
else
{
- m_videoWidget->show();
+ m_videoWidget->setVisible(true);
m_videoWidget->setGeometry(m_qmlView->geometry());
resetVideoZOrder();
}
@@ -188,7 +188,7 @@ bool CompositorWin7::eventFilter(QObject*, QEvent* ev)
resetVideoZOrder();
break;
case QEvent::Show:
- m_videoWidget->show();
+ m_videoWidget->setVisible(true);
resetVideoZOrder();
break;
case QEvent::Hide:
=====================================
modules/gui/qt/maininterface/compositor_x11.cpp
=====================================
@@ -194,7 +194,7 @@ bool CompositorX11::makeMainInterface(MainCtx* mainCtx)
xcb_change_window_attributes(connection, m_videoWidget->winId(), mask, &values);
setTransparentForMouseEvent(connection, m_videoWidget->winId());
- m_videoWidget->show();
+ m_videoWidget->setVisible(true);
connect(m_mainCtx, &MainCtx::hasAcrylicSurfaceChanged, m_renderWindow.get(), &CompositorX11RenderWindow::setAcrylic);
@@ -209,7 +209,7 @@ bool CompositorX11::makeMainInterface(MainCtx* mainCtx)
if (!commonGUICreate(m_renderWindow.get(), m_qmlView.get(), flags))
return false;
- m_qmlView->show();
+ m_qmlView->setVisible(true);
if (m_mainCtx->hasAcrylicSurface())
m_renderWindow->m_hasAcrylic = true;
=====================================
modules/gui/qt/maininterface/compositor_x11_renderwindow.cpp
=====================================
@@ -352,7 +352,7 @@ CompositorX11RenderWindow::CompositorX11RenderWindow(qt_intf_t* p_intf, xcb_conn
setFlag(Qt::FramelessWindowHint);
winId();
- show();
+ setVisible(true);
m_wid = winId();
}
=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -148,7 +148,7 @@ void InterfaceWindowHandler::updateCSDWindowSettings()
{
m_window->hide(); // some window managers don't like to change frame window hint on visible window
m_window->setFlag(Qt::FramelessWindowHint, m_mainCtx->useClientSideDecoration());
- m_window->show();
+ m_window->setVisible(true);
}
bool InterfaceWindowHandler::eventFilter(QObject*, QEvent* event)
@@ -350,7 +350,7 @@ void InterfaceWindowHandler::setInterfaceHiden()
void InterfaceWindowHandler::setInterfaceShown()
{
- m_window->show();
+ m_window->setVisible(true);
}
void InterfaceWindowHandler::setInterfaceMinimized()
=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -1110,7 +1110,7 @@ bool WindowStateHolder::holdOnTop(QWindow *window, Source source, bool hold)
{
window->setFlags( newflags );
- window->show(); /* necessary to apply window flags */
+ window->setVisible(true); /* necessary to apply window flags */
//workaround: removing onTop state might drop fullscreen state
window->setWindowStates(oldStates);
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90471d6e69c25c68f8d8c22dd6397da156f04dc6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90471d6e69c25c68f8d8c22dd6397da156f04dc6
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