Colin,

Your patch is pretty close to being on the money.

However, it doesn't call DestroyIcon to free the loaded icon, nor does it specify the LR_SHARED flag which would cause the icon to be automatically freed when no longer referenced.

Unfortunately, we can't use LR_SHARED because MSDN states:
"Windows 95/98: The function finds the first image with the requested resource name in the cache, regardless of the size requested."


Thus, using LR_SHARED on Windows 95/98 would defeat the whole purpose of LoadImage, which is to load the icon with the specified size.

Instead, we must keep a handle to the icon that LoadImage returns in our screen privates and we must call DestroyIcon on this handle in winDeleteNotifyIcon(). I went ahead and polished those rough edges for you. No charge :)

I appreciate your patches... they tend to get the bulk of the problem fixed, which is the main stumbling point for me. I don't mind handling those niggling little details as above, as long as somebody gets me going in the right direction like you did.

Thanks for contributing,

Harold


Colin Harrison wrote:


Hi,

My fix is only applicable for the tray icon case.
Elsewhere it's a waste of time and obviously makes the task switcher worse
for
apps that default to X, where 32x32 is better.

So only apply to wintrayicon.c

--- save_wintrayicon.c  2003-06-01 14:58:40.000000000 +0100
+++ wintrayicon.c       2003-06-01 15:16:11.000000000 +0100
@@ -49,7 +49,12 @@
   nid.uID = pScreenInfo->dwScreen;
   nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
   nid.uCallbackMessage = WM_TRAYICON;
-  nid.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+  nid.hIcon = LoadImage (g_hInstance,
+                        MAKEINTRESOURCE(IDI_XWIN),
+                        IMAGE_ICON,
+                        16,
+                        16,
+                        0);

   /* Set display and screen-specific tooltip text */
   snprintf (nid.szTip,


Again I've only tested on XP.


Colin







Reply via email to