if( pOldTheme )
{
+ pOldTheme->getWindowManager().saveVisibility();
pOldTheme->getWindowManager().hideAll();
}
msg_Warn( getIntf(), "a problem occurred when loading the new theme,"
" restoring the previous one" );
getIntf()->p_sys->p_theme = pOldTheme;
- pOldTheme->getWindowManager().showAll();
+ pOldTheme->getWindowManager().restoreVisibility();
}
else
{
}
+void WindowManager::saveVisibility()
+{
+ WinSet_t::const_iterator it;
+ m_savedWindows.clear();
+ for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
+ {
+ // Remember the window if it is visible
+ if( (*it)->getVisibleVar().get() )
+ {
+ m_savedWindows.insert( *it );
+ }
+ }
+}
+
+
+void WindowManager::restoreVisibility() const
+{
+ // Warning in case we never called saveVisibility()
+ if( m_savedWindows.size() == 0 )
+ {
+ msg_Warn( getIntf(), "restoring visibility for no window" );
+ }
+
+ WinSet_t::const_iterator it;
+ for( it = m_savedWindows.begin(); it != m_savedWindows.end(); it++)
+ {
+ (*it)->show();
+ }
+}
+
+
void WindowManager::raiseAll() const
{
// Raise all the windows
/// Destructor
virtual ~WindowManager();
- /// Add a window to the list of known windows. Necessary if you want
- /// your window to be movable...
+ /**
+ * Add a window to the list of known windows. Necessary if you want
+ * your window to be movable...
+ */
void registerWindow( TopWindow &rWindow );
/// Remove a previously registered window
/// Synchronize the windows with their visibility variable
void synchVisibility() const;
+ /// Save the current visibility of the windows
+ void saveVisibility();
+
+ /// Restore the saved visibility of the windows
+ void restoreVisibility() const;
+
/// Raise the given window
void raise( TopWindow &rWindow ) const { rWindow.raise(); }
map<TopWindow*, WinSet_t> m_dependencies;
/// Store all the windows
WinSet_t m_allWindows;
- /// Store the moving windows; this set is updated at every start of
- /// move.
+ /**
+ * Store the windows that were visible when saveVisibility() was
+ * last called.
+ */
+ WinSet_t m_savedWindows;
+ /// Store the moving windows
+ /**
+ * This set is updated at every start of move.
+ */
WinSet_t m_movingWindows;
/**
* Store the moving windows in the context of resizing