diff src/w32term.c @ 90227:10fe5fadaf89

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-81 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 532-541) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 112-115) - Update from CVS
author Miles Bader <miles@gnu.org>
date Sun, 11 Sep 2005 22:21:01 +0000
parents 2d92f5c9d6ae 14dd537e7ba9
children 5e2d3828e89f
line wrap: on
line diff
--- a/src/w32term.c	Tue Sep 06 07:30:14 2005 +0000
+++ b/src/w32term.c	Sun Sep 11 22:21:01 2005 +0000
@@ -5418,16 +5418,25 @@
      struct frame *f;
      Lisp_Object icon;
 {
-  HANDLE hicon;
+  HANDLE main_icon;
+  HANDLE small_icon = NULL;
 
   if (FRAME_W32_WINDOW (f) == 0)
     return 1;
 
   if (NILP (icon))
-    hicon = LoadIcon (hinst, EMACS_CLASS);
+    main_icon = LoadIcon (hinst, EMACS_CLASS);
   else if (STRINGP (icon))
-    hicon = LoadImage (NULL, (LPCTSTR) SDATA (icon), IMAGE_ICON, 0, 0,
-		       LR_DEFAULTSIZE | LR_LOADFROMFILE);
+    {
+      /* Load the main icon from the named file.  */
+      main_icon = LoadImage (NULL, (LPCTSTR) SDATA (icon), IMAGE_ICON, 0, 0,
+			     LR_DEFAULTSIZE | LR_LOADFROMFILE);
+      /* Try to load a small icon to go with it.  */
+      small_icon = LoadImage (NULL, (LPCSTR) SDATA (icon), IMAGE_ICON,
+			      GetSystemMetrics (SM_CXSMICON),
+			      GetSystemMetrics (SM_CYSMICON),
+			      LR_LOADFROMFILE);
+    }
   else if (SYMBOLP (icon))
     {
       LPCTSTR name;
@@ -5447,16 +5456,21 @@
       else
 	return 1;
 
-      hicon = LoadIcon (NULL, name);
+      main_icon = LoadIcon (NULL, name);
     }
   else
     return 1;
 
-  if (hicon == NULL)
+  if (main_icon == NULL)
     return 1;
 
   PostMessage (FRAME_W32_WINDOW (f), WM_SETICON, (WPARAM) ICON_BIG,
-               (LPARAM) hicon);
+               (LPARAM) main_icon);
+
+  /* If there is a small icon that goes with it, set that too.  */
+  if (small_icon)
+    PostMessage (FRAME_W32_WINDOW (f), WM_SETICON, (WPARAM) ICON_SMALL,
+		 (LPARAM) small_icon);
 
   return 0;
 }