24#define BALLOON_MAXWIDTH 340
109 if (
source->dwInfoFlags == NIIF_USER)
270 m_hWatcherThread(
NULL),
284 if (m_hWatcherThread)
294 if (m_WakeUpEvent ==
NULL)
303 if (m_hWatcherThread ==
NULL)
318 for (
size_t i = 0;
i < m_WatcherList.GetCount();
i++)
320 Pos = m_WatcherList.FindIndex(
i);
324 Icon = m_WatcherList.GetAt(
Pos);
328 m_WatcherList.RemoveAll();
357 m_WatcherList.AddTail(
Icon);
389 POSITION NextPosition = m_WatcherList.GetHeadPosition();
395 Entry = m_WatcherList.GetNext(NextPosition);
398 if ((iconData && ((
Entry->IconData.hWnd == iconData->hWnd) && (
Entry->IconData.uID == iconData->uID))) ||
408 }
while (NextPosition !=
NULL);
424 Size =
This->m_WatcherList.GetCount() + 1;
430 WatchList[0] =
This->m_WakeUpEvent;
433 for (
size_t i = 0;
i <
This->m_WatcherList.GetCount();
i++)
435 Pos =
This->m_WatcherList.FindIndex(
i);
440 WatchList[
i + 1] =
Icon->hProcess;
455 TRACE(
"Updating watched icon list\n");
462 TRACE(
"Pid %lu owns a notification icon and has stopped without deleting it. We'll cleanup on its behalf\n",
Icon->ProcessId);
464 TRAYNOTIFYDATAW tnid = {0};
465 tnid.dwSignature = NI_NOTIFY_SIG;
471 data.cbData =
sizeof(tnid);
479 This->RemoveIconFromWatcher(&
Icon->IconData);
488 ERR(
"Failed to wait on process handles : %lu\n",
Status);
489 This->Uninitialize();
508 m_currentClosed(
false),
574 Close(notifyItem, NIN_BALLOONHIDE);
580 Close(notifyItem, NIN_BALLOONHIDE);
583 while(position !=
NULL)
586 if (
info.pSource == notifyItem)
619 TRACE(
"ShowBalloonTip called for flags=%x text=%ws; title=%ws\n",
info.uIcon,
info.szInfo,
info.szInfoTitle);
647 TRACE(
"HideBalloonTip called\n");
666 m_VisibleButtonCount(0),
682 int count = GetButtonCount();
702 int count = GetButtonCount();
723 TRACE(
"Adding icon %d from hWnd %08x flags%s%s state%s%s\n",
724 iconData->uID, iconData->hWnd,
725 (iconData->uFlags &
NIF_ICON) ?
" ICON" :
"",
726 (iconData->uFlags & NIF_STATE) ?
" STATE" :
"",
727 (iconData->dwState & NIS_HIDDEN) ?
" HIDDEN" :
"",
728 (iconData->dwState & NIS_SHAREDICON) ?
" SHARED" :
"");
730 int index =
FindItem(iconData->hWnd, iconData->uID, ¬ifyItem);
733 TRACE(
"Icon %d from hWnd %08x ALREADY EXISTS!\n", iconData->uID, iconData->hWnd);
740 notifyItem->
hWnd = iconData->hWnd;
741 notifyItem->
uID = iconData->uID;
750 if (iconData->uFlags & NIF_STATE)
752 notifyItem->
dwState = iconData->dwState & iconData->dwStateMask;
762 notifyItem->
hIcon = iconData->hIcon;
763 BOOL hasSharedIcon = notifyItem->
dwState & NIS_SHAREDICON;
770 TRACE(
"Shared icon requested, but HICON not found!!!\n");
780 if (iconData->uFlags &
NIF_TIP)
785 if (iconData->uFlags & NIF_INFO)
791 notifyItem->
uTimeout = iconData->uTimeout;
794 if (notifyItem->
dwState & NIS_HIDDEN)
808 if (iconData->uFlags & NIF_INFO)
819 int index =
FindItem(iconData->hWnd, iconData->uID, ¬ifyItem);
822 WARN(
"Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
826 if (iconData->uVersion != 0 && iconData->uVersion != NOTIFYICON_VERSION)
828 WARN(
"Tried to set the version of icon %d from hWnd %08x, to an unknown value %d. Vista+ program?\n", iconData->uID, iconData->hWnd, iconData->uVersion);
844 TRACE(
"Updating icon %d from hWnd %08x flags%s%s state%s%s\n",
845 iconData->uID, iconData->hWnd,
846 (iconData->uFlags &
NIF_ICON) ?
" ICON" :
"",
847 (iconData->uFlags & NIF_STATE) ?
" STATE" :
"",
848 (iconData->dwState & NIS_HIDDEN) ?
" HIDDEN" :
"",
849 (iconData->dwState & NIS_SHAREDICON) ?
" SHARED" :
"");
851 int index =
FindItem(iconData->hWnd, iconData->uID, ¬ifyItem);
854 WARN(
"Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
859 GetButton(
index, &btn);
860 int oldIconIndex = btn.
iBitmap;
862 tbbi.cbSize =
sizeof(tbbi);
864 tbbi.idCommand =
index;
866 if (iconData->uFlags & NIF_STATE)
868 if (iconData->dwStateMask & NIS_HIDDEN &&
869 (notifyItem->
dwState & NIS_HIDDEN) != (iconData->dwState & NIS_HIDDEN))
872 if (iconData->dwState & NIS_HIDDEN)
879 tbbi.fsState &= ~TBSTATE_HIDDEN;
884 notifyItem->
dwState &= ~iconData->dwStateMask;
885 notifyItem->
dwState |= (iconData->dwState & iconData->dwStateMask);
895 BOOL hasSharedIcon = notifyItem->
dwState & NIS_SHAREDICON;
901 notifyItem->
hIcon = iconData->hIcon;
907 TRACE(
"Shared icon requested, but HICON not found!!! IGNORING!\n");
912 notifyItem->
hIcon = iconData->hIcon;
918 if (iconData->uFlags &
NIF_TIP)
923 if (iconData->uFlags & NIF_INFO)
929 notifyItem->
uTimeout = iconData->uTimeout;
934 SetButtonInfo(
index, &tbbi);
936 if (iconData->uFlags & NIF_INFO)
948 TRACE(
"Removing icon %d from hWnd %08x\n", iconData->uID, iconData->hWnd);
950 int index =
FindItem(iconData->hWnd, iconData->uID, ¬ifyItem);
953 TRACE(
"Icon %d from hWnd %08x ALREADY MISSING!\n", iconData->uID, iconData->hWnd);
958 if (!(notifyItem->
dwState & NIS_HIDDEN))
963 if (!(notifyItem->
dwState & NIS_SHAREDICON))
966 GetButton(
index, &btn);
967 int oldIconIndex = btn.
iBitmap;
971 int count = GetButtonCount();
977 if (btn.
iBitmap > oldIconIndex)
980 tbbi2.cbSize =
sizeof(tbbi2);
983 SetButtonInfo(
i, &tbbi2);
1016 int count = GetButtonCount();
1020 BOOL hasSharedIcon =
data->dwState & NIS_SHAREDICON;
1025 SetButtonInfo(
i, &tbbi);
1041 INT iBtn = GetHotItem();
1085 TRACE(
"Destroying icon %d with invalid handle hWnd=%08x\n", notifyItem->
uID, notifyItem->
hWnd);
1119 static LPCWSTR eventNames [] = {
1123 L"WM_LBUTTONDBLCLK",
1126 L"WM_RBUTTONDBLCLK",
1129 L"WM_MBUTTONDBLCLK",
1140 TRACE(
"Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n",
1151 INT iBtn = HitTest(&
pt);
1182 INT iBtn = GetHotItem();
1189 monInfo.
cbSize =
sizeof(monInfo);
1196 GetItemRect(iBtn, &rcItem);
1202 ptItem.
x += szItem.
cx / 2;
1203 ptItem.
y -= szTip.
cy;
1217 TRACE(
"ptItem { %d, %d }\n", ptItem.
x, ptItem.
y);
1327 WARN(
"AddTool failed, LastError=%d (probably meaningless unless non-zero)\n",
GetLastError());
1353 TRACE(
"NotifyIcon received. Code=%d\n", dwMessage);
1381 case NIM_SETVERSION:
1386 TRACE(
"NotifyIcon received with unknown code %d.\n", dwMessage);
1430 rows =
max(
size->cy / cyButton, 1);
1431 columns = (VisibleButtonCount + rows - 1) / rows;
1435 columns =
max(
size->cx / cxButton, 1);
1436 rows = (VisibleButtonCount + columns - 1) / columns;
1438 size->cx = columns * cxButton;
1439 size->cy = rows * cyButton;
1532 INT xOff = (szClient.
cx - szBar.
cx) / 2;
1533 INT yOff = (szClient.
cy - szBar.
cy) / 2;
1570 PTRAYNOTIFYDATAW
pData = (PTRAYNOTIFYDATAW)cpData->lpData;
1571 if (
pData->dwSignature == NI_NOTIFY_SIG)
1576 FIXME(
"Taskbar Load In Proc\n");
1584 if (
wParam == SPI_SETNONCLIENTMETRICS)
static BOOL OnCopyData(HWND hwnd, HWND hwndSender, COPYDATASTRUCT *pCopyData)
#define TNWM_GETMINIMUMSIZE
TaskbarSettings g_TaskbarSettings
static VOID OnTimer(IN HWND hwndDlg, IN PSYS_SHUTDOWN_PARAMS pShutdownParams)
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
BOOL GetClientRect(LPRECT lpRect) const
BOOL GetWindowRect(LPRECT lpRect) const
CWindow GetParent() const
BOOL ClientToScreen(LPPOINT lpPoint) const
static const int MinTimeout
static const int CooldownBetweenBalloons
CNotifyToolbar * m_toolbar
void RemoveInfo(InternalIconData *notifyItem)
InternalIconData * m_current
static const int TimerInterval
void SetTimer(int length)
void UpdateInfo(InternalIconData *notifyItem)
void Init(HWND hwndParent, CNotifyToolbar *toolbar, CTooltips *balloons)
void Close(IN OUT InternalIconData *notifyItem, IN UINT uReason)
static const int MaxTimeout
int IndexOf(InternalIconData *pdata)
static const int BalloonsTimerId
bool OnTimer(int timerId)
bool RemoveIconFromWatcher(_In_ CONST NOTIFYICONDATA *iconData)
bool AddIconToWatcher(_In_ CONST NOTIFYICONDATA *iconData)
CRITICAL_SECTION m_ListLock
bool Initialize(_In_ HWND hWndParent)
IconWatcherData * GetListEntry(_In_opt_ CONST NOTIFYICONDATA *iconData, _In_opt_ HANDLE hProcess, _In_ bool Remove)
static UINT WINAPI WatcherThread(_In_opt_ LPVOID lpParam)
CAtlList< IconWatcherData * > m_WatcherList
static int OnCommand(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
DWORD WINAPI GetSize(LPVOID)
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
BOOL WINAPI IsAppThemed(void)
PKSAUDIO_DEVICE_ENTRY GetListEntry(IN PLIST_ENTRY Head, IN ULONG Index)
static VOID OnSize(HWND hDlg, PDETAILDATA pData, INT cx, INT cy)
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define COM_INTERFACE_ENTRY_IID(iid, x)
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
#define DECLARE_NOT_AGGREGATABLE(x)
#define MESSAGE_HANDLER(msg, func)
#define NOTIFY_CODE_HANDLER(cd, func)
#define BEGIN_MSG_MAP(theClass)
#define MESSAGE_RANGE_HANDLER(msgFirst, msgLast, func)
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
_In_ BOOL _In_ HANDLE hProcess
static BOOL Uninitialize(LPCWSTR lpDriverPath)
static PROTOCOLDATA * pdata
static VOID SetImageList(HWND hwnd)
unsigned __int3264 UINT_PTR
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
const GUID IID_IOleWindow
_Out_opt_ int _Out_opt_ int * cy
#define CDDS_ITEMPREPAINT
#define CDRF_NOTIFYITEMDRAW
#define TTTOOLINFOW_V1_SIZE
#define TBCDRF_NOBACKGROUND
#define TBSTYLE_TRANSPARENT
#define TBMF_BUTTONSPACING
#define TBCDRF_NOETCHEDEFFECT
#define ImageList_AddIcon(himl, hicon)
#define CCS_NOPARENTALIGN
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
NOTIFYICONDATAA NOTIFYICONDATA
Info(InternalIconData *source)
InternalIconData * pSource
base of all file and directory entries
IconWatcherData(CONST NOTIFYICONDATA *iconData)
TrayIconsMode eCompactTrayIcons
BOOL UseCompactTrayIcons()
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
#define TABDMC_LOADINPROC
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
static LRESULT OnDestroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MAXIMUM_WAIT_OBJECTS
DWORD WINAPI GetCurrentProcessId(void)
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define SubclassWindow(hwnd, lpfn)
BOOL WINAPI SendNotifyMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT
HWND WINAPI GetDesktopWindow(void)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SendNotifyMessage
int WINAPI GetSystemMetrics(_In_ int)
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)