[gtk+/gtk-2-16] Bug 609622 - disappearing statusicon
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-16] Bug 609622 - disappearing statusicon
- Date: Sun, 7 Nov 2010 20:33:25 +0000 (UTC)
commit ae0544c636c72753098b698e4951897c609a75b6
Author: Hans Breuer <hans breuer org>
Date: Sun Nov 7 21:19:48 2010 +0100
Bug 609622 - disappearing statusicon
Windows 7 is managing status icon visibility across process lifetime,
which did not work with GTK+ create icons. Apparently the mechanism
does not require use of new API (like suggested by MSDN), but it is
enough to give a "unique" tooltip at creation time.
Formerly this initial tooltip was not set at all, later setting via
gtk_status_icon_set_tooltip_text() is not enough, but luckily
different follow-up tooltips don't disturb the intended behavior.
gtk/gtkstatusicon.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c
index 3e89f53..2319154 100644
--- a/gtk/gtkstatusicon.c
+++ b/gtk/gtkstatusicon.c
@@ -876,6 +876,17 @@ gtk_status_icon_init (GtkStatusIcon *status_icon)
priv->nid.uCallbackMessage = WM_GTK_TRAY_NOTIFICATION;
priv->nid.uFlags = NIF_MESSAGE;
+ /* To help win7 identify the icon create it with an application "unique" tip */
+ if (g_get_prgname ())
+ {
+ WCHAR *wcs = g_utf8_to_utf16 (g_get_prgname (), -1, NULL, NULL, NULL);
+
+ priv->nid.uFlags |= NIF_TIP;
+ wcsncpy (priv->nid.szTip, wcs, G_N_ELEMENTS (priv->nid.szTip) - 1);
+ priv->nid.szTip[G_N_ELEMENTS (priv->nid.szTip) - 1] = 0;
+ g_free (wcs);
+ }
+
if (!Shell_NotifyIconW (NIM_ADD, &priv->nid))
{
g_warning ("%s:%d:Shell_NotifyIcon(NIM_ADD) failed", __FILE__, __LINE__-2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]