X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=w32taskbar.c;h=0a25bbd8a27d2420f81e613c0c9dbce88fa26011;hp=62f269d0124b3c4fcec86977ed13b032928eba52;hb=32ba28b1225c54c850c48814b018e7afcffbd0a5;hpb=c75584ebcc79f939fb4ec9c8f842cef6692640c7 diff --git a/w32taskbar.c b/w32taskbar.c index 62f269d0..0a25bbd8 100644 --- a/w32taskbar.c +++ b/w32taskbar.c @@ -1,18 +1,17 @@ -const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.1 2001/05/13 21:57:07 administrator Exp $"; /********************************************************************* * - * File : $Source: /home/administrator/cvs/ijb/w32taskbar.c,v $ + * File : $Source: /cvsroot/ijbswa/current/w32taskbar.c,v $ * * Purpose : Functions for creating, setting and destroying the * workspace tray icon * - * Copyright : Written by and Copyright (C) 2001 the SourceForge - * IJBSWA team. http://ijbswa.sourceforge.net + * Copyright : Written by and Copyright (C) 2001-2002 members of + * the Privoxy team. https://www.privoxy.org/ * * Written by and Copyright (C) 1999 Adam Lock * * - * 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,28 +29,29 @@ const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.1 2001/05/13 21:57:07 admin * or write to the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Revisions : - * $Log: w32taskbar.c,v $ - * *********************************************************************/ - + #include "config.h" #include +#ifndef STRICT +#define STRICT +#endif #include #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); @@ -60,7 +60,8 @@ static LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar * * Function : CreateTrayWindow * - * Description : Creates and returns the invisible window responsible for processing tray messages. + * Description : Creates and returns the invisible window responsible + * for processing tray messages. * * Parameters : * 1 : hInstance = instance handle of this application @@ -71,7 +72,7 @@ static LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HWND CreateTrayWindow(HINSTANCE hInstance) { WNDCLASS wc; - static const char *szWndName = "JunkbusterTrayWindow"; + static const char *szWndName = "PrivoxyTrayWindow"; wc.style = 0; wc.lpfnWndProc = TrayProc; @@ -86,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); @@ -127,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)); } @@ -165,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)); } @@ -193,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)); } @@ -226,7 +230,7 @@ LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_TRAYMSG: { - UINT uID = (UINT) wParam; + /* UINT uID = (UINT) wParam; */ UINT uMouseMsg = (UINT) lParam; if (uMouseMsg == WM_RBUTTONDOWN) @@ -236,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) { @@ -246,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; } @@ -255,6 +263,8 @@ LRESULT CALLBACK TrayProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } +#endif /* ndef _WIN_CONSOLE - entire file */ + /* Local Variables: tab-width: 3