From fe92b6b39bc007bffacc2fb57bee511b1626939e Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Sun, 28 Jun 2009 03:40:50 -0700
Subject: revert to relative iconbar alignment when too many windows are open

---
 ChangeLog             |  3 +++
 src/FbTk/Container.cc | 39 ++++++++++++++++-----------------------
 2 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8625d5a..f5afcdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
  (Format: Year/Month/Day)
 Changes for 1.1.2
+*09/06/28:
+   * Revert to relative iconbar alignment when too many windows are open (Mark)
+     FbTk/Container.cc
 *09/05/26:
    * Fixed unexpected window focus changes under "focus follows mouse" (Jim)
      FocusControl.cc/hh Window.cc fluxbox.cc Screen.cc
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc
index 3374266..6a8f2a3 100644
--- a/src/FbTk/Container.cc
+++ b/src/FbTk/Container.cc
@@ -410,31 +410,24 @@ void Container::repositionItems() {
 
 
 unsigned int Container::maxWidthPerClient() const {
-    switch (alignment()) {
-    case RIGHT:
-    case CENTER:
-    case LEFT:
-        return m_max_size_per_client;
-        break;
-    case RELATIVE:
-        if (size() == 0)
-            return width();
-        else {
-            unsigned int borderW = m_item_list.front()->borderWidth();
-            // there're count-1 borders to fit in with the windows
-            // -> 1 per window plus end
-            unsigned int w = width(), h = height();
-            translateSize(m_orientation, w, h);
-            if (w < (size()-1)*borderW)
-                return 1;
-            else
-                return (w - (size() - 1) * borderW) / size();
-        }
-        break;
+    unsigned int max_relative_size;
+    if (size() == 0)
+        max_relative_size = width();
+    else {
+        unsigned int borderW = m_item_list.front()->borderWidth();
+        // there're count-1 borders to fit in with the windows
+        // -> 1 per window plus end
+        unsigned int w = width(), h = height();
+        translateSize(m_orientation, w, h);
+        max_relative_size = w < (size()-1)*borderW ? 1 :
+                (w - (size() - 1) * borderW) / size();
     }
 
-    // this will never happen anyway
-    return 1;
+    if (alignment() == RELATIVE)
+        return max_relative_size;
+
+    return (m_max_size_per_client < max_relative_size ?
+            m_max_size_per_client : max_relative_size);
 }
 
 void Container::for_each(std::mem_fun_t<void, FbWindow> function) {
-- 
cgit v0.11.2