patch 9.1.1583: gvim window lost its icons

Commit: 
https://github.com/vim/vim/commit/9d5bb58637b67bbfb66b9464f15a69229a68b882
Author: Olaf Seibert <rhia...@falu.nl>
Date:   Wed Jul 23 19:35:59 2025 +0200

    patch 9.1.1583: gvim window lost its icons
    
    Problem:  Since patch 9.1.1199 the gvim window no longer had _NET_WM_ICON
              nor WM_HINTS icon information, for example when not using a
              Gnome or KDE desktop (after v9.1.1199)
    Solution: Check if the icon theme as used in patch 1199 contains a gvim
              icon. If so, set the window's icon from that. Otherwise
              use the previous method (Olaf Seibert)
    
    fixes: #17703
    closes: #17814
    
    Signed-off-by: Olaf Seibert <rhia...@falu.nl>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index c000a1181..49ed4271d 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2704,6 +2704,10 @@ global_event_filter(GdkXEvent *xev,
     static void
 mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
 {
+#include "../runtime/vim16x16.xpm"
+#include "../runtime/vim32x32.xpm"
+#include "../runtime/vim48x48.xpm"
+
     GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);
 
     // When started with "--echo-wid" argument, write window ID on stdout.
@@ -2718,10 +2722,32 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data 
UNUSED)
 
     if (vim_strchr(p_go, GO_ICON) != NULL)
     {
-       /*
-        * Add an icon to the main window. For fun and convenience of the user.
-        */
-       gtk_window_set_icon_name(GTK_WINDOW(gui.mainwin), "gvim");
+       GtkIconTheme *icon_theme;
+
+       icon_theme = gtk_icon_theme_get_default();
+
+       if (icon_theme && gtk_icon_theme_has_icon(icon_theme, "gvim"))
+       {
+           gtk_window_set_icon_name(GTK_WINDOW(gui.mainwin), "gvim");
+       }
+       else
+       {
+           /*
+            * Add an icon to the main window. For fun and convenience of the 
user.
+            */
+           GList *icons = NULL;
+
+           icons = g_list_prepend(icons, gdk_pixbuf_new_from_xpm_data((const 
char **)vim16x16));
+           icons = g_list_prepend(icons, gdk_pixbuf_new_from_xpm_data((const 
char **)vim32x32));
+           icons = g_list_prepend(icons, gdk_pixbuf_new_from_xpm_data((const 
char **)vim48x48));
+
+           gtk_window_set_icon_list(GTK_WINDOW(gui.mainwin), icons);
+
+           // TODO: is this type cast OK?
+           g_list_foreach(icons, (GFunc)(void *)&g_object_unref, NULL);
+           g_list_free(icons);
+       }
+       g_object_unref(icon_theme);
     }
 
 #if !defined(USE_GNOME_SESSION)
diff --git a/src/version.c b/src/version.c
index 68bd2f639..440ad9444 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1583,
 /**/
     1582,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uedWc-00625O-21%40256bit.org.

Raspunde prin e-mail lui