To: vim-dev@vim.org Subject: Patch 6.0.202 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.202 Problem: The "icon=" argument for the menu command to define a toolbar icon with a file didn't work for GTK. (Christian J. Robinson) For Motif and Athena a full path was required. Solution: Search the icon file using the specified path. Expand environment variables in the file name. Files: src/gui_gtk.c, src/gui_x11.c *** ../vim60.201/src/gui_gtk.c Sun Feb 3 15:27:26 2002 --- src/gui_gtk.c Thu Feb 7 22:37:33 2002 *************** *** 400,405 **** --- 400,422 ---- &gui.mainwin->style->bg[GTK_STATE_NORMAL], (const char *)full_pathname); } + + /* + * Creates a pixmap by using the pixmap "file". + */ + static void + pixmap_create_from_file(char_u *file, GdkPixmap **pixmap, GdkBitmap **mask) + { + char_u full_pathname[MAXPATHL + 1]; + + expand_env(file, full_pathname, MAXPATHL); + *pixmap = gdk_pixmap_colormap_create_from_xpm( + NULL, + gtk_widget_get_colormap(gui.mainwin), + mask, + &gui.mainwin->style->bg[GTK_STATE_NORMAL], + (const char *)full_pathname); + } #endif /*ARGSUSED*/ *************** *** 421,427 **** GdkBitmap *mask = NULL; /* First try user specified bitmap, then builtin, the a blank. */ ! if (!menu->icon_builtin) pixmap_create_by_dir(menu->name, &pixmap, &mask); if (pixmap == NULL && menu->iconidx >= 0) pixmap_create_by_num(menu->iconidx, &pixmap, &mask); --- 438,446 ---- GdkBitmap *mask = NULL; /* First try user specified bitmap, then builtin, the a blank. */ ! if (menu->iconfile != NULL) ! pixmap_create_from_file(menu->iconfile, &pixmap, &mask); ! if (pixmap == NULL && !menu->icon_builtin) pixmap_create_by_dir(menu->name, &pixmap, &mask); if (pixmap == NULL && menu->iconidx >= 0) pixmap_create_by_num(menu->iconidx, &pixmap, &mask); *** ../vim60.201/src/gui_x11.c Tue Feb 5 21:59:55 2002 --- src/gui_x11.c Thu Feb 7 22:45:44 2002 *************** *** 3450,3456 **** { /* Use the file argument: first as an absolute path (with extension), * then as a file name (without extension). */ ! createXpmImages(menu->iconfile, NULL, sen, insen); if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK && buf[0] != NUL) --- 3450,3457 ---- { /* Use the file argument: first as an absolute path (with extension), * then as a file name (without extension). */ ! expand_env(menu->iconfile, buf, MAXPATHL); ! createXpmImages(buf, NULL, sen, insen); if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK && buf[0] != NUL) *** ../vim60.201/src/version.c Thu Feb 7 22:18:19 2002 --- src/version.c Thu Feb 7 22:40:35 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 202, /**/ -- Life would be so much easier if we could just look at the source code. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///