* 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>
/// Exit the main loop
virtual void exit() = 0;
- /// Flush the event queue
- virtual void flush() {}
-
protected:
OSLoop( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
};
}
-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();
+ }
}
}
/// 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(); }
}
-void VarBoolImpl::set( bool value, bool doNotify )
+void VarBoolImpl::set( bool value )
{
if( value != m_value )
{
m_value = value;
- if( doNotify )
- {
- notify();
- }
+ notify();
}
}
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
// 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();
+ }
}
}
}
-void X11Loop::flush()
-{
- XFlush( XDISPLAY );
-}
-
-
void X11Loop::handleX11Event()
{
XEvent event;
// 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 )
{
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 !!" );
}
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;
}
}
* 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 Teulière <ipkiss@via.ecp.fr>
/// Exit the main loop
virtual void exit();
- /// Flush the event queue
- virtual void flush();
-
private:
/// X11 Display
X11Display &m_rDisplay;
// 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() );