33 #include "../notifyhook/notifyhook.h" 95 #define NID_SIZE_W6 sizeof(NOTIFYICONDATAW) // _WIN32_IE = 0x600 96 #define NID_SIZE_W5 (sizeof(NOTIFYICONDATAW)-sizeof(GUID)) // _WIN32_IE = 0x500 97 #define NID_SIZE_W3 (sizeof(NOTIFYICONDATAW)-sizeof(GUID)-(128-64)*sizeof(WCHAR)) // _WIN32_IE < 0x500 100 #define NID_SIZE_A6 sizeof(NOTIFYICONDATAA) 101 #define NID_SIZE_A5 (sizeof(NOTIFYICONDATAA)-sizeof(GUID)) 102 #define NID_SIZE_A3 (sizeof(NOTIFYICONDATAA)-sizeof(GUID)-(128-64)*sizeof(CHAR)) 133 if (pnid->
uFlags & NIF_STATE) {
153 for(;
l<max_len; ++
l)
157 new_text.assign(txt,
l);
168 for(
int l=0;
l<max_len; ++
l)
172 new_text.assign(txt,
l);
225 HKEY hkeyStuckRects = 0;
229 bool hide_clock =
false;
235 hide_clock =
buffer[2] & 0x08?
true:
false;
245 bool clock_visible =
true;
252 if (cfg_pos.go_down(
"desktopbar")) {
258 if (cfg_pos.go_down(
"notify-icons")) {
259 XMLPos
options(cfg_pos,
"options");
265 XMLChildrenFilter icons(cfg_pos,
"icon");
268 const XMLNode&
node = **it;
276 const string&
mode =
node.get(
"show");
280 else if (
mode ==
"hide")
299 cfg_pos.smart_create(
"desktopbar");
300 XMLBoolRef boolRef(XMLPos(cfg_pos,
"options"),
"show-clock");
304 cfg_pos.smart_create(
"notify-icons");
306 XMLPos
options(cfg_pos,
"options");
315 cfg_pos.smart_create(
"icon",
"name", cfg.
_name);
320 cfg_pos[
"name"] = cfg.
_name.c_str();
321 cfg_pos[
"text"] = cfg.
_tipText.c_str();
425 menu.TrackPopupMenu(_hwnd,
p);
442 #ifdef WM_XBUTTONDOWN
443 || nmsg==WM_XBUTTONDOWN
458 #ifdef WM_XBUTTONDOWN
459 nmsg == WM_XBUTTONDOWN ||
470 #ifdef WM_XBUTTONDOWN
471 nmsg == WM_XBUTTONDOWN ||
484 (*AllowSetForegroundWindow)(
pid);
564 pdi->lpszText =
entry._tipText.str();
582 switch(notify_code) {
585 if ((
int)pnid->
uID >= 0) {
589 if (
entry._idx == -1)
606 entry._dwState |= NIS_HIDDEN;
621 if (found->second._hIcon)
637 found->second._version = pnid->UNION_MEMBER(uVersion);
672 while(tt_idx < icon_cnt) {
691 #ifndef _NO_ALPHABLEND 693 #pragma comment(lib, "msimg32") // for AlphaBlend() 699 BufferedPaintCanvas canvas(_hwnd);
716 #ifndef _NO_ALPHABLEND 724 #ifndef _NO_ALPHABLEND 725 if (it->_dwState & NIS_HIDDEN) {
728 AlphaBlend(canvas,
x,
y,
NOTIFYICON_SIZE,
NOTIFYICON_SIZE, mem_dc, 0, 0,
NOTIFYICON_SIZE,
NOTIFYICON_SIZE, blend);
757 switch(
entry._mode) {
759 if (!(
entry._dwState & NIS_HIDDEN)) {
760 entry._dwState |= NIS_HIDDEN;
766 if (
entry._dwState&NIS_HIDDEN) {
767 entry._dwState &= ~NIS_HIDDEN;
775 if (!(
entry._dwState & NIS_HIDDEN))
777 entry._dwState |= NIS_HIDDEN;
839 if (
entry._modulePath.empty()) {
843 if (!modulePath.empty())
844 entry._modulePath = modulePath;
900 WindowCanvas canvas(_hwnd);
964 tv.pszText = str_cur.str();
965 tv.iSelectedImage = tv.iImage = 0;
969 tv.pszText = str_conf.str();
970 tv.iSelectedImage = tv.iImage = 2;
976 tv.pszText = str_visible.str();
977 tv.iSelectedImage = tv.iImage = 0;
981 tv.pszText = str_hidden.str();
982 tv.iSelectedImage = tv.iImage = 1;
990 WindowCanvas canvas(_hwnd);
1054 FmtString txt(
TEXT(
"%s - %s [%s]"),
entry._tipText.c_str(),
entry._windowTitle.c_str(), mode_str.c_str());
1058 tvi.hParent = hparent;
1059 tvi.hInsertAfter =
after;
1065 tv.pszText = txt.str();
1131 info._mode = it->second.first;
1132 info._dwState = it->second.second;
1150 switch(pnmh->
code) {
1153 int idx = pnmtv->itemNew.lParam;
1181 if (
entry._lastChange)
1188 if (!hicon && !
entry._modulePath.empty()) {
1274 SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 };
1281 int clockwindowWidth =
rect.right-
rect.left + 4;
1285 clnt.right-(clockwindowWidth), 1, clockwindowWidth, clnt.bottom-2,
hwndParent);
1319 pdi->szText[0] =
'\0';
1346 PaintCanvas canvas(_hwnd);
#define WINDOW_CREATOR(WND_CLASS)
#define TranslateAccelerator
void push_back(const_reference __x)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
LRESULT ProcessTrayNotification(int notify_code, NOTIFYICONDATA *pnid)
HTREEITEM _hitemCurrent_visible
#define IDC_NOTIFY_AUTOHIDE
static UINT WM_GETMODULEPATH
GLubyte GLubyte GLubyte GLubyte w
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
add icon with alpha channel to imagelist using the specified background color
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
bool match(const NotifyIconConfig &props) const
#define IDS_SHOW_HIDDEN_ICONS
virtual int Command(int id, int code)
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define ID_SHOW_HIDDEN_ICONS
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define TreeView_DeleteAllItems(hwnd)
BOOL WINAPI DestroyIcon(_In_ HICON)
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
GLsizei const GLchar ** path
#define LOCALE_USER_DEFAULT
#define HKEY_CURRENT_USER
TW_UINT32 TW_UINT16 TW_UINT16 MSG
virtual LRESULT Init(LPCREATESTRUCT pcs)
DECL_NOTIFYHOOK int GetWindowModulePathCopyData(LPARAM lparam, HWND *phwnd, LPSTR buffer, int size)
#define ID_CONFIG_NOTIFYAREA
void GetModulePath(HWND hwnd, HWND hwndCallback)
BOOL WINAPI UpdateWindow(_In_ HWND)
static void register_pretranslate(HWND hwnd)
DWORD WINAPI GetTickCount(VOID)
#define PM_REFRESH_CONFIG
const UINT WM_GETMODULEPATH
#define IDS_ITEMS_VISIBLE
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
GLint GLint GLint GLint GLint x
DWORD WINAPI GetMessagePos(void)
#define TVIF_SELECTEDIMAGE
String string_from_mode(NOTIFYICONMODE mode)
NotifyIconDlgInfoMap _info
BOOL WINAPI AllowSetForegroundWindow(DWORD dwProcessId)
int Notify(int id, NMHDR *pnmh)
BOOL WINAPI DestroyWindow(_In_ HWND)
void Add(UINT id, int flags)
_Rep_type::const_iterator const_iterator
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static HWND Create(HWND hwndParent)
void show_clock(bool flag)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
NotifyIconSet::iterator IconHitTest(const POINT &pos)
search for a icon at a given client coordinate position
#define TreeView_InsertItem(hwnd, lpis)
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
void SetIconMode(NOTIFYICONMODE mode)
static UINT WPARAM LPARAM lparam
BOOL launch_cpanel(HWND hwnd, LPCTSTR applet)
NotifyIconSet _sorted_icons
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo &, HDC)
#define IDS_ITEMS_CONFIGURED
configuration for the display mode of a notification icon
map< HWND, String > _window_modules
void DeinstallNotifyHook()
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
pair< iterator, bool > insert(const value_type &__x)
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
window for displaying the time in the tray notification area
#define TreeView_SetImageList(hwnd, himl, iImage)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDS_NOTIFY_AUTOHIDE
#define PM_GET_NOTIFYAREA
convenient loading of small (16x16) icon resources
_STLP_PRIV _List_iterator< NotifyIconConfig, _Const_traits< NotifyIconConfig > > const_iterator
HTREEITEM _hitemCurrent_hidden
void erase(iterator __pos)
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
#define PM_RESIZE_CHILDREN
#define ICON_AUTOHIDE_SECONDS
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
_Rep_type::iterator iterator
#define IDC_NOTIFY_MODULE
LRESULT Init(LPCREATESTRUCT pcs)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
window class with gray background color
int WINAPI GetSystemMetrics(_In_ int)
static void unregister_pretranslate(HWND hwnd)
tray notification area aka "tray"
#define TTM_SETMAXTIPWIDTH
structure for maintaining informations about one notification icon
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
virtual int Notify(int id, NMHDR *pnmh)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
static bool get_hide_clock_from_registry()
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
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 flag
_STLP_PRIV _List_iterator< NotifyIconConfig, _Nonconst_traits< NotifyIconConfig > > iterator
#define CLASSNAME_CLOCKWINDOW
ExplorerGlobals g_Globals
NotifyArea * _pNotifyArea
__inline int after(__u32 seq1, __u32 seq2)
bool modify(NOTIFYICONDATA *pnid)
bool DetermineHideState(NotifyInfo &entry)
WDF_CHILD_LIST_ITERATOR iterator
int Notify(int id, NMHDR *pnmh)
#define CLASSNAME_TRAYNOTIFY
IconStateMap _icon_states_org
void SetWindowIcon(HWND hwnd, UINT nid)
set big and small icons out of the resources for a window
HWND WINAPI GetParent(_In_ HWND)
#define TreeView_EnsureVisible(hwnd, hitem)
static HWND Create(HWND hwndParent)
#define GET_WINDOW(CLASS, hwnd)
#define NOTIFYAREA_WIDTH_DEF
ResizeManager _resize_mgr
GLint GLint GLint GLint GLint GLint y
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IDC_NOTIFY_TOOLTIP
static const WCHAR props[]
_Rep_type::const_iterator const_iterator
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
int Command(int id, int code)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
LRESULT SendParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
void RefreshProperties(const NotifyIconDlgInfo &entry)
bool ModulePathCopyData(LPARAM lparam, HWND *phwnd, String &path)
convenient loading of string resources
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define ID_SHOW_ICON_BUTTON
void Refresh(bool do_refresh=false)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
#define TreeView_Expand(hwnd, hitem, code)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
DWORD WINAPI SHRestricted(RESTRICTIONS policy)
#define RegCloseKey(hKey)
configuration dialog for notification icons
_Rep_type::iterator iterator
DWORD WINAPI GetCurrentProcessId(VOID)
NotifyIconCfgList _cfg_org
static UINT WPARAM wparam
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
void Resize(int dx, int dy)