Merge branch 'martin/skins2' into 'master'

minor skins2 fixes

See merge request videolan/vlc!1432
This commit is contained in:
martin 2024-04-28 07:11:02 +00:00
commit 84725494d9
10 changed files with 57 additions and 4 deletions

View File

@ -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

View File

@ -561,3 +561,9 @@ void TopWindow::setLastHit( CtrlGeneric *pNewHitControl )
m_pLastHitControl = pNewHitControl;
}
void TopWindow::onDestroyed()
{
GenericWindow::onDestroyed();
m_rWindowManager.onWindowHidden();
}

View File

@ -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();

View File

@ -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 );

View File

@ -632,3 +632,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()) );
}

View File

@ -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;

View File

@ -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" )

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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