]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/x11/x11_loop.cpp
Copyright fixes
[vlc] / modules / gui / skins2 / x11 / x11_loop.cpp
index bee98f180bfcc4c44988c64e9f05468e284d73d8..f4b9888b1aa81e924edda5d3a43a831df47cd287 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * x11_loop.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 VideoLAN (Centrale Réseaux) and its contributors
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
@@ -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,24 @@ 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
+            Theme *pTheme = getIntf()->p_sys->p_theme;
+            if( pTheme )
+            {
+                pTheme->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 +364,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 +390,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;
     }
 }