[vlc-commits] skins2: improve layout management

Erwan Tulou git at videolan.org
Wed Apr 3 12:06:30 CEST 2013


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Apr  3 11:35:28 2013 +0200| [44febce3142be9c85967c94b8be418c627977665] | committer: Erwan Tulou

skins2: improve layout management

Be more stringent on what it means to be tightly-coupled for two layouts.

Note that directly resizing a playout should not be allowed. Only the skins2
windows manager should be authorized to do it, since other issues are at stake
(anchors, min/max constraints, ....). Yet, this new isTightlyCoupledWith() now
ensures that two layouts are truly identical from the windows manager's
perspective, and thus avoids possible and undesirable side effects.

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

 modules/gui/skins2/src/generic_layout.cpp |   10 ++++++++++
 modules/gui/skins2/src/generic_layout.hpp |   11 +++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/modules/gui/skins2/src/generic_layout.cpp b/modules/gui/skins2/src/generic_layout.cpp
index 779467b..a2e1cd6 100644
--- a/modules/gui/skins2/src/generic_layout.cpp
+++ b/modules/gui/skins2/src/generic_layout.cpp
@@ -267,3 +267,13 @@ void GenericLayout::onHide()
     m_visible = false;
 }
 
+
+bool GenericLayout::isTightlyCoupledWith( const GenericLayout& otherLayout ) const
+{
+    return m_original_width == otherLayout.m_original_width &&
+           m_original_height == otherLayout.m_original_height &&
+           m_minWidth == otherLayout.m_minWidth &&
+           m_maxWidth == otherLayout.m_maxWidth &&
+           m_minHeight == otherLayout.m_minHeight &&
+           m_maxHeight == otherLayout.m_maxHeight;
+}
diff --git a/modules/gui/skins2/src/generic_layout.hpp b/modules/gui/skins2/src/generic_layout.hpp
index 745dfae..d0b87ac 100644
--- a/modules/gui/skins2/src/generic_layout.hpp
+++ b/modules/gui/skins2/src/generic_layout.hpp
@@ -108,12 +108,7 @@ public:
     virtual void resize( int width, int height );
 
     /// determine whether layouts should be kept the same size
-    virtual bool isTightlyCoupledWith( const GenericLayout& otherLayout ) const
-    {
-        return m_original_width == otherLayout.m_original_width
-               &&
-               m_original_height == otherLayout.m_original_height;
-    }
+    virtual bool isTightlyCoupledWith( const GenericLayout& otherLayout ) const;
 
     // getter for layout visibility
     virtual bool isVisible( ) const { return m_visible; }
@@ -163,8 +158,8 @@ private:
     const int m_original_height;
     /// Layout size
     SkinsRect m_rect;
-    int m_minWidth, m_maxWidth;
-    int m_minHeight, m_maxHeight;
+    const int m_minWidth, m_maxWidth;
+    const int m_minHeight, m_maxHeight;
     /// Image of the layout
     OSGraphics *m_pImage;
     /// List of the controls in the layout



More information about the vlc-commits mailing list