vcl/inc/unx/gtk/gtkdata.hxx | 3 +++ vcl/unx/gtk3/gtkinst.cxx | 4 ++++ vcl/unx/gtk3/gtksalmenu.cxx | 19 ++----------------- 3 files changed, 9 insertions(+), 17 deletions(-)
New commits: commit 522983d79aa03bd5cc83a8a8b5b385f3b6cfe998 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Oct 10 17:40:39 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Oct 10 20:32:18 2021 +0200 gtk[3|4] use set_buildable_id and get_buildable_id Change-Id: Ia3a24d80ac56bc834c11f85a98e3b9fa1a862e41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123343 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 185a000e0398..5299d15a2088 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -192,6 +192,9 @@ inline GdkGLContext* surface_create_gl_context(GdkSurface* pSurface) #endif } +void set_buildable_id(GtkBuildable* pWidget, const OString& rId); +OString get_buildable_id(GtkBuildable* pWidget); + #if !GTK_CHECK_VERSION(4, 0, 0) typedef GtkClipboard GdkClipboard; #endif diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index ec87c2785741..c648bfee534d 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2495,6 +2495,8 @@ void set_cursor(GtkWidget* pWidget, const char *pName) #endif } +} + OString get_buildable_id(GtkBuildable* pWidget) { #if GTK_CHECK_VERSION(4, 0, 0) @@ -2515,6 +2517,8 @@ void set_buildable_id(GtkBuildable* pWidget, const OString& rId) #endif } +namespace { + class GtkInstanceWidget : public virtual weld::Widget { protected: diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index 1ef9dfc88137..a202f75760e3 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -787,12 +787,7 @@ namespace static void MenuButtonClicked(GtkWidget* pWidget, gpointer pMenu) { -#if !GTK_CHECK_VERSION(4, 0, 0) - const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pWidget)); -#else - const char* pStr = gtk_buildable_get_buildable_id(GTK_BUILDABLE(pWidget)); -#endif - OString aId(pStr, pStr ? strlen(pStr) : 0); + OString aId(get_buildable_id(GTK_BUILDABLE(pWidget))); static_cast<MenuBar*>(pMenu)->HandleMenuButtonEvent(aId.toUInt32()); } @@ -829,9 +824,7 @@ bool GtkSalMenu::AddMenuBarButton(const SalMenuButtonItem& rNewItem) maExtraButtons.emplace_back(rNewItem.mnId, pButton); -#if !GTK_CHECK_VERSION(4, 0, 0) - gtk_buildable_set_name(GTK_BUILDABLE(pButton), OString::number(rNewItem.mnId).getStr()); -#endif + set_buildable_id(GTK_BUILDABLE(pButton), OString::number(rNewItem.mnId).getStr()); gtk_widget_set_tooltip_text(pButton, rNewItem.maToolTipText.toUtf8().getStr()); commit 44583c313aad7076d67f868379e9b6616485b299 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Oct 10 17:34:01 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Oct 10 20:32:04 2021 +0200 gtk4: this is fixed now by at least >= gtk4-4.4.0 Change-Id: Iaff7c779917c7a1d90849d2091dd818bc0c04750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123342 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index ed67e7d30d88..1ef9dfc88137 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -1233,14 +1233,6 @@ void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString aText = rText.replaceAll( "_", "__" ); // Replace the LibreOffice hotkey identifier with an underscore aText = aText.replace( '~', '_' ); - // quick and easy replacement of & to & etc, for e.g. "Zoom & Pa_n" in impress -#if GTK_CHECK_VERSION(4, 0, 0) - { - OUString aTempString; - vcl::escapeStringXML(aText, aTempString); - aText = aTempString; - } -#endif OString aConvertedText = OUStringToOString( aText, RTL_TEXTENCODING_UTF8 ); // Update item text only when necessary.