]> git.sesse.net Git - vlc/commitdiff
* src/window_manager.cpp: added a synchVisibility() method to show the
authorCyril Deguet <asmax@videolan.org>
Sat, 3 Apr 2004 23:21:47 +0000 (23:21 +0000)
committerCyril Deguet <asmax@videolan.org>
Sat, 3 Apr 2004 23:21:47 +0000 (23:21 +0000)
  visible windows (because they may have be hidden by the window manager)
  * all: removed the dirty hacks from the previous commit ;)

modules/gui/skins2/src/os_loop.hpp
modules/gui/skins2/src/window_manager.cpp
modules/gui/skins2/src/window_manager.hpp
modules/gui/skins2/utils/var_bool.cpp
modules/gui/skins2/utils/var_bool.hpp
modules/gui/skins2/x11/x11_loop.cpp
modules/gui/skins2/x11/x11_loop.hpp
modules/gui/skins2/x11/x11_window.cpp

index be1dc8f5aadea85af3b5b82039b3fc6bf68b9b32..bf3d9c5c3fa77cd2e37a627556630cc809a2d23a 100644 (file)
@@ -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 ) {}
 };
index d6b2192f5d26adb26daf8194882999da26a2a6ce..87014e7cb4afc1ef8199873b54638546d31dc9bb 100755 (executable)
@@ -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();
+        }
     }
 }
 
index 14abdaae2893d6af77b08fcd05b0aeeceb263c1c..ca5c8c591949afe527795e2aa0924f8f7a92d7ea 100644 (file)
@@ -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(); }
 
index 74397ea417de12847a04310b63b8245a4266b77e..d46fb9286415b2b4287c880c14484bb19872a170 100755 (executable)
@@ -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();
     }
 }
 
index 43e840801c26975b519b4c21c2a96e2c3087539e..a8ef6eb418915130abcdde827dddd21a187cf71b 100755 (executable)
@@ -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
index bee98f180bfcc4c44988c64e9f05468e284d73d8..1d97c12bb25b6d469019a9e18c10396d0d2ff36a 100644 (file)
@@ -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;
     }
 }
 
index d6b2301d51f8d1fbd776ba799cd58cae63a9dcbd..328a42bb60e23449e2b4d5efe28e8d5f843930da 100644 (file)
@@ -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 Teulière <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;
index 9766385bd0f6ef3b515d3774e3570bc5c0f4d7c4..a241108cfda56e1017397d87bd5347ad66d1d106 100644 (file)
@@ -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() );