From a18dca2477ea4ac4abac68274828e0251b407289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Feb 2019 16:54:59 +0000 Subject: [PATCH] fix backport --- ...-combobox-in-format-cells-is-too-nar.patch | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch b/0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch index 5e7af01..cb25935 100644 --- a/0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch +++ b/0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch @@ -1,4 +1,4 @@ -From 7db6957c6d87f084661cc17940928726a6dc6c2b Mon Sep 17 00:00:00 2001 +From 88d65608a2bea19d803da47b0b75b7d3a3b86531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Feb 2019 15:57:22 +0000 Subject: [PATCH] menu of currency combobox in format-cells is too narrow @@ -18,42 +18,26 @@ in the widest menu we can get. Change-Id: Ie3e9960a320a70471ac21d2a88f32632cafa951f --- - cui/source/tabpages/numfmt.cxx | 2 +- - vcl/unx/gtk3/gtk3gtkinst.cxx | 23 +++++++++++++++++------ - 2 files changed, 18 insertions(+), 7 deletions(-) + vcl/unx/gtk3/gtk3gtkinst.cxx | 28 +++++++++++++++++++++++++--- + 1 file changed, 25 insertions(+), 3 deletions(-) -diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx -index c0e66b6ceb05..e51de20a02cb 100644 ---- a/cui/source/tabpages/numfmt.cxx -+++ b/cui/source/tabpages/numfmt.cxx -@@ -234,7 +234,7 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(TabPageParent pParent, - auto nWidth = approximate_char_width() * 26; - m_xLbCategory->set_size_request(nWidth, m_xLbCategory->get_height_rows(7)); - m_xLbFormat->set_size_request(nWidth, m_xLbFormat->get_height_rows(5)); -- m_xLbCurrency->set_size_request(1, -1); // width of 1, so real width will be that of its LbFormat sibling -+ m_xLbCurrency->set_size_request(nWidth, -1); // width of 1, so real width will be that of its LbFormat sibling - - // Initially remove the "Automatically" entry. - m_xLbCurrency->set_active(-1); // First ensure that nothing is selected. diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx -index cd00ff5a9e8c..b0c0e13b5e7e 100644 +index 808c1c6..b0e1573 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx -@@ -7531,20 +7531,31 @@ public: +@@ -6732,9 +6732,31 @@ public: // tweak the cell render to get a narrower size to stick GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_pComboBox)); GtkCellRenderer* cell = static_cast(cells->data); - GtkRequisition size; - gtk_cell_renderer_get_preferred_size(cell, m_pWidget, &size, nullptr); -- if (nWidth < size.width) +- gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height); + + if (nWidth != -1) - { - // this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let -- // the popup menu render them in full, in the interim ellipse both ++ { ++ // this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let + // the popup menu render them in full, in the interim ellipse both of them - g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr); -- gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height); ++ g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr); + + // to find out how much of the width of the combobox belongs to the cell, set + // the cell and widget to the min cell width and see what the difference is @@ -66,17 +50,16 @@ index cd00ff5a9e8c..b0c0e13b5e7e 100644 + // now set the cell to the max width which it can be within the + // requested widget width + gtk_cell_renderer_set_fixed_size(cell, nWidth - nNonCellWidth, -1); - } - else - { - g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_NONE, nullptr); -- gtk_cell_renderer_set_fixed_size(cell, -1, size.height); ++ } ++ else ++ { ++ g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_NONE, nullptr); + gtk_cell_renderer_set_fixed_size(cell, -1, -1); - } ++ } + g_list_free(cells); gtk_widget_set_size_request(m_pWidget, nWidth, nHeight); -- -2.21.0.rc1 +2.20.1