[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Thu May 24 10:52:59 UTC 2018


 vcl/unx/gtk3/gtk3gtkinst.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit aed4d485df525ef934e0a6bbf6eededb976a9299
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 24 10:35:55 2018 +0100

    Resolves: tdf#117737 combobox menu misplaced if wrap-width set
    
    so use ellipsize instead and set the height to one single line
    
    Change-Id: Icb124669410c041880ce468f3cf56fdb4bc1c9f1
    Reviewed-on: https://gerrit.libreoffice.org/54751
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 72c2097e911f..6ed971e2123b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4017,7 +4017,7 @@ public:
         // the popup menu render them in full, in the interim allow the text to wrap in both cases
         GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_pComboBoxText));
         GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
-        g_object_set(G_OBJECT(cell), "wrap-width", 3, nullptr);
+        g_object_set(G_OBJECT(cell), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
         g_list_free(cells);
 
         if (GtkEntry* pEntry = get_entry())
@@ -4053,7 +4053,9 @@ public:
         // tweak the cell render to get a narrower size to stick
         GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_pComboBoxText));
         GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
-        gtk_cell_renderer_set_fixed_size(cell, nWidth, -1);
+        GtkRequisition size;
+        gtk_cell_renderer_get_preferred_size(cell, m_pWidget, &size, nullptr);
+        gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height);
         g_list_free(cells);
 
         gtk_widget_set_size_request(m_pWidget, nWidth, nHeight);


More information about the Libreoffice-commits mailing list