privoxy-log-parser: Update Privoxy man page reference now that the section is 8
[privoxy.git] / w32taskbar.c
index 7bf83d9..0a25bbd 100644 (file)
@@ -1,4 +1,3 @@
-const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.4 2001/11/16 00:46:31 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/w32taskbar.c,v $
@@ -7,12 +6,12 @@ const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.4 2001/11/16 00:46:31 jongf
  *                workspace tray icon
  *
  * Copyright   :  Written by and Copyright (C) 2001-2002 members of
- *                the Privoxy team.  http://privoxy.org/
+ *                the Privoxy team.  https://www.privoxy.org/
  *
  *                Written by and Copyright (C) 1999 Adam Lock
  *                <locka@iol.ie>
  *
- *                This program is free software; you can redistribute it 
+ *                This program is free software; you can redistribute it
  *                and/or modify it under the terms of the GNU General
  *                Public License as published by the Free Software
  *                Foundation; either version 2 of the License, or (at
@@ -30,42 +29,29 @@ const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.4 2001/11/16 00:46:31 jongf
  *                or write to the Free Software Foundation, Inc., 59
  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * Revisions   :
- *    $Log: w32taskbar.c,v $
- *    Revision 1.4  2001/11/16 00:46:31  jongfoster
- *    Fixing compiler warnings
- *
- *    Revision 1.3  2001/05/22 18:56:28  oes
- *    CRLF -> LF
- *
- *    Revision 1.2  2001/05/20 15:07:54  jongfoster
- *    File is now ignored if _WIN_CONSOLE is defined.
- *
- *    Revision 1.1.1.1  2001/05/15 13:59:08  oes
- *    Initial import of version 2.9.3 source tree
- *
- *
  *********************************************************************/
-\f
+
 
 #include "config.h"
 
 #include <stdio.h>
 
+#ifndef STRICT
+#define STRICT
+#endif
 #include <windows.h>
 
 #include "w32taskbar.h"
 #include "w32res.h"
 #include "w32log.h"
 
-const char w32taskbar_h_rcs[] = W32TASKBAR_H_VERSION;
-
 #ifndef _WIN_CONSOLE /* entire file */
 
 #define WM_TRAYMSG WM_USER+1
 
 static HMENU g_hmenuTray;
 static HWND g_hwndTrayX;
+static UINT g_traycreatedmsg;
 
 static LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
 
@@ -101,9 +87,12 @@ HWND CreateTrayWindow(HINSTANCE hInstance)
 
    RegisterClass(&wc);
 
+   /* TaskbarCreated is sent to a window when it should re-add its tray icons */
+   g_traycreatedmsg = RegisterWindowMessage("TaskbarCreated");
+
    g_hwndTrayX = CreateWindow(szWndName, szWndName,
       WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-      CW_USEDEFAULT, NULL, NULL, hInstance, NULL );
+      CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
 
    ShowWindow(g_hwndTrayX, SW_HIDE);
    UpdateWindow(g_hwndTrayX);
@@ -142,7 +131,7 @@ BOOL TraySetIcon(HWND hwnd, UINT uID, HICON hicon)
    nid.uCallbackMessage = 0;
    nid.hIcon = hicon;
 
-   return( Shell_NotifyIcon(NIM_MODIFY, &nid) );
+   return(Shell_NotifyIcon(NIM_MODIFY, &nid));
 
 }
 
@@ -180,7 +169,7 @@ BOOL TrayAddIcon(HWND hwnd, UINT uID, HICON hicon, const char *pszToolTip)
       strcpy(nid.szTip, pszToolTip);
    }
 
-   return( Shell_NotifyIcon(NIM_ADD, &nid) );
+   return(Shell_NotifyIcon(NIM_ADD, &nid));
 
 }
 
@@ -208,7 +197,7 @@ BOOL TrayDeleteIcon(HWND hwnd, UINT uID)
    nid.hWnd = hwnd;
    nid.uID = uID;
 
-   return( Shell_NotifyIcon(NIM_DELETE, &nid) );
+   return(Shell_NotifyIcon(NIM_DELETE, &nid));
 
 }
 
@@ -251,7 +240,7 @@ LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             GetCursorPos(&pt);
             SetForegroundWindow(g_hwndLogFrame);
             TrackPopupMenu(hmenu, TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, g_hwndLogFrame, NULL);
-            PostMessage(g_hwndLogFrame, WM_NULL, 0, 0 ) ;
+            PostMessage(g_hwndLogFrame, WM_NULL, 0, 0);
          }
          else if (uMouseMsg == WM_LBUTTONDBLCLK)
          {
@@ -261,7 +250,11 @@ LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
       return 0;
 
       default:
-         /* DO NOTHING */
+
+         if (msg == g_traycreatedmsg)
+         {
+            TrayAddIcon(g_hwndTrayX, 1, g_hiconApp, "Privoxy");
+         }
          break;
    }