sw/source/uibase/misc/redlndlg.cxx |   23 ++++++++++++++++++-----
 vcl/unx/gtk3/gtk3gtkinst.cxx       |    9 ++++++++-
 2 files changed, 26 insertions(+), 6 deletions(-)

New commits:
commit 87e2095eae2b4345363042584e11e45339a606fa
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jun 19 17:04:58 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jun 20 16:45:52 2019 +0200

    zero width column in manage changes
    
    https://github.com/exaile/exaile/issues/580
    
    the fixed_width request is not handled by the time the
    width is queried. Use the requested width if the
    width is still 0.
    
    assert when such columns value are stored, and
    ignore existing useless ones on read
    
    Change-Id: Ibce74ec6a232edcf36b929f71474418b3e742856
    Reviewed-on: https://gerrit.libreoffice.org/74367
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 0af520ef3b65..18636c8761d3 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1172,14 +1172,23 @@ void SwRedlineAcceptDlg::Initialize(OUString& 
rExtraString)
                     aEndPos.push_back(aStr.toInt32());
                 }
 
+                bool bUseless = false;
+
                 std::vector<int> aWidths;
                 for (int i = 1; i < nCount; ++i)
+                {
                     aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
+                    if (aWidths.back() <= 0)
+                        bUseless = true;
+                }
 
-                // turn column end points back to column widths, ignoring the 
small
-                // value used for the expander column
-                weld::TreeView& rTreeView = m_pTable->GetWidget();
-                rTreeView.set_column_fixed_widths(aWidths);
+                if (!bUseless)
+                {
+                    // turn column end points back to column widths, ignoring 
the small
+                    // value used for the expander column
+                    weld::TreeView& rTreeView = m_pTable->GetWidget();
+                    rTreeView.set_column_fixed_widths(aWidths);
+                }
             }
         }
     }
@@ -1203,7 +1212,11 @@ void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) 
const
     // expander column
     aWidths.push_back(rTreeView.get_checkbox_column_width());
     for (int i = 0; i < nTabCount - 1; ++i)
-        aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i));
+    {
+        int nWidth = rTreeView.get_column_width(i);
+        assert(nWidth > 0 && "suspicious to get a value like this");
+        aWidths.push_back(aWidths.back() + nWidth);
+    }
 
     for (auto a : aWidths)
     {
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 2ff0f1087a47..bc8f69c9d05d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6867,7 +6867,14 @@ public:
     {
         GtkTreeViewColumn* pColumn = 
GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, nColumn));
         assert(pColumn && "wrong count");
-        return gtk_tree_view_column_get_width(pColumn);
+        int nWidth = gtk_tree_view_column_get_width(pColumn);
+        // https://github.com/exaile/exaile/issues/580
+        // after setting fixed_width on a column and requesting width before
+        // gtk has a chance to do its layout of the column means that the width
+        // request hasn't come into effect
+        if (!nWidth)
+            nWidth = gtk_tree_view_column_get_fixed_width(pColumn);
+        return nWidth;
     }
 
     virtual OUString get_column_title(int nColumn) const override
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to