X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkwin.c;h=11c9c21ddec579ad11f49ce6376b17274c851c3b;hb=334ef0824cdafc77f184137c3b6fca0f9c0342cf;hp=c4c255aa5f74adec269e010ef7836f364d6fd0fd;hpb=cd94e3bc3c65e6205867549708c82bec40f55e79;p=PuTTY.git diff --git a/unix/gtkwin.c b/unix/gtkwin.c index c4c255aa..11c9c21d 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -3301,6 +3301,35 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data) get_sesslist(&sesslist, FALSE); /* free up */ } +void set_window_icon(GtkWidget *window, const char *const *const *icon, + int n_icon) +{ + GdkPixmap *iconpm; +#if GTK_CHECK_VERSION(2,0,0) + GList *iconlist; + int n; +#endif + + if (!n_icon) + return; + + gtk_widget_realize(window); + iconpm = gdk_pixmap_create_from_xpm_d(window->window, NULL, + NULL, (gchar **)icon[0]); + gdk_window_set_icon(window->window, NULL, iconpm, NULL); + +#if GTK_CHECK_VERSION(2,0,0) + iconlist = NULL; + for (n = 0; n < n_icon; n++) { + iconlist = + g_list_append(iconlist, + gdk_pixbuf_new_from_xpm_data((const gchar **) + icon[n])); + } + gdk_window_set_icon_list(window->window, iconlist); +#endif +} + void update_specials_menu(void *frontend) { struct gui_data *inst = (struct gui_data *)frontend; @@ -3552,6 +3581,12 @@ int pt_main(int argc, char **argv) GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK); + { + extern const char *const *const main_icon[]; + extern const int n_main_icon; + set_window_icon(inst->window, main_icon, n_main_icon); + } + gtk_widget_show(inst->window); set_window_background(inst);