[vlc-commits] commit: skins2: some optimisation and cosmetics when moving/ resizing windows (Erwan Tulou )

git at videolan.org git at videolan.org
Mon Nov 22 16:36:16 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Nov 22 09:47:54 2010 +0100| [73150d7c3fb0380732aae88c0274a2b0fe486265] | committer: Erwan Tulou 

skins2: some optimisation and cosmetics when moving/resizing windows

On most WM, move and resize are noop as long as the window is not visible, and
these calls have to be reissued once the window becomes visible.
  - so avoid unnecessary calls when there are known to be noop.
  - remove a move in TopWindow that appears hackish
    (it hides a MoveResize and is actually needed for _all_ windows)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=73150d7c3fb0380732aae88c0274a2b0fe486265
---

 modules/gui/skins2/src/generic_window.cpp |   15 ++++++++++-----
 modules/gui/skins2/src/generic_window.hpp |    3 +++
 modules/gui/skins2/src/top_window.cpp     |    3 ---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/modules/gui/skins2/src/generic_window.cpp b/modules/gui/skins2/src/generic_window.cpp
index 1df75d1..7d07c76 100644
--- a/modules/gui/skins2/src/generic_window.cpp
+++ b/modules/gui/skins2/src/generic_window.cpp
@@ -92,27 +92,30 @@ void GenericWindow::move( int left, int top )
     m_left = left;
     m_top = top;
 
-    m_pOsWindow->moveResize( left, top, m_width, m_height );
+    if( m_pOsWindow && isVisible() )
+        m_pOsWindow->moveResize( left, top, m_width, m_height );
 }
 
 
 void GenericWindow::resize( int width, int height )
 {
     // don't try when value is 0 (may crash)
-    if( !width || ! height )
+    if( !width || !height )
         return;
 
     // Update the window size
     m_width = width;
     m_height = height;
 
-    m_pOsWindow->moveResize( m_left, m_top, width, height );
+    if( m_pOsWindow && isVisible() )
+        m_pOsWindow->moveResize( m_left, m_top, width, height );
 }
 
 
 void GenericWindow::raise() const
 {
-    m_pOsWindow->raise();
+    if( m_pOsWindow )
+        m_pOsWindow->raise();
 }
 
 
@@ -124,7 +127,8 @@ void GenericWindow::setOpacity( uint8_t value )
 
 void GenericWindow::toggleOnTop( bool onTop ) const
 {
-    m_pOsWindow->toggleOnTop( onTop );
+    if( m_pOsWindow )
+        m_pOsWindow->toggleOnTop( onTop );
 }
 
 
@@ -149,6 +153,7 @@ void GenericWindow::innerShow()
     if( m_pOsWindow )
     {
         m_pOsWindow->show();
+        m_pOsWindow->moveResize( m_left, m_top, m_width, m_height );
     }
 }
 
diff --git a/modules/gui/skins2/src/generic_window.hpp b/modules/gui/skins2/src/generic_window.hpp
index a094963..fb00d54 100644
--- a/modules/gui/skins2/src/generic_window.hpp
+++ b/modules/gui/skins2/src/generic_window.hpp
@@ -134,6 +134,9 @@ protected:
     /// Actually hide the window
     virtual void innerHide();
 
+    ///
+    bool isVisible() const { return m_pVarVisible->get(); }
+
 private:
     /// Window position and size
     int m_left, m_top, m_width, m_height;
diff --git a/modules/gui/skins2/src/top_window.cpp b/modules/gui/skins2/src/top_window.cpp
index 2eac30e..740405d 100644
--- a/modules/gui/skins2/src/top_window.cpp
+++ b/modules/gui/skins2/src/top_window.cpp
@@ -324,9 +324,6 @@ void TopWindow::innerShow()
 
     // Show the window
     GenericWindow::innerShow();
-
-    // place the top window on the screen (after show!)
-    move( getLeft(), getTop() );
 }
 
 



More information about the vlc-commits mailing list