Alexandre Julliard : explorer: Store information needed for the info balloon in the tray icon structure.
Alexandre Julliard
julliard at winehq.org
Wed Dec 15 11:30:01 CST 2010
Module: wine
Branch: master
Commit: d2e047612ca0be331c14f89afe7d6549626b726b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2e047612ca0be331c14f89afe7d6549626b726b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Dec 15 16:31:12 2010 +0100
explorer: Store information needed for the info balloon in the tray icon structure.
---
programs/explorer/systray.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c
index 0acf95e..1b55664 100644
--- a/programs/explorer/systray.c
+++ b/programs/explorer/systray.c
@@ -65,10 +65,16 @@ struct icon
HICON image; /* the image to render */
HWND owner; /* the HWND passed in to the Shell_NotifyIcon call */
HWND tooltip; /* Icon tooltip */
+ UINT state; /* state flags */
UINT id; /* the unique id given by the app */
UINT callback_message;
int display; /* index in display list, or -1 if hidden */
WCHAR tiptext[128]; /* Tooltip text. If empty => tooltip disabled */
+ WCHAR info_text[256]; /* info balloon text */
+ WCHAR info_title[64]; /* info balloon title */
+ UINT info_flags; /* flags for info balloon */
+ UINT info_timeout; /* timeout for info balloon */
+ HICON info_icon; /* info balloon icon */
};
static struct list icon_list = LIST_INIT( icon_list );
@@ -84,6 +90,9 @@ static int icon_cx, icon_cy, tray_width;
#define MIN_DISPLAYED 8
#define ICON_BORDER 2
+#define BALLOON_SHOW_MIN_TIMEOUT 10000
+#define BALLOON_SHOW_MAX_TIMEOUT 30000
+
/* Retrieves icon record by owner window and ID */
static struct icon *get_icon(HWND owner, UINT id)
{
@@ -252,10 +261,9 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid )
return FALSE;
}
- if ((nid->uFlags & NIF_STATE) && (nid->dwStateMask & NIS_HIDDEN))
+ if (nid->uFlags & NIF_STATE)
{
- if (nid->dwState & NIS_HIDDEN) hide_icon( icon );
- else show_icon( icon );
+ icon->state = (icon->state & ~nid->dwStateMask) | (nid->dwState & nid->dwStateMask);
}
if (nid->uFlags & NIF_ICON)
@@ -276,8 +284,14 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid )
}
if (nid->uFlags & NIF_INFO && nid->cbSize >= NOTIFYICONDATAA_V2_SIZE)
{
- WINE_FIXME("balloon tip title %s, message %s\n", wine_dbgstr_w(nid->szInfoTitle), wine_dbgstr_w(nid->szInfo));
+ lstrcpynW( icon->info_text, nid->szInfo, sizeof(icon->info_text)/sizeof(WCHAR) );
+ lstrcpynW( icon->info_title, nid->szInfoTitle, sizeof(icon->info_title)/sizeof(WCHAR) );
+ icon->info_flags = nid->dwInfoFlags;
+ icon->info_timeout = max(min(nid->u.uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT);
+ icon->info_icon = nid->hBalloonIcon;
}
+ if (icon->state & NIS_HIDDEN) hide_icon( icon );
+ else show_icon( icon );
return TRUE;
}
@@ -308,10 +322,7 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
if (list_empty( &icon_list )) SetTimer( tray_window, 1, 2000, NULL );
list_add_tail(&icon_list, &icon->entry);
- modify_icon( icon, nid );
- /* show icon, unless hidden state was explicitly specified */
- if (!((nid->uFlags & NIF_STATE) && (nid->dwStateMask & NIS_HIDDEN))) show_icon( icon );
- return TRUE;
+ return modify_icon( icon, nid );
}
/* Deletes tray icon window and icon record */
More information about the wine-cvs
mailing list