[vlc-commits] [Git][videolan/vlc][master] 3 commits: skins2: avoid tiling window managers showing the invisible mainwindow
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Apr 23 16:05:49 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
8c9ad002 by Martin T. H. Sandsmark at 2026-04-23T15:52:57+00:00
skins2: avoid tiling window managers showing the invisible mainwindow
- - - - -
e269177f by Martin T. H. Sandsmark at 2026-04-23T15:52:57+00:00
skins2: quit on last window closed
- - - - -
959712af by Martin T. H. Sandsmark at 2026-04-23T15:52:57+00:00
skins2: fix crash on changing current playback item
- - - - -
10 changed files:
- modules/gui/skins2/src/generic_window.hpp
- modules/gui/skins2/src/top_window.cpp
- modules/gui/skins2/src/top_window.hpp
- modules/gui/skins2/src/vlcproc.cpp
- modules/gui/skins2/src/window_manager.cpp
- modules/gui/skins2/src/window_manager.hpp
- modules/gui/skins2/x11/x11_display.cpp
- modules/gui/skins2/x11/x11_display.hpp
- modules/gui/skins2/x11/x11_loop.cpp
- modules/gui/skins2/x11/x11_window.cpp
Changes:
=====================================
modules/gui/skins2/src/generic_window.hpp
=====================================
@@ -124,6 +124,9 @@ public:
/// Get the OS window
OSWindow *getOSWindow() const { return m_pOsWindow; }
+ /// Method called when the window is destroyed by the WM
+ virtual void onDestroyed() { m_pVarVisible->set(false); }
+
protected:
/// These methods do not need to be public since they are accessed
=====================================
modules/gui/skins2/src/top_window.cpp
=====================================
@@ -561,3 +561,9 @@ void TopWindow::setLastHit( CtrlGeneric *pNewHitControl )
m_pLastHitControl = pNewHitControl;
}
+void TopWindow::onDestroyed()
+{
+ GenericWindow::onDestroyed();
+
+ m_rWindowManager.onWindowHidden();
+}
=====================================
modules/gui/skins2/src/top_window.hpp
=====================================
@@ -86,6 +86,9 @@ public:
/// Get the initial visibility status
bool getInitialVisibility() const { return m_initialVisibility; }
+ /// When the window is killed by the window manager
+ virtual void onDestroyed();
+
protected:
/// Actually show the window
virtual void innerShow();
=====================================
modules/gui/skins2/src/vlcproc.cpp
=====================================
@@ -231,6 +231,9 @@ void on_player_titles_changed( vlc_player_t *player,
vlc_player_title_list *titles, void *data)
{
(void)player;
+ if (!titles) {
+ return;
+ }
bool isDvd = vlc_player_title_list_GetCount( titles ) > 0;
vlc_value_t val = { .b_bool = isDvd };
VlcProc::onGenericCallback( "isDvd", val, data );
=====================================
modules/gui/skins2/src/window_manager.cpp
=====================================
@@ -635,3 +635,20 @@ void WindowManager::setActiveLayout( TopWindow &rWindow,
// Rebuild the dependencies
stopMove();
}
+
+void WindowManager::onWindowHidden()
+{
+ WinSet_t::const_iterator it;
+ for( it = m_allWindows.begin(); it != m_allWindows.end(); ++it )
+ {
+ if( (*it)->getType() != GenericWindow::TopWindow) {
+ continue;
+ }
+ if( (*it)->getVisibleVar().get() ) {
+ return;
+ }
+ }
+
+ // Last window closed
+ libvlc_Quit( vlc_object_instance(getIntf()) );
+}
=====================================
modules/gui/skins2/src/window_manager.hpp
=====================================
@@ -168,6 +168,9 @@ public:
bool isOpacityNeeded() const
{ return (m_opacityEnabled && (m_alpha != 255 || m_moveAlpha != 255 )); }
+ /// Once a window is hidden, check if there are any left
+ void onWindowHidden();
+
private:
/// Some useful typedefs for lazy people like me
typedef std::set<TopWindow*> WinSet_t;
=====================================
modules/gui/skins2/x11/x11_display.cpp
=====================================
@@ -267,14 +267,22 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
mask, ShapeSet );
XDestroyRegion( mask );
+ // test EWMH capabilities
+ testEWMH();
+
+ // Try to avoid tiling window managers treating us like a normal window
+ if( m_net_wm_window_type != None )
+ {
+ XChangeProperty( m_pDisplay, m_mainWindow, m_net_wm_window_type,
+ XA_ATOM, 32, PropModeReplace,
+ (unsigned char *)&m_net_wm_window_type_utility, 1 );
+ }
+
XMapWindow( m_pDisplay, m_mainWindow);
// Move it outside the screen to avoid seeing it in workspace selector
XMoveWindow( m_pDisplay, m_mainWindow, -10, -10 );
- // test EWMH capabilities
- testEWMH();
-
// Force _NET_WM_PID whatever the WM _NET_SUPPORTED says
m_net_wm_pid = XInternAtom( m_pDisplay, "_NET_WM_PID" , False );
}
@@ -331,6 +339,7 @@ void X11Display::testEWMH()
TEST_EWMH( m_net_wm_window_type, "_NET_WM_WINDOW_TYPE" )
TEST_EWMH( m_net_wm_window_type_normal, "_NET_WM_WINDOW_TYPE_NORMAL" )
+ TEST_EWMH( m_net_wm_window_type_utility, "_NET_WM_WINDOW_TYPE_UTILITY" )
TEST_EWMH( m_net_wm_state, "_NET_WM_STATE" )
TEST_EWMH( m_net_wm_state_fullscreen, "_NET_WM_STATE_FULLSCREEN" )
=====================================
modules/gui/skins2/x11/x11_display.hpp
=====================================
@@ -90,6 +90,7 @@ public:
Atom m_net_wm_window_type;
Atom m_net_wm_window_type_normal;
+ Atom m_net_wm_window_type_utility;
Atom m_net_wm_state;
Atom m_net_wm_state_above;
=====================================
modules/gui/skins2/x11/x11_loop.cpp
=====================================
@@ -390,8 +390,16 @@ void X11Loop::handleX11Event()
return;
}
pDnd->dndSelectionNotify( );
+ break;
}
+ case ReparentNotify:
+ case UnmapNotify:
+ case ConfigureNotify: // We don't care
+ break;
+ case DestroyNotify:
+ pWin->onDestroyed();
+ break;
}
}
=====================================
modules/gui/skins2/x11/x11_window.cpp
=====================================
@@ -116,7 +116,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
// Select events received by the window
long event_mask = ExposureMask|KeyPressMask|
PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
- LeaveWindowMask|FocusChangeMask;
+ LeaveWindowMask|FocusChangeMask|StructureNotifyMask;
XSelectInput( XDISPLAY, m_wnd, event_mask );
// Store a pointer on the generic window in a map
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/19b7d37db9cb744ab6500bd4743f5fd9e735c4d4...959712afa971fe2b3fe578bfd42ee32505d5c095
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/19b7d37db9cb744ab6500bd4743f5fd9e735c4d4...959712afa971fe2b3fe578bfd42ee32505d5c095
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list