]> Pileus Git - ~andy/gtk/commitdiff
Improve handling of the small icon of the window class. (#152620, Kazuki
authorTor Lillqvist <tml@novell.com>
Sat, 28 Oct 2006 23:58:30 +0000 (23:58 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sat, 28 Oct 2006 23:58:30 +0000 (23:58 +0000)
2006-10-29  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Improve handling
of the small icon of the window class. (#152620, Kazuki Iwamoto)

ChangeLog
gdk/win32/gdkwindow-win32.c

index ab4ef4e1dc456699b33af2780378d4d0675705a8..159e0b529b1cfea7622432ccbd518d7363c49f98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-29  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Improve handling
+       of the small icon of the window class. (#152620, Kazuki Iwamoto)
+
 2006-10-27  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (validate_visible_area): rework the area_above == 0
index 22959242fd4a2d60d13cefd4f037c92bd1b80b0a..31650cbd8bb9039a4d5e4705accc9908384b0c5e 100644 (file)
@@ -318,6 +318,7 @@ RegisterGdkClass (GdkWindowType wtype)
   static ATOM klassCHILD    = 0;
   static ATOM klassTEMP     = 0;
   static HICON hAppIcon = NULL;
+  static HICON hAppIconSm = NULL;
   static WNDCLASSEXW wcl; 
   ATOM klass = 0;
 
@@ -330,26 +331,37 @@ RegisterGdkClass (GdkWindowType wtype)
   wcl.cbWndExtra = 0;
   wcl.hInstance = _gdk_app_hmodule;
   wcl.hIcon = 0;
+  wcl.hIconSm = 0;
   /* initialize once! */
-  if (0 == hAppIcon)
+  if (0 == hAppIcon && 0 == hAppIconSm)
     {
       gchar sLoc [MAX_PATH+1];
 
       if (0 != GetModuleFileName (_gdk_app_hmodule, sLoc, MAX_PATH))
-       {
-         hAppIcon = ExtractIcon (_gdk_app_hmodule, sLoc, 0);
-         if (0 == hAppIcon)
-           {
-             if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
-               hAppIcon = ExtractIcon (_gdk_dll_hinstance, sLoc, 0);
-           }
-       }
-      if (0 == hAppIcon) 
-       hAppIcon = LoadIcon (NULL, IDI_APPLICATION);
+        {
+          ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
+          if (0 == hAppIcon && 0 == hAppIconSm)
+            {
+              if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
+                ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
+            }
+        }
+      if (0 == hAppIcon && 0 == hAppIconSm)
+        {
+          hAppIcon = LoadImage (NULL, IDI_APPLICATION, IMAGE_ICON,
+                                GetSystemMetrics (SM_CXICON),
+                                GetSystemMetrics (SM_CYICON), 0);
+          hAppIconSm = LoadImage (NULL, IDI_APPLICATION, IMAGE_ICON,
+                                  GetSystemMetrics (SM_CXSMICON),
+                                  GetSystemMetrics (SM_CYSMICON), 0);
+        }
     }
+  if (0 == hAppIcon)
+    hAppIcon = hAppIconSm;
+  else if (0 == hAppIconSm)
+    hAppIconSm = hAppIcon;
 
   wcl.lpszMenuName = NULL;
-  wcl.hIconSm = 0;
 
   /* initialize once per class */
   /*
@@ -359,7 +371,7 @@ RegisterGdkClass (GdkWindowType wtype)
    */
 #define ONCE_PER_CLASS() \
   wcl.hIcon = CopyIcon (hAppIcon); \
-  wcl.hIconSm = CopyIcon (hAppIcon); \
+  wcl.hIconSm = CopyIcon (hAppIconSm); \
   wcl.hbrBackground = NULL; \
   wcl.hCursor = LoadCursor (NULL, IDC_ARROW);