Commit 87917c6a authored by Olivier Teulière's avatar Olivier Teulière

* skins2/src/os_window.hpp: added some 'const' keywords

 * skins2/src/theme_loader.cpp: do not anchor windows _before_ restoring their
        previous configuration...
 * skins2/src/window_manager.cpp: fix for non-anchoring of invisible windows
parent 6c955787
...@@ -156,7 +156,7 @@ void GenericWindow::processEvent( EvtMouse &rEvtMouse ) ...@@ -156,7 +156,7 @@ void GenericWindow::processEvent( EvtMouse &rEvtMouse )
if( rEvtMouse.getAction() == EvtMouse::kDown ) if( rEvtMouse.getAction() == EvtMouse::kDown )
{ {
// Raise all the windows // Raise all the windows
m_rWindowManager.raise( this ); m_rWindowManager.raiseAll( this );
if( pNewHitControl && pNewHitControl->isFocusable() ) if( pNewHitControl && pNewHitControl->isFocusable() )
{ {
...@@ -335,7 +335,7 @@ void GenericWindow::resize( int width, int height ) ...@@ -335,7 +335,7 @@ void GenericWindow::resize( int width, int height )
} }
void GenericWindow::raise() void GenericWindow::raise() const
{ {
m_pOsWindow->raise(); m_pOsWindow->raise();
} }
...@@ -347,7 +347,7 @@ void GenericWindow::setOpacity( uint8_t value ) ...@@ -347,7 +347,7 @@ void GenericWindow::setOpacity( uint8_t value )
} }
void GenericWindow::toggleOnTop( bool onTop ) void GenericWindow::toggleOnTop( bool onTop ) const
{ {
m_pOsWindow->toggleOnTop( onTop ); m_pOsWindow->toggleOnTop( onTop );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* generic_window.hpp * generic_window.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: generic_window.hpp,v 1.2 2004/01/18 19:54:46 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -86,13 +86,13 @@ class GenericWindow: public SkinObject, public Observer<VarBool> ...@@ -86,13 +86,13 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
virtual void resize( int width, int height ); virtual void resize( int width, int height );
/// Bring the window on top /// Bring the window on top
virtual void raise(); virtual void raise() const;
/// Set the opacity of the window (0 = transparent, 255 = opaque) /// Set the opacity of the window (0 = transparent, 255 = opaque)
virtual void setOpacity( uint8_t value ); virtual void setOpacity( uint8_t value );
/// Toggle the window on top /// Toggle the window on top
virtual void toggleOnTop( bool onTop ); virtual void toggleOnTop( bool onTop ) const;
/// Change the active layout /// Change the active layout
virtual void setActiveLayout( GenericLayout *pLayout ); virtual void setActiveLayout( GenericLayout *pLayout );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* os_window.hpp * os_window.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: os_window.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -38,22 +38,23 @@ class OSWindow: public SkinObject ...@@ -38,22 +38,23 @@ class OSWindow: public SkinObject
virtual ~OSWindow() {} virtual ~OSWindow() {}
// Show the window // Show the window
virtual void show( int left, int top ) = 0; virtual void show( int left, int top ) const = 0;
// Hide the window // Hide the window
virtual void hide() = 0; virtual void hide() const = 0;
/// Move and resize the window /// Move and resize the window
virtual void moveResize( int left, int top, int width, int height ) = 0; virtual void moveResize( int left, int top,
int width, int height ) const = 0;
/// Bring the window on top /// Bring the window on top
virtual void raise() = 0; virtual void raise() const = 0;
/// Set the opacity of the window (0 = transparent, 255 = opaque) /// Set the opacity of the window (0 = transparent, 255 = opaque)
virtual void setOpacity( uint8_t value ) = 0; virtual void setOpacity( uint8_t value ) = 0;
/// Toggle the window on top /// Toggle the window on top
virtual void toggleOnTop( bool onTop ) = 0; virtual void toggleOnTop( bool onTop ) const = 0;
protected: protected:
OSWindow( intf_thread_t *pIntf ): SkinObject( pIntf ) {} OSWindow( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme_loader.cpp * theme_loader.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: theme_loader.cpp,v 1.9 2004/02/08 11:23:17 gbazin Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -76,10 +76,10 @@ bool ThemeLoader::load( const string &fileName ) ...@@ -76,10 +76,10 @@ bool ThemeLoader::load( const string &fileName )
char *skin_last = config_GetPsz( getIntf(), "skins2-last" ); char *skin_last = config_GetPsz( getIntf(), "skins2-last" );
if( skin_last != NULL && fileName == (string)skin_last ) if( skin_last != NULL && fileName == (string)skin_last )
{ {
// Used to anchor the windows at the beginning
pNewTheme->getWindowManager().stopMove();
// Restore the theme configuration // Restore the theme configuration
getIntf()->p_sys->p_theme->loadConfig(); getIntf()->p_sys->p_theme->loadConfig();
// Used to anchor the windows at the beginning
pNewTheme->getWindowManager().stopMove();
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window_manager.cpp * window_manager.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window_manager.cpp,v 1.4 2004/01/25 11:44:19 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -137,7 +137,7 @@ void WindowManager::move( GenericWindow *pWindow, int left, int top ) const ...@@ -137,7 +137,7 @@ void WindowManager::move( GenericWindow *pWindow, int left, int top ) const
} }
void WindowManager::raise( GenericWindow *pWindow ) void WindowManager::raiseAll( GenericWindow *pWindow ) const
{ {
// Raise all the windows // Raise all the windows
WinSet_t::const_iterator it; WinSet_t::const_iterator it;
...@@ -148,6 +148,7 @@ void WindowManager::raise( GenericWindow *pWindow ) ...@@ -148,6 +148,7 @@ void WindowManager::raise( GenericWindow *pWindow )
(*it)->raise(); (*it)->raise();
} }
} }
// Make sure to raise the given window at the end, so that it is above
pWindow->raise(); pWindow->raise();
} }
...@@ -196,11 +197,8 @@ void WindowManager::buildDependSet( WinSet_t &rWinSet, ...@@ -196,11 +197,8 @@ void WindowManager::buildDependSet( WinSet_t &rWinSet,
WinSet_t::const_iterator iter; WinSet_t::const_iterator iter;
for( iter = anchored.begin(); iter != anchored.end(); iter++ ) for( iter = anchored.begin(); iter != anchored.end(); iter++ )
{ {
// Check that the window is visible
bool visible = (*iter)->getVisibleVar().get();
// Check that the window isn't already in the set before adding it // Check that the window isn't already in the set before adding it
if( visible && rWinSet.find( *iter ) == rWinSet.end() ) if( rWinSet.find( *iter ) == rWinSet.end() )
{ {
buildDependSet( rWinSet, *iter ); buildDependSet( rWinSet, *iter );
} }
...@@ -250,6 +248,12 @@ void WindowManager::checkAnchors( GenericWindow *pWindow, ...@@ -250,6 +248,12 @@ void WindowManager::checkAnchors( GenericWindow *pWindow,
for( itMov = m_movingWindows.begin(); for( itMov = m_movingWindows.begin();
itMov != m_movingWindows.end(); itMov++ ) itMov != m_movingWindows.end(); itMov++ )
{ {
// Skip the invisible windows
if( ! (*itMov)->getVisibleVar().get() )
{
continue;
}
// Get the anchors of this moving window // Get the anchors of this moving window
const AncList_t &movAnchors = (*itMov)->getAnchorList(); const AncList_t &movAnchors = (*itMov)->getAnchorList();
...@@ -257,8 +261,9 @@ void WindowManager::checkAnchors( GenericWindow *pWindow, ...@@ -257,8 +261,9 @@ void WindowManager::checkAnchors( GenericWindow *pWindow,
for( itSta = m_allWindows.begin(); for( itSta = m_allWindows.begin();
itSta != m_allWindows.end(); itSta++ ) itSta != m_allWindows.end(); itSta++ )
{ {
// Skip the moving windows // Skip the moving windows and the invisible ones
if( m_movingWindows.find( (*itSta) ) != m_movingWindows.end() ) if( m_movingWindows.find( (*itSta) ) != m_movingWindows.end() ||
! (*itSta)->getVisibleVar().get() )
{ {
continue; continue;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window_manager.hpp * window_manager.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window_manager.hpp,v 1.1 2004/01/03 23:31:34 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -62,8 +62,8 @@ class WindowManager: public SkinObject ...@@ -62,8 +62,8 @@ class WindowManager: public SkinObject
/// If a new anchoring is detected, the windows will move accordingly. /// If a new anchoring is detected, the windows will move accordingly.
void move( GenericWindow *pWindow, int left, int top ) const; void move( GenericWindow *pWindow, int left, int top ) const;
/// Raise a window and its anchored windows /// Raise all the windows, pWindow being above the others
void raise( GenericWindow *pWindow ); void raiseAll( GenericWindow *pWindow ) const;
/// Show all the registered windows /// Show all the registered windows
void showAll() const; void showAll() const;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_window.cpp * win32_window.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: win32_window.cpp,v 1.1 2004/01/03 23:31:34 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -91,25 +91,25 @@ Win32Window::~Win32Window() ...@@ -91,25 +91,25 @@ Win32Window::~Win32Window()
} }
void Win32Window::show( int left, int top ) void Win32Window::show( int left, int top ) const
{ {
ShowWindow( m_hWnd, SW_SHOW ); ShowWindow( m_hWnd, SW_SHOW );
} }
void Win32Window::hide() void Win32Window::hide() const
{ {
ShowWindow( m_hWnd, SW_HIDE ); ShowWindow( m_hWnd, SW_HIDE );
} }
void Win32Window::moveResize( int left, int top, int width, int height ) void Win32Window::moveResize( int left, int top, int width, int height ) const
{ {
MoveWindow( m_hWnd, left, top, width, height, true ); MoveWindow( m_hWnd, left, top, width, height, true );
} }
void Win32Window::raise() void Win32Window::raise() const
{ {
SetWindowPos( m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); SetWindowPos( m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
} }
...@@ -164,7 +164,7 @@ void Win32Window::setOpacity( uint8_t value ) ...@@ -164,7 +164,7 @@ void Win32Window::setOpacity( uint8_t value )
} }
void Win32Window::toggleOnTop( bool onTop ) void Win32Window::toggleOnTop( bool onTop ) const
{ {
if( onTop ) if( onTop )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_window.hpp * win32_window.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: win32_window.hpp,v 1.1 2004/01/03 23:31:34 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -40,22 +40,23 @@ class Win32Window: public OSWindow ...@@ -40,22 +40,23 @@ class Win32Window: public OSWindow
virtual ~Win32Window(); virtual ~Win32Window();
// Show the window // Show the window
virtual void show( int left, int top ); virtual void show( int left, int top ) const;
// Hide the window // Hide the window
virtual void hide(); virtual void hide() const;
/// Move and resize the window /// Move and resize the window
virtual void moveResize( int left, int top, int width, int height ); virtual void moveResize( int left, int top,
int width, int height ) const;
/// Bring the window on top /// Bring the window on top
virtual void raise(); virtual void raise() const;
/// Set the opacity of the window (0 = transparent, 255 = opaque) /// Set the opacity of the window (0 = transparent, 255 = opaque)
virtual void setOpacity( uint8_t value ); virtual void setOpacity( uint8_t value );
/// Toggle the window on top /// Toggle the window on top
virtual void toggleOnTop( bool onTop ); virtual void toggleOnTop( bool onTop ) const;
/// Getter for the window handle /// Getter for the window handle
HWND getHandle() const { return m_hWnd; } HWND getHandle() const { return m_hWnd; }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.cpp * x11_window.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.3 2004/01/25 18:41:08 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -112,7 +112,7 @@ X11Window::~X11Window() ...@@ -112,7 +112,7 @@ X11Window::~X11Window()
} }
void X11Window::show( int left, int top ) void X11Window::show( int left, int top ) const
{ {
// Map the window // Map the window
XMapRaised( XDISPLAY, m_wnd ); XMapRaised( XDISPLAY, m_wnd );
...@@ -120,20 +120,20 @@ void X11Window::show( int left, int top ) ...@@ -120,20 +120,20 @@ void X11Window::show( int left, int top )
} }
void X11Window::hide() void X11Window::hide() const
{ {
// Unmap the window // Unmap the window
XUnmapWindow( XDISPLAY, m_wnd ); XUnmapWindow( XDISPLAY, m_wnd );
} }
void X11Window::moveResize( int left, int top, int width, int height ) void X11Window::moveResize( int left, int top, int width, int height ) const
{ {
XMoveResizeWindow( XDISPLAY, m_wnd, left, top, width, height ); XMoveResizeWindow( XDISPLAY, m_wnd, left, top, width, height );
} }
void X11Window::raise() void X11Window::raise() const
{ {
XRaiseWindow( XDISPLAY, m_wnd ); XRaiseWindow( XDISPLAY, m_wnd );
} }
...@@ -145,9 +145,9 @@ void X11Window::setOpacity( uint8_t value ) ...@@ -145,9 +145,9 @@ void X11Window::setOpacity( uint8_t value )
} }
void X11Window::toggleOnTop( bool onTop ) void X11Window::toggleOnTop( bool onTop ) const
{ {
// XXX TODO // TODO
} }
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.hpp * x11_window.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_window.hpp,v 1.2 2004/01/18 00:25:02 asmax Exp $ * $Id$
* *
* Authors: Cyril Deguet <asmax@via.ecp.fr> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -43,22 +43,23 @@ class X11Window: public OSWindow ...@@ -43,22 +43,23 @@ class X11Window: public OSWindow
virtual ~X11Window(); virtual ~X11Window();
// Show the window // Show the window
virtual void show( int left, int top ); virtual void show( int left, int top ) const;
// Hide the window // Hide the window
virtual void hide(); virtual void hide() const;
/// Move the window /// Move the window
virtual void moveResize( int left, int top, int width, int height ); virtual void moveResize( int left, int top,
int width, int height ) const;
/// Bring the window on top /// Bring the window on top
virtual void raise(); virtual void raise() const;
/// Set the opacity of the window (0 = transparent, 255 = opaque) /// Set the opacity of the window (0 = transparent, 255 = opaque)
virtual void setOpacity( uint8_t value ); virtual void setOpacity( uint8_t value );
/// Toggle the window on top /// Toggle the window on top
virtual void toggleOnTop( bool onTop ); virtual void toggleOnTop( bool onTop ) const;
/// Get the window ID /// Get the window ID
Window getDrawable() const { return m_wnd; } Window getDrawable() const { return m_wnd; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment