changeset 1257:35b177e8a0a2

Basically a repeat of that last fix except for the data version of the function.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 24 Oct 2011 08:01:42 +0000
parents 51892bf7fe01
children 3df86772b625
files win/dw.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Mon Oct 24 07:56:20 2011 +0000
+++ b/win/dw.c	Mon Oct 24 08:01:42 2011 +0000
@@ -5521,7 +5521,7 @@
    HWND tmp;
    BubbleButton *bubble;
    HBITMAP hbitmap = 0;
-   HANDLE icon = 0;
+   HANDLE hicon = 0;
    char *file;
    FILE *fp;
    int windowtype;
@@ -5537,8 +5537,13 @@
          fwrite( data, 1, len, fp );
          fclose( fp );
 #ifdef GDIPLUS
-         windowtype = BS_BITMAP;
-         hbitmap = _dw_load_bitmap(file, NULL);
+         if((hicon = _dw_load_icon(file)))
+            windowtype = BS_ICON;
+         else
+         {
+            hbitmap = _dw_load_bitmap(file, NULL);
+            windowtype = BS_BITMAP;
+         }
 #else
          if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */
          {
@@ -5547,7 +5552,7 @@
          }
          else /* otherwise its assumed to be an ico */
          {
-            icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
+            hicon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
             windowtype = BS_ICON;
          }
 #endif
@@ -5580,9 +5585,9 @@
 
    _create_tooltip(tmp, text);
 
-   if ( icon )
-   {
-      SendMessage( tmp, BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM) icon);
+   if ( hicon )
+   {
+      SendMessage( tmp, BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM) hicon);
    }
    else if( hbitmap )
    {