From 0413cc856c8006163bfb4c6d2eeae84f8e475a91 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 16 Aug 2015 09:41:10 +0100 Subject: [PATCH] Use gtk_window_set_icon() where available. GTK is deprecating the use of gdk_window_set_icon(), in favour of a method that doesn't have to drop down to the GDK level at all (and also doesn't use a pixmap). No reason not to use that instead. --- unix/gtkwin.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 73b743e6..726a7d2c 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -3817,20 +3817,26 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data) void set_window_icon(GtkWidget *window, const char *const *const *icon, int n_icon) { - GdkPixmap *iconpm; - GdkBitmap *iconmask; #if GTK_CHECK_VERSION(2,0,0) GList *iconlist; int n; +#else + GdkPixmap *iconpm; + GdkBitmap *iconmask; #endif if (!n_icon) return; gtk_widget_realize(window); +#if GTK_CHECK_VERSION(2,0,0) + gtk_window_set_icon(GTK_WINDOW(window), + gdk_pixbuf_new_from_xpm_data((const gchar **)icon[0])); +#else iconpm = gdk_pixmap_create_from_xpm_d(gtk_widget_get_window(window), &iconmask, NULL, (gchar **)icon[0]); gdk_window_set_icon(gtk_widget_get_window(window), NULL, iconpm, iconmask); +#endif #if GTK_CHECK_VERSION(2,0,0) iconlist = NULL; @@ -3840,7 +3846,7 @@ void set_window_icon(GtkWidget *window, const char *const *const *icon, gdk_pixbuf_new_from_xpm_data((const gchar **) icon[n])); } - gdk_window_set_icon_list(gtk_widget_get_window(window), iconlist); + gtk_window_set_icon_list(GTK_WINDOW(window), iconlist); #endif }