]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/top_window.cpp
Introduce setLayoutMargins for layout margins difference between Qt4.2 and Qt4.3
[vlc] / modules / gui / skins2 / src / top_window.cpp
index 84a4c419fba25b72a534522ebf6c87f9186c7850..f10b90cacc46e3d93772ced90585cd446c784328 100644 (file)
@@ -58,6 +58,10 @@ TopWindow::TopWindow( intf_thread_t *pIntf, int left, int top,
 {
     // Register as a moving window
     m_rWindowManager.registerWindow( *this );
+
+    // Create the "maximized" variable and register it in the manager
+    m_pVarMaximized = new VarBoolImpl( pIntf );
+    VarManager::instance( pIntf )->registerVar( VariablePtr( m_pVarMaximized ) );
 }
 
 
@@ -253,7 +257,7 @@ void TopWindow::processEvent( EvtKey &rEvtKey )
             val.i_int |= KEY_MODIFIER_SHIFT;
         }
 
-        var_Set( getIntf()->p_vlc, "key-pressed", val );
+        var_Set( getIntf()->p_libvlc, "key-pressed", val );
     }
 
     // Always store the modifier, which can be needed for scroll events
@@ -298,7 +302,7 @@ void TopWindow::processEvent( EvtScroll &rEvtScroll )
         // Add the modifiers
         val.i_int |= m_currModifier;
 
-        var_Set( getIntf()->p_vlc, "key-pressed", val );
+        var_Set( getIntf()->p_libvlc, "key-pressed", val );
     }
 }
 
@@ -323,9 +327,14 @@ void TopWindow::refresh( int left, int top, int width, int height )
 void TopWindow::setActiveLayout( GenericLayout *pLayout )
 {
     bool isVisible = getVisibleVar().get();
-    if( m_pActiveLayout && isVisible )
+    if( m_pActiveLayout )
     {
-        m_pActiveLayout->onHide();
+        if( isVisible )
+        {
+            m_pActiveLayout->onHide();
+        }
+        // The current layout becomes inactive
+        m_pActiveLayout->getActiveVar().set( false );
     }
 
     pLayout->setWindow( this );
@@ -338,6 +347,9 @@ void TopWindow::setActiveLayout( GenericLayout *pLayout )
     {
         pLayout->onShow();
     }
+
+    // The new layout is active
+    pLayout->getActiveVar().set( true );
 }
 
 
@@ -349,7 +361,6 @@ const GenericLayout& TopWindow::getActiveLayout() const
 
 void TopWindow::innerShow()
 {
-    printf("show %x\n", m_pActiveLayout);
     // First, refresh the layout and update the shape of the window
     if( m_pActiveLayout )
     {
@@ -369,7 +380,7 @@ void TopWindow::innerHide()
         m_pActiveLayout->onHide();
     }
     // Hide the window
-    GenericWindow::innerShow();
+    GenericWindow::innerHide();
 }
 
 
@@ -432,9 +443,18 @@ void TopWindow::onTooltipChange( const CtrlGeneric &rCtrl )
     // Check that the control is the active one
     if( m_pLastHitControl && m_pLastHitControl == &rCtrl )
     {
-        // Set the tooltip text variable
-        VarManager *pVarManager = VarManager::instance( getIntf() );
-        pVarManager->getTooltipText().set( rCtrl.getTooltipText() );
+        if( rCtrl.getTooltipText().size() )
+        {
+            // Set the tooltip text variable
+            VarManager *pVarManager = VarManager::instance( getIntf() );
+            pVarManager->getTooltipText().set( rCtrl.getTooltipText() );
+            m_rWindowManager.showTooltip();
+        }
+        else
+        {
+            // Nothing to display, so hide the tooltip
+            m_rWindowManager.hideTooltip();
+        }
     }
 }