After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 340110 - invisible status icon takes up space
invisible status icon takes up space
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkStatusIcon
2.11.x
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
: 404558 591189 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-29 12:39 UTC by Christian Persch
Modified: 2011-06-01 05:44 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
add property editor to teststatusicon (2.45 KB, text/plain)
2006-04-29 12:39 UTC, Christian Persch
  Details
proposed patch (13.64 KB, patch)
2006-12-22 15:53 UTC, Christian Persch
none Details | Review

Description Christian Persch 2006-04-29 12:39:31 UTC
When setting a status icon to invisible, it still takes 1 or 2 px in the notification area, which looks ugly. Maybe it should de-embed itself in this case?

Steps to reproduce:
0) Apply attached patch to teststatusicon
1) Right-click the status icon, Properties...
2) Set "visible" property to false
Comment 1 Christian Persch 2006-04-29 12:39:59 UTC
Created attachment 64518 [details]
add property editor to teststatusicon
Comment 2 Christian Persch 2006-12-22 15:53:31 UTC
Created attachment 78795 [details] [review]
proposed patch

This patch fixes this bug, by making the tray icon unrealized instead of just hidden when the status icon is set to invisible.

This approach also fixes all of the following problems I noticed while playing around with testtray and teststatusicon:
- icons on screens != default wouldn't dock correctly (missing setting the manager window to None in unrealize)
- when redocking succeeded, sometimes the icon would have the wrong dimensions (just 1px wide)
- when the tray exited uncleanly (crash), the icon would show in a toplevel of its own (mentioned in bug 160132 comment 25).
Comment 3 Matthias Clasen 2006-12-22 16:47:43 UTC
so, this has 2 flaws:

1) It seems to miss some notification for the new embedded property on the statusicon. If I toggle the visibility of the statusicon with this patch,
I get "embedded changed to 1" when making it visible, but no
"embedded changed to 0" when hiding it.

2) More seriously, this makes icons rearrange in the tray as they become
visible and invisible, which is confusing. Just try it, run two instances of
teststatusicon, make them show different images, then toggle the visibility
of the right one. It will jump to the left. Msybe we can avoid that by
just unmapping instead of unrealizing.
Comment 4 Christian Persch 2006-12-22 20:32:48 UTC
1) was a bug in GtkPlug, I have a patch that I filed in bug 388738.

I don't think 2) is a bug at all. When the notification disappears (whether removed altogether or just set to invisible) and then another appears (whether a new one or just the old one set visible), it's a new notification for the user, and the tray will add it to whererever new ones are added.

Just unmapping the widget won't work since the current code gtk_widget_hide()s the tray and hiding does an unmap already.
Comment 5 Christian Persch 2006-12-22 20:44:19 UTC
(sorry, I unintentionally changed the patch status, resetting)
Comment 6 Matthias Clasen 2007-01-27 05:53:11 UTC
2007-01-27  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkstatusicon.c:
        * gtk/gtktrayicon-x11.c: Fix GtkStatusIcon to not
        take up space on the panel if it is invisible.  (340110, Christian
        Persch)

        * tests/teststatusicon.c:
        * tests/Makefile.am: Updates

Comment 7 Vincent Untz 2007-02-17 18:44:11 UTC
*** Bug 404558 has been marked as a duplicate of this bug. ***
Comment 8 Alexander “weej” Jones 2007-03-18 02:44:12 UTC
Is this going to be backported to 2.10, or will it stay in Trunk?
Comment 9 Matthias Clasen 2007-03-18 02:49:23 UTC
Reopening
Comment 10 Alexander “weej” Jones 2007-08-07 13:17:49 UTC
Still experiencing this in Gutsy. GTK 2.11.6
Comment 11 Christian Persch 2007-08-15 21:13:14 UTC
Alex: I can't reproduce this with gtk svn. Are you sure the status icons of the programmes you see this with are actually using gtkstatusicon?
Comment 12 Alexander “weej” Jones 2007-08-15 22:09:27 UTC
import gtk

s = {}

for i in range(0, 100):
    s[i] = gtk.status_icon_new_from_icon_name("sound")
    s[i].set_visible(False)

gtk.main()


It's even worse now than it was before, because the space is no longer freed even when the program exits.
Comment 13 Christian Persch 2007-08-16 22:02:05 UTC
I can see the bug with your test programme, but I cannot see it in teststatusicon when switching visibility on/off using the prop editor.
Comment 14 Alexander “weej” Jones 2007-08-17 01:10:41 UTC
Try running 100 prop editors and turning their visibilities off.

(Ubuntu seems to want to have, at any one time, like 3 or 4 hidden status icons for various things like power manager, update manager. However, even just ONE hidden status icon taking up 1 pixel is still a bug.)
Comment 15 Dmitry Agafonov 2008-02-26 08:28:32 UTC
I can confirm for GNOME gnome-panel 2.20.1 (Ubuntu 7.10 Gutsy, updated)
See screenshot: http://agafonov.pp.ru/bugz/notifyarea.png
Comment 16 Alexander “weej” Jones 2008-02-27 13:48:38 UTC
Indeed, this is still affecting GNOME 2.21 (Ubuntu 8.04 Hardy). The test case in Comment #12 creates loads of space and doesn't free it after it closes, still.
Comment 17 Matthias Clasen 2008-02-27 21:10:04 UTC
If it doesn't free it after close, it has to be a panel bug.
Comment 18 Alexander “weej” Jones 2008-02-27 21:51:33 UTC
Right. But it's still creating the space in the first place :)
Comment 19 Matthias Clasen 2008-10-31 05:26:10 UTC
Still a panel bug, I'd say
Comment 20 Diego Escalante Urrelo (not reading bugmail) 2009-08-10 07:46:50 UTC
*** Bug 591189 has been marked as a duplicate of this bug. ***
Comment 21 Diego Escalante Urrelo (not reading bugmail) 2009-08-10 07:49:52 UTC
Just noticed this is the origin of a bug in epiphany, our download notification icon leaves 'blank space'.
I have no clue if this is GTK+ or the panel applet, but the 'solution' for me was to call gtk_status_icon_set_visible (icon, FALSE).

I would blame Vincent. Any idea? :^)
Comment 22 Vincent Untz 2009-08-10 07:58:51 UTC
That would probably be bug 589860, where I attached a test case. Apparently, the notification area never receives the right signal.
Comment 23 Pascal Terjan 2009-08-10 20:23:55 UTC
(In reply to comment #16)
> Indeed, this is still affecting GNOME 2.21 (Ubuntu 8.04 Hardy). The test case
> in Comment #12 creates loads of space and doesn't free it after it closes,
> still.

I tried it on pygtk 2.15.2, the space is allocated on new (black vertical bar) but removed on set_visible(False) so it just makes the black bar blink and things move until it finishes the loop, so the original bug looks fixed now: invisible icons do not take space
Comment 24 Matthias Clasen 2011-06-01 05:44:09 UTC
I believe this was fixed in gnome-panel tray implementation for 3.0