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 @@ ...@@ -2,7 +2,7 @@
* os_loop.hpp * os_loop.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -40,9 +40,6 @@ class OSLoop: public SkinObject ...@@ -40,9 +40,6 @@ class OSLoop: public SkinObject
/// Exit the main loop /// Exit the main loop
virtual void exit() = 0; virtual void exit() = 0;
/// Flush the event queue
virtual void flush() {}
protected: protected:
OSLoop( intf_thread_t *pIntf ): SkinObject( pIntf ) {} OSLoop( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
}; };
......
...@@ -147,13 +147,16 @@ void WindowManager::move( TopWindow &rWindow, int left, int top ) const ...@@ -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; WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); 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 ...@@ -67,15 +67,15 @@ 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( TopWindow &rWindow, int left, int top ) const; void move( TopWindow &rWindow, int left, int top ) const;
/// Raise all the windows
void raiseAll() const;
/// Show all the registered windows /// Show all the registered windows
void showAll() const; void showAll() const;
/// Hide all the registered windows /// Hide all the registered windows
void hideAll() const; void hideAll() const;
/// Synchronize the windows with their visibility variable
void synchVisibility() const;
/// Raise the given window /// Raise the given window
void raise( TopWindow &rWindow ) const { rWindow.raise(); } void raise( TopWindow &rWindow ) const { rWindow.raise(); }
......
...@@ -34,16 +34,13 @@ VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ): ...@@ -34,16 +34,13 @@ VarBoolImpl::VarBoolImpl( intf_thread_t *pIntf ):
} }
void VarBoolImpl::set( bool value, bool doNotify ) void VarBoolImpl::set( bool value )
{ {
if( value != m_value ) if( value != m_value )
{ {
m_value = value; m_value = value;
if( doNotify )
{
notify(); notify();
} }
}
} }
......
...@@ -60,7 +60,7 @@ class VarBoolImpl: public VarBool ...@@ -60,7 +60,7 @@ class VarBoolImpl: public VarBool
virtual bool get() const { return m_value; } virtual bool get() const { return m_value; }
/// Set the internal value /// Set the internal value
virtual void set( bool value, bool doNotify = true ); virtual void set( bool value );
private: private:
/// Boolean value /// Boolean value
......
...@@ -130,8 +130,11 @@ void X11Loop::run() ...@@ -130,8 +130,11 @@ void X11Loop::run()
// Wait for the next timer and execute it // Wait for the next timer and execute it
// The sleep is interrupted if an X11 event is received // The sleep is interrupted if an X11 event is received
if( !m_exit )
{
pTimerLoop->waitNextTimer(); pTimerLoop->waitNextTimer();
} }
}
} }
...@@ -141,12 +144,6 @@ void X11Loop::exit() ...@@ -141,12 +144,6 @@ void X11Loop::exit()
} }
void X11Loop::flush()
{
XFlush( XDISPLAY );
}
void X11Loop::handleX11Event() void X11Loop::handleX11Event()
{ {
XEvent event; XEvent event;
...@@ -155,16 +152,20 @@ void X11Loop::handleX11Event() ...@@ -155,16 +152,20 @@ void X11Loop::handleX11Event()
// Look for the next event in the queue // Look for the next event in the queue
XNextEvent( XDISPLAY, &event ); XNextEvent( XDISPLAY, &event );
// If the "parent" window is mapped, show all the windows if( event.xany.window == m_rDisplay.getMainWindow() )
if( event.xany.window == m_rDisplay.getMainWindow()
&& event.type == MapNotify )
{ {
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 // Find the window to which the event is sent
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() ); GenericWindow *pWin =
GenericWindow *pWin = pFactory->m_windowMap[event.xany.window]; ((X11Factory*)pOsFactory)->m_windowMap[event.xany.window];
if( !pWin ) if( !pWin )
{ {
...@@ -359,7 +360,8 @@ void X11Loop::handleX11Event() ...@@ -359,7 +360,8 @@ void X11Loop::handleX11Event()
string type = XGetAtomName( XDISPLAY, event.xclient.message_type ); string type = XGetAtomName( XDISPLAY, event.xclient.message_type );
// Find the DnD object for this window // 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 ) if( !pDnd )
{ {
msg_Err( getIntf(), "No associated D&D object !!" ); msg_Err( getIntf(), "No associated D&D object !!" );
...@@ -384,12 +386,6 @@ void X11Loop::handleX11Event() ...@@ -384,12 +386,6 @@ void X11Loop::handleX11Event()
} }
break; 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 @@ ...@@ -2,7 +2,7 @@
* x11_loop.hpp * x11_loop.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -49,9 +49,6 @@ class X11Loop: public OSLoop ...@@ -49,9 +49,6 @@ class X11Loop: public OSLoop
/// Exit the main loop /// Exit the main loop
virtual void exit(); virtual void exit();
/// Flush the event queue
virtual void flush();
private: private:
/// X11 Display /// X11 Display
X11Display &m_rDisplay; X11Display &m_rDisplay;
......
...@@ -64,7 +64,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -64,7 +64,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
// Select events received by the window // Select events received by the window
XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask| XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|
PointerMotionMask|ButtonPressMask|ButtonReleaseMask| PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
LeaveWindowMask|FocusChangeMask|StructureNotifyMask ); LeaveWindowMask|FocusChangeMask );
// Store a pointer on the generic window in a map // Store a pointer on the generic window in a map
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() ); 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