Merge branch 'fix-issue-2030' into 'gtk-3-24'

GtkStatusIcon/w32: Misc fixes for the handling of taskbar_created_msg

See merge request GNOME/gtk!1003
This commit is contained in:
Matthias Clasen
2019-08-02 16:58:25 +00:00

View File

@ -735,25 +735,25 @@ wndproc (HWND hwnd,
GtkStatusIcon *status_icon = GTK_STATUS_ICON (rover->data); GtkStatusIcon *status_icon = GTK_STATUS_ICON (rover->data);
GtkStatusIconPrivate *priv = status_icon->priv; GtkStatusIconPrivate *priv = status_icon->priv;
/* taskbar_created_msg is also fired when DPI changes. Try to delete existing icons if possible. */ if (priv->visible)
if (!Shell_NotifyIconW (NIM_DELETE, &priv->nid)) {
{ /* taskbar_created_msg is also fired when DPI changes. Try to delete existing icons if possible. */
g_warning (G_STRLOC ": Shell_NotifyIcon(NIM_DELETE) on existing icon failed"); if (priv->nid.hWnd)
} if (!Shell_NotifyIconW (NIM_DELETE, &priv->nid))
g_warning (G_STRLOC ": Shell_NotifyIcon(NIM_DELETE) on existing icon failed");
priv->nid.hWnd = hwnd; priv->nid.hWnd = hwnd;
priv->nid.uID = status_icon_id++; priv->nid.uFlags &= ~NIF_ICON;
priv->nid.uCallbackMessage = WM_GTK_TRAY_NOTIFICATION;
priv->nid.uFlags = NIF_MESSAGE;
if (!Shell_NotifyIconW (NIM_ADD, &priv->nid)) if (!Shell_NotifyIconW (NIM_ADD, &priv->nid))
{ {
g_warning (G_STRLOC ": Shell_NotifyIcon(NIM_ADD) failed"); g_warning (G_STRLOC ": Shell_NotifyIcon(NIM_ADD) failed");
priv->nid.hWnd = NULL; priv->nid.hWnd = NULL;
continue; continue;
} }
gtk_status_icon_update_image (status_icon); gtk_status_icon_update_image (status_icon);
}
} }
return 0; return 0;
} }