[gtk: 1/2] Load icon from executable on Windows




commit 82b11623f4307619db88eb83b07fe97403a3e120
Author: dparisot <dparisot mgen fr>
Date:   Sun Mar 21 15:24:28 2021 +0100

    Load icon from executable on Windows

 gdk/win32/gdksurface-win32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 03250491d4..1d0f12771a 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -352,12 +352,14 @@ RegisterGdkClass (GdkSurfaceType wtype)
     {
       char sLoc [MAX_PATH+1];
 
-      if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
+      // try to load first icon of executable program
+      if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
         {
           ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
 
           if (0 == hAppIcon && 0 == hAppIconSm)
             {
+              // fallback : load icon from GTK DLL
               if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
                {
                  ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]