Commit 3cad60ce authored by Cyril Deguet's avatar Cyril Deguet

* src/window_manager.cpp: added a synchVisibility() method to show the

  visible windows (because they may have be hidden by the window manager)
  * all: removed the dirty hacks from the previous commit ;)
parent cc1f85bd
......@@ -2,7 +2,7 @@
* os_loop.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: os_loop.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -40,9 +40,6 @@ class OSLoop: public SkinObject
/// Exit the main loop
virtual void exit() = 0;
/// Flush the event queue
virtual void flush() {}
protected:
OSLoop( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
};
......
......@@ -147,13 +147,16 @@ void WindowManager::move( TopWindow &rWindow, int left, int top ) const
}
void WindowManager::raiseAll() const
void WindowManager::synchVisibility() const
{
// Raise all the windows
WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{
(*it)->raise();
// Show the window if it has to be visible
if( (*it)->getVisibleVar().get() )
{
(*it)->innerShow();
}
}
}
......
......@@ -67,15 +67,15 @@ class WindowManager: public SkinObject
/// If a new anchoring is detected, the windows will move accordingly.
void move( TopWindow &rWindow, int left, int top ) const;
/// Raise all the windows
void raiseAll() const;
/// Show all the registered windows
void showAll() const;
/// Hide all the registered windows
void hideAll() const;
/// Synchronize the windows with their visibility variable
void synchVisibility() const;
/// Raise the given window
void raise( TopWindow &rWindow ) const { rWindow.raise(); }
......
......@@ -34,15 +34,12 @@ VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ):
}
void VarBoolImpl::set( bool value, bool doNotify )
void VarBoolImpl::set( bool value )
{
if( value != m_value )
{
m_value = value;
if( doNotify )
{
notify();
}
notify();
}
}
......
......@@ -60,7 +60,7 @@ class VarBoolImpl: public VarBool
virtual bool get() const { return m_value; }
/// Set the internal value
virtual void set( bool value, bool doNotify = true );
virtual void set( bool value );
private:
/// Boolean value
......
......@@ -130,7 +130,10 @@ void X11Loop::run()
// Wait for the next timer and execute it
// The sleep is interrupted if an X11 event is received
pTimerLoop->waitNextTimer();
if( !m_exit )
{
pTimerLoop->waitNextTimer();
}
}
}
......@@ -141,12 +144,6 @@ void X11Loop::exit()
}
void X11Loop::flush()
{
XFlush( XDISPLAY );
}
void X11Loop::handleX11Event()
{
XEvent event;
......@@ -155,16 +152,20 @@ void X11Loop::handleX11Event()
// Look for the next event in the queue
XNextEvent( XDISPLAY, &event );
// If the "parent" window is mapped, show all the windows
if( event.xany.window == m_rDisplay.getMainWindow()
&& event.type == MapNotify )
if( event.xany.window == m_rDisplay.getMainWindow() )
{
getIntf()->p_sys->p_theme->getWindowManager().showAll();
if( event.type == MapNotify )
{
// When the "parent" window is mapped, show all the visible
// windows, as it is not automatic, unfortunately
getIntf()->p_sys->p_theme->getWindowManager().synchVisibility();
}
return;
}
// Find the window to which the event is sent
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
GenericWindow *pWin = pFactory->m_windowMap[event.xany.window];
GenericWindow *pWin =
((X11Factory*)pOsFactory)->m_windowMap[event.xany.window];
if( !pWin )
{
......@@ -359,7 +360,8 @@ void X11Loop::handleX11Event()
string type = XGetAtomName( XDISPLAY, event.xclient.message_type );
// Find the DnD object for this window
X11DragDrop *pDnd = pFactory->m_dndMap[event.xany.window];
X11DragDrop *pDnd =
((X11Factory*)pOsFactory)->m_dndMap[event.xany.window];
if( !pDnd )
{
msg_Err( getIntf(), "No associated D&D object !!" );
......@@ -384,12 +386,6 @@ void X11Loop::handleX11Event()
}
break;
}
case UnmapNotify:
// Hack to update the visibility variable if the window
// is unmapped by the window manager
((VarBoolImpl&)pWin->getVisibleVar()).set( false, false );
break;
}
}
......
......@@ -2,7 +2,7 @@
* x11_loop.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_loop.hpp,v 1.2 2004/01/18 00:25:02 asmax Exp $
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -49,9 +49,6 @@ class X11Loop: public OSLoop
/// Exit the main loop
virtual void exit();
/// Flush the event queue
virtual void flush();
private:
/// X11 Display
X11Display &m_rDisplay;
......
......@@ -64,7 +64,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
// Select events received by the window
XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|
PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
LeaveWindowMask|FocusChangeMask|StructureNotifyMask );
LeaveWindowMask|FocusChangeMask );
// Store a pointer on the generic window in a map
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
......
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