From c0e82a4edd42b27f61837c87a892a4a186df0a74 Mon Sep 17 00:00:00 2001 From: Graeme Gott Date: Tue, 11 Feb 2020 10:40:17 -0500 Subject: [PATCH] Fix hyphenated words with pango 1.44 --- panel-plugin/launcher-icon-view.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/panel-plugin/launcher-icon-view.cpp b/panel-plugin/launcher-icon-view.cpp index e5328d13..8d134b42 100644 --- a/panel-plugin/launcher-icon-view.cpp +++ b/panel-plugin/launcher-icon-view.cpp @@ -22,6 +22,7 @@ #include "slot.h" #include +#include using namespace WhiskerMenu; @@ -40,12 +41,31 @@ LauncherIconView::LauncherIconView() : "xalign", 0.5, "yalign", 1.0, nullptr); + GtkCellLayout* cell_layout = GTK_CELL_LAYOUT(m_view); gtk_cell_layout_pack_start(cell_layout, m_icon_renderer, false); gtk_cell_layout_set_attributes(cell_layout, m_icon_renderer, "gicon", COLUMN_ICON, "launcher", COLUMN_LAUNCHER, nullptr); gtk_icon_view_set_markup_column(m_view, COLUMN_TEXT); +#if PANGO_VERSION_CHECK(1,44,0) + PangoAttrList* attrs = pango_attr_list_new(); + pango_attr_list_insert(attrs, pango_attr_insert_hyphens_new(false)); + + GList* cells = gtk_cell_layout_get_cells(cell_layout); + for (GList* i = cells; i; i = i->next) + { + if (GTK_IS_CELL_RENDERER_TEXT(i->data)) + { + GtkCellRendererText* text = static_cast(i->data); + g_object_set(text, "attributes", attrs, nullptr); + } + } + g_list_free(cells); + + pango_attr_list_unref(attrs); +#endif + reload_icon_size(); // Use single clicks to activate items -- 2.25.0