[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 20 15:38:44 UTC 2019


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

New commits:
commit 63872b70cb0cc48052f43ee8966ba7c37650f81a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 19 17:04:58 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 20 17:37:48 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/74445
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index d00013e8f4fb..7e46cf853bea 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1171,14 +1171,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);
+                }
             }
         }
     }
@@ -1202,7 +1211,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 d62fc9714ea4..22a29bb875dd 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6868,7 +6868,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


More information about the Libreoffice-commits mailing list