From e316413f6047372829499cd4ada5649d02a18d19 Mon Sep 17 00:00:00 2001 From: deepend Date: Tue, 17 Feb 2026 23:07:17 -0700 Subject: [PATCH] Added stronger icon fallback handling for zc-menu-* menu items (including Server dropdown icons and Preferences) by introducing alternate fallback icon names and choosing an alternate only when the primary fallback icon is unavailable in the active icon theme. This specifically improves connect, disconnect, join, and preferences cases on Windows theme variations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kept the custom resource/file loading path in place (resource SVG + installed file fallback), then layered the improved theme fallback selection after it so menu icons still resolve if resource decoding is unavailable. Added emoji entry fallback logic: if GTK’s built-in show-emoji-icon leaves the secondary icon empty, the input box now picks the first available icon from a fallback list (face-smile-symbolic, face-smile, insert-emoticon-symbolic, insert-emoticon). --- src/fe-gtk/maingui.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 8a35b240..e40a0e0b 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -3198,6 +3198,25 @@ static const char *mg_emoji_family_fallback = "Noto Color Emoji, Segoe UI Emoji, Apple Color Emoji, Twemoji Mozilla, EmojiOne Color"; #endif +static const char * +mg_find_available_icon_name (const char *const *icon_names) +{ + GtkIconTheme *theme; + int i; + + theme = gtk_icon_theme_get_default (); + if (!theme || !icon_names) + return NULL; + + for (i = 0; icon_names[i] != NULL; i++) + { + if (gtk_icon_theme_has_icon (theme, icon_names[i])) + return icon_names[i]; + } + + return NULL; +} + static gboolean mg_family_already_has_emoji (const gchar *family) { @@ -3520,6 +3539,16 @@ mg_create_entry (session *sess, GtkWidget *box) { GtkWidget *hbox, *but, *entry; session_gui *gui = sess->gui; +#if HAVE_GTK3 + const char *emoji_fallback_icon_names[] = { + "face-smile-symbolic", + "face-smile", + "insert-emoticon-symbolic", + "insert-emoticon", + NULL + }; + const char *emoji_fallback_icon_name; +#endif hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0); gtk_box_pack_start (GTK_BOX (box), hbox, 0, 0, 0); @@ -3561,6 +3590,13 @@ mg_create_entry (session *sess, GtkWidget *box) #if HAVE_GTK3 g_object_set (G_OBJECT (entry), "show-emoji-icon", TRUE, NULL); + + if (gtk_entry_get_icon_storage_type (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY) + { + emoji_fallback_icon_name = mg_find_available_icon_name (emoji_fallback_icon_names); + if (emoji_fallback_icon_name) + gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, emoji_fallback_icon_name); + } #endif }