changeset 1258:3df86772b625

Updated the list of supported image formats for GTK. This could be generated automatically by querying pixbuf loaders... However it does not take into account formats that support transparency. So for right now we keep using a static list... and include the most popular formats.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 24 Oct 2011 08:30:53 +0000
parents 35b177e8a0a2
children 2d2b945ee0bf
files gtk/dw.c gtk3/dw.c
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Mon Oct 24 08:01:42 2011 +0000
+++ b/gtk/dw.c	Mon Oct 24 08:30:53 2011 +0000
@@ -101,14 +101,18 @@
 /*
  * List those icons that have transparency first
  */
-#define NUM_EXTS 5
+#define NUM_EXTS 9
 char *image_exts[NUM_EXTS] =
 {
    ".xpm",
    ".png",
    ".ico",
+   ".icns",
+   ".gif",
    ".jpg",
-   ".bmp",
+   ".jpeg",
+   ".tiff",
+   ".bmp"
 };
 
 #ifndef max
@@ -4557,7 +4561,7 @@
       tmp = _find_pixmap(&bitmap, (HICN)id, handle, NULL, NULL);
    else
    {
-      char *file = alloca(strlen(filename) + 5);
+      char *file = alloca(strlen(filename) + 6);
 #if GTK_MAJOR_VERSION > 1
       GdkPixbuf *pixbuf;
 #elif defined(USE_IMLIB)
@@ -6615,7 +6619,7 @@
 #elif defined(USE_IMLIB)
    GdkImlibImage *image;
 #endif
-   char *file = alloca(strlen(filename) + 5);
+   char *file = alloca(strlen(filename) + 6);
    unsigned long z, ret = 0;
    int found_ext = 0;
    int i;
@@ -8357,7 +8361,7 @@
 #ifdef USE_IMLIB
    GdkImlibImage *image;
 #endif
-   char *file = alloca(strlen(filename) + 5);
+   char *file = alloca(strlen(filename) + 6);
    int found_ext = 0;
    int i;
 
--- a/gtk3/dw.c	Mon Oct 24 08:01:42 2011 +0000
+++ b/gtk3/dw.c	Mon Oct 24 08:30:53 2011 +0000
@@ -96,14 +96,18 @@
 /*
  * List those icons that have transparency first
  */
-#define NUM_EXTS 5
+#define NUM_EXTS 9
 char *image_exts[NUM_EXTS] =
 {
    ".xpm",
    ".png",
    ".ico",
+   ".icns",
+   ".gif",
    ".jpg",
-   ".bmp",
+   ".jpeg",
+   ".tiff",
+   ".bmp"
 };
 
 #ifndef max
@@ -4206,7 +4210,7 @@
       tmp = _find_pixbuf((HICN)id, NULL, NULL);
    else
    {
-      char *file = alloca(strlen(filename) + 5);
+      char *file = alloca(strlen(filename) + 6);
 
       if (!file)
       {
@@ -5624,7 +5628,7 @@
 HICN API dw_icon_load_from_file(char *filename)
 {
    int _locked_by_me = FALSE;
-   char *file = alloca(strlen(filename) + 5);
+   char *file = alloca(strlen(filename) + 6);
    int i, found_ext = 0;
    HICN ret = 0;
 
@@ -7127,7 +7131,7 @@
 {
    int _locked_by_me = FALSE;
    HPIXMAP pixmap;
-   char *file = alloca(strlen(filename) + 5);
+   char *file = alloca(strlen(filename) + 6);
    int found_ext = 0;
    int i;