[Users] [Bug 3922] minimize to tray on startup not working

noreply at thewildbeast.co.uk noreply at thewildbeast.co.uk
Mon Jun 22 15:55:53 CEST 2020


https://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=3922

--- Comment #18 from Daniel Kirchner <daniel at ekpyron.org> ---
Ok, I had another look at the code itself and I have a better idea what happens
now:

"plugin_init" in "notification_plugin.c" creates the trayicon early, if there
are messages:

  if(notify_config.urgency_hint_new || notify_config.urgency_hint_unread)
        notification_update_msg_counts(NULL);

notification_update_msg_counts will ultimately create the tray icon, if it
doesn't exist yet.

It also adds an idle callback:

  g_idle_add(trayicon_startup_idle,NULL);

Which looks like this:

static gboolean trayicon_startup_idle(gpointer data)
{
        /* if the trayicon is not available,
                 simulate click on it to show mainwindow */
        if(!notification_trayicon_is_available())
                notification_trayicon_on_activate(NULL,data);
        return FALSE;
}


So when the main event loop starts, this simulates a click on the tray icon, if
"notification_trayicon_is_available" returns false.

Now "notification_trayicon_is_available" in "notification_trayicon.c" checks
for "trayicon" to be non-NULL, but also for
"gtk_status_icon_is_embedded(trayicon)" and
"gtk_status_icon_get_visible(trayicon)".

While "trayicon" is not NULL and "gtk_status_icon_get_visible(trayicon)" is
TRUE in the problematic cases, "gtk_status_icon_is_embedded(trayicon)" does
return FALSE.
Consequently "notification_trayicon_is_available" returns FALSE and
"trayicon_startup_idle" simulates a click on the tray icon causing the window
to pop up.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Users mailing list