From 2326f9a5546baeaf82a80d754de8f07020b62d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Feb 2019 16:09:47 +0000 Subject: [PATCH] menu of currency combobox is too wide --- ...-combobox-in-format-cells-is-too-nar.patch | 82 +++++++++++++++++++ libreoffice.spec | 6 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch 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 new file mode 100644 index 0000000..5e7af01 --- /dev/null +++ b/0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch @@ -0,0 +1,82 @@ +From 7db6957c6d87f084661cc17940928726a6dc6c2b 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 + +we want the combobox to be narrower than it wants to be. To make that happen +we have only the option of shrinking the cell renderer of the combobox area. +And that is also used by the menu. + +Setting a small value of e.g. 1 works to let the combobox not request more +width than that, and the combobox will correctly render within the wider size +it actually gets. But then the menu is a min width menu, which is undesirable, +we want the menu to be as wide as it can be. + +So calculate what part of the combobox belongs to the cell area and set +the widest cell area we can within the overall combobox width, resulting +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(-) + +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 +--- a/vcl/unx/gtk3/gtk3gtkinst.cxx ++++ b/vcl/unx/gtk3/gtk3gtkinst.cxx +@@ -7531,20 +7531,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) ++ ++ 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 ++ // 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); ++ ++ // 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 ++ int min; ++ gtk_cell_renderer_get_preferred_width(cell, m_pWidget, &min, nullptr); ++ gtk_cell_renderer_set_fixed_size(cell, min, -1); ++ gtk_widget_set_size_request(m_pWidget, min, -1); ++ int nNonCellWidth = get_preferred_size().Width() - min; ++ ++ // 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); ++ 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 + diff --git a/libreoffice.spec b/libreoffice.spec index 775d965..5a14d59 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -54,7 +54,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.3 -Release: 2%{?libo_prerelease}%{?dist} +Release: 3%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0 URL: http://www.libreoffice.org/ @@ -241,6 +241,7 @@ Patch1: 0001-Resolves-rhbz-1432468-disable-opencl-by-default.patch Patch2: 0001-Upgrade-external-boost-to-Boost-1.69.0.patch Patch3: 0001-Resolves-tdf-122623-theme-unwanted-tab-into-invisibi.patch Patch4: 0001-tdf-122393-move-to-overflow-row-on-using-left-right-.patch +Patch5: 0001-menu-of-currency-combobox-in-format-cells-is-too-nar.patch %if 0%{?rhel} # not upstreamed @@ -2121,6 +2122,9 @@ done %{_includedir}/LibreOfficeKit %changelog +* Thu Feb 21 2019 Caolán McNamara - 1:6.2.0.3-3 +- menu of currency combobox is too wide + * Thu Feb 21 2019 Caolán McNamara - 1:6.2.0.3-2 - Resolves: tdf#122623 theme unwanted tab into invisibilty