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 413360 - After loading gnome gpm starts but shows nothing in tray icon despite option
After loading gnome gpm starts but shows nothing in tray icon despite option
Status: RESOLVED FIXED
Product: gnome-power-manager
Classification: Deprecated
Component: general
2.17.x
Other All
: Normal major
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
: 474321 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-03-01 08:06 UTC by Maciej (Matthew) Piechotka
Modified: 2007-11-10 08:50 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
grep gpm .xsession-errors (6.24 KB, text/plain)
2007-03-02 23:49 UTC, Maciej (Matthew) Piechotka
  Details
gnome-power-manager --verbose (6.49 KB, application/octet-stream)
2007-03-13 12:10 UTC, Maciej (Matthew) Piechotka
  Details
Script which resolve this bug with an ugly hack (303 bytes, text/plain)
2007-10-28 15:34 UTC, Shogun
  Details
Fix the XEvent handling in gpm_button_filter_x_events (1.27 KB, patch)
2007-11-09 07:24 UTC, Mart Raudsepp
none Details | Review
Patch that was committed (1.37 KB, patch)
2007-11-09 09:37 UTC, Mart Raudsepp
none Details | Review

Description Maciej (Matthew) Piechotka 2007-03-01 08:06:08 UTC
Please describe the problem:
After log into gnome gpm icon do not show in spite of option show always.
'pkill gnome-power-manager && gnome-power-manager' solves the problem.

Steps to reproduce:
1. Log into gnome


Actual results:
No iccons appears. However pgrep gnome-power shows it runs.

Expected results:
Icon in tray icon

Does this happen every time?
Nearly every

Other information:
Portage 2.1.2-r12 (default-linux/x86/2006.1/desktop, gcc-4.1.2, glibc-2.5-r0, 2.6.20-beyond1 i686)
=================================================================
System uname: 2.6.20-beyond1 i686 Intel(R) Celeron(R) M processor         1.50GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Thu, 01 Mar 2007 06:00:02 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-java/java-config: 1.3.7, 2.0.31-r3
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.20-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -march=pentium-m -mmmx -msse -msse2 -mfpmath=sse -pipe -momit-leaf-frame-pointer -ggdb"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-Os -march=pentium-m -mmmx -msse -msse2 -mfpmath=sse -pipe -momit-leaf-frame-pointer -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer parallel-fetch sandbox sfperms splitdebug userfetch userpriv"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,--as-needed -Wl,-O1"
LINGUAS="en_GB en_US pl"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-* --prune-empty-dirs"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/gentopia /usr/portage/local/layman/java-gcj-overlay /usr/portage/local/layman/java-experimental /usr/portage/local/layman/java-migration-packages /usr/portage/local/layman/ecatmur /usr/portage/local/layman/gnome-experimental /usr/portage/local/layman/sunrise /usr/portage/local/layman/custom-kernels /usr/portage/local/layman/bmg /usr/local/portage /usr/local/overlays/evolution-sharp-server-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac acl acpi aiglx alsa applet avalon bash-completion beagle berkdb bitmap-fonts bluetooth boo browseplugin bzip2 cairo calendar caps cddb cdparanoia cdr cli cracklib crypt cups curl curlwrappers dbus disk-partition djvu dri dvd dvdr eclipse eds emacs emboss encode esd evolution exif expat fam ffmpeg firefox flac flash fortran fuse galago gcj gconf gdbm gdl gedit gif gimp glut gmail gmp gnome gnutls gphoto2 gpm gsf gstreamer gstreamer10 gtk gtk2 gtkhtml hal iconv idle imap ipod iproute2 ipv6 isdnlog jabber java jpeg jpeg2k jython keyring libburn libg++ libgda libnotify libsexy logrotate lucene mad madwifi maildir mhash midi mikmod mmap mmx mono mozilla mp3 mpeg mule musicbrainz nautilus ncurses network networkmanager nfs nls nntp no-old-linux nptl nptlonly nsplugin ntpl ogg oggvorbis openal opengl pam pango pbm pcmcia pcre pdf perl png pop postgres ppds pppd python quicktime readline reflection reiserfs rhino ruby samba scanner sdl session soap sourceview spell spl sqlite sse sse2 ssh ssl subversion svg symlink syslog tcpd tetex theora threads totem trayicon truetype truetype-fonts type1-fonts unicode usb vorbis wifi x86 xcomposite xforms xhtml xml xml2 xorg xsl xulrunner xv zlib" ALSA_CARDS="atiixp" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" CAMERAS="panasonic" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB en_US pl" USERLAND="GNU" VIDEO_CARDS="radeon"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Richard Hughes 2007-03-01 20:50:28 UTC
Can you get the "gnome-power-manager --verbose --no-daemon" output on login please, i.e. where no icon is shown.

Thanks.
Comment 2 Maciej (Matthew) Piechotka 2007-03-01 21:14:36 UTC
I.e. in session configuration. I'll send it when I relog.
Comment 3 Maciej (Matthew) Piechotka 2007-03-02 23:49:27 UTC
Created attachment 83774 [details]
grep gpm .xsession-errors
Comment 4 Maciej (Matthew) Piechotka 2007-03-02 23:51:31 UTC
Unfortunatly when I tried to add strem redirection it worked ok.
Comment 5 Richard Hughes 2007-03-04 12:31:00 UTC
I need the log on a failed startup else it's impossible to debug. Thanks.
Comment 6 Maciej (Matthew) Piechotka 2007-03-09 14:17:50 UTC
It creates no file with redirection - sorry (and after restart it's always ok).
Comment 7 Maciej (Matthew) Piechotka 2007-03-13 12:10:20 UTC
Created attachment 84499 [details]
gnome-power-manager --verbose

I guess it could be this
Comment 8 Maciej (Matthew) Piechotka 2007-03-13 12:11:06 UTC
Sorry I forgot to change NEEDINFO
Comment 9 Richard Hughes 2007-03-15 16:53:08 UTC
>[get_stock_id] gpm-tray-icon.c:680 (15:09:46):	 Trying CRITICAL icon: primary, ups, mouse, keyboard
>[get_stock_id] gpm-tray-icon.c:704 (15:09:46):	 Trying CHARGING icon: primary, ups
>[get_stock_id] gpm-tray-icon.c:721 (15:09:46):	 Trying PRESENT icon: primary, ups
>[get_stock_id] gpm-tray-icon.c:731 (15:09:46):	 no devices present, so no icon will be displayed.
>[gpm_tray_icon_sync] gpm-tray-icon.c:763 (15:09:46):	 Going to use stock id: (null)

That's the reason. I'm not sure why. I'll test it on VMWare tonight.
Comment 10 David Li 2007-03-17 20:35:16 UTC
Okay, I used to have this problem and after this bug I tried a few things to get rid of it. It seems like if I remove power related applets from my panels (inhibit, cpu scale, etc.) then the notification icon magically works on login. Strangely enough, if I add the applets back, it still works.

I guess what was happening was that the power-related applets were starting the manager before the notification tray applet started. I think this is related another bug trying to fix a problem with restarting the panel and making the power manager icon add itself back.
Comment 11 Richard Hughes 2007-03-17 20:44:48 UTC
Ahh, that could be it. g-p-m auto-starts if you start a program that uses the interface so there could be a race here.

Can you try to do "rm /etc/dbus-1/system.d/gnome-power-manager.conf" as root and then try to reproduce?

Cheers for debugging this.
Comment 12 David Li 2007-03-17 21:28:06 UTC
Okay, scratch my speculation above about applet loading order. The problem seems to be gnome-session starting gnome-power-manager via .config/autostart. Also, the bug I was talking about was bug #375377
Comment 13 Shogun 2007-03-19 19:53:59 UTC
This happens to me, too. Gentoo 2006.1 with GNOME 2.18
Comment 14 Richard Hughes 2007-04-09 21:15:42 UTC
David/Paolo, could you try trunk for me please? I've got a few fixes in there that might need backporting. Thanks.
Comment 15 Maciej (Matthew) Piechotka 2007-05-18 09:24:04 UTC
Still Gentoo 2007.0 with Gnome 2.18.1 and GPM 2.19.1
Comment 16 Cosimo Cecchi 2007-07-18 12:58:53 UTC
It is still there, I'm using Gentoo, with Gnome 2.19.5 and gnome-power-manager 2.19.5.
I think it is some kind of race condition, using a session script that adds a "sleep X" (i use "sleep 15") before g-p-m solves it for me.
Comment 17 Luis Medinas 2007-08-01 03:53:56 UTC
Richard need more info about this bug ? The only way to work around this is to kill g-p-m and then restart it again after the gnome-session load. I would like to backport this fix if it's fixed on trunk to 2.18 so we can merge it on our stable release at Gentoo.

Comment 18 Mart Raudsepp 2007-08-01 03:56:26 UTC
According to my debugging this seems more of a GtkStatusIcon or notification area bug.
In case of the g-p-m icon, it doesn't handle the PropertyNotify on the X Selection for the notification manager deep down in GtkStatusIcon code (actually lower-level gtktrayicon-x11.c backend code) or it just isn't notifying for some reason (if it isn't selected or anything like that).
I'll try to look into this further again later this week, but I'd appreciate any help.
There are also some other bugs (most filed against gtk+) that possibly describe this very same issue.
I'll provide bug numbers for those soon, and some additional information I gathered during GUADEC as soon as I can reserve some time for doing so.
By the way, in Gentoo we can also reproduce the problem by removing the notification area applet and re-adding it.
Comment 19 Andrew Cowie 2007-08-16 06:43:00 UTC
I can confirm that removing the notification area and then re-adding it results in gnome-power-manager's icon vanishing. Can't say whether that's due to a Gentoo  issue (we must be doing _something_ wrong) or gnome-power-manager issue, but it's definitely reproducible and still extant (ie, I still have to kill gnome-power-manager manually every time I log in if I want to see the icon).

Interestingly, gnome-power-statistics still reports data even though the icon isn't there. Unfortunately, when I go off AC and want the icon up & subsequent notifications, killing gnome-power-manager loses history data, which is a bummer.

[So glad there's a bug open about this; I was wandering around GUADEC like a lost puppy trying to find someone who knew about this]

AfC
Comment 20 Luis Medinas 2007-09-06 19:31:38 UTC
*** Bug 474321 has been marked as a duplicate of this bug. ***
Comment 21 Ewoud Canniere 2007-09-12 18:36:02 UTC
It records data because it is there. On my laptop it hides behind the gnome foot icon on the left top side of the screen. I know it because when i unplug the cable or the battery is too low the messagebox appears there.

I hope there will be a solution soon.

*** Bug 474321 has been marked as a duplicate of this bug. *** was mine.

Cheers!

<If we can't fix it, it ain't broke>
Comment 22 Fryderyk Dziarmagowski 2007-09-14 18:11:16 UTC
Same bug here, even with freshly released gtk+ 2.12.0. That's a blocker for 2.20 IMHO.
Comment 23 Richard Hughes 2007-09-17 15:39:11 UTC
(In reply to comment #22)
> Same bug here, even with freshly released gtk+ 2.12.0. That's a blocker for
> 2.20 IMHO.

Is this just a gentoo issue?

Comment 24 Fryderyk Dziarmagowski 2007-09-17 16:15:40 UTC
(In reply to comment #23)

> Is this just a gentoo issue?

Not anymore. How can I help debugging it?
Comment 25 Maciej (Matthew) Piechotka 2007-09-19 05:05:17 UTC
Fixed in 2.19.92 or I've been being lucky?
Comment 26 Daniel Gryniewicz 2007-09-19 14:43:21 UTC
I think you've been lucky; it's still failing for me in 2.19.92.  I'm upgrading to 2.20.0 now, we'll see if it still happens there.
Comment 27 Maciej (Matthew) Piechotka 2007-09-19 18:13:20 UTC
In 2.20.0 I can't reproduce the bug. But when I mark this bug as fixed I will reproduce it ;)> 

PS. What information is needed? I'm lost.
Comment 28 Fryderyk Dziarmagowski 2007-09-19 18:43:48 UTC
2.20.0 got same issue.
Comment 29 Fryderyk Dziarmagowski 2007-09-19 18:59:13 UTC
...and it seems to be only g-p-m issue. Other notification area guests like Pidgin are not affected. Even after removing notification area applet from panel and re-adding it Pidgin icon appears again. g-p-m icon stays invisible until g-p-m is restarted or display policy is changed.
Comment 30 Mart Raudsepp 2007-09-28 21:06:39 UTC
Reopening based on comment #24...
Though I still think this is a GtkStatusIcon issue in gtktrayicon-x11.c that is a corner case that happens through the way g-p-m uses the control.

I'm willing to sit down with someone and go further from my investigations in comment #18. I suppose that would be useful with someone who is actually experiencing the problem.
In Gentoo Linux we don't patch things much on top of release tarballs - maybe some patch in Fedora or elsewhere is making the problem not happen as a side effect?
Comment 31 Maciej (Matthew) Piechotka 2007-09-28 22:09:45 UTC
Well. OK I actually can reproduce it from time to time.
Comment 32 Pacho Ramos 2007-10-07 17:25:43 UTC
I have the same problem with tomboy, under Gentoo and gnome 2.18
Comment 33 Pacho Ramos 2007-10-07 17:41:06 UTC
Similar bug in:
https://bugs.launchpad.net/ubuntu/+source/gnome-panel/+bug/123390
Comment 34 Pacho Ramos 2007-10-07 17:44:57 UTC
If you need some info feel free to ask me for that

Thanks
Comment 35 Pacho Ramos 2007-10-08 18:28:00 UTC
Maybe, would this be related with bug 424618 ?
Comment 36 Pacho Ramos 2007-10-10 15:07:03 UTC
I have exactly the same problem with opera browser if I set it for launching automatically by gnome-session at login, maybe a task applet problem?
Comment 37 Shogun 2007-10-28 15:34:18 UTC
Created attachment 98035 [details]
Script which resolve this bug with an ugly hack

Hi!
I also have this bug with GNOME 2.20.1 on Gentoo 2007.0.
While waiting for this resolution I wrote a simple script.
This script basically waits until gnome-panel starts. Then it waits another 5 second to ensure that the notification area have been loaded.
At the end it kills any existing instance of g-p-m and finally it launchs g-p-m again.
Obviously user must add this to startup application in session properties.
Hope this helps.
Best regards.
   Shogun
Comment 38 Shogun 2007-11-05 17:04:19 UTC
Hi guys...
I continued investigating on this bug...
On my system, a Gentoo box, I noticed accidentally that this bug disappear if g-p-m is compiled without XEvents.
Looking the Changelog, I saw that XEvents was introduced in 2.17 series, that is when this bug appeared on my box, so I think I have found the problem.
I looked up the code to see how XEvents is related to the bug, but the switch in the configure script seems to affect only gpm-button.c, so I couldn't figure it out.
Maybe you g-p-m developers can finally resolv this?
Cheers!
  Shogun
Comment 39 Richard Hughes 2007-11-05 17:48:49 UTC
>this bug disappear if g-p-m is compiled without XEvents

Good detective work - now the real quest is to find out *why* this causes the bug :-)

I'll have a look this weekend, if nobody beats me to it.
Comment 40 Mart Raudsepp 2007-11-09 06:03:20 UTC
XEvents code sounds like something that might be touching the X event filters to somehow disable the filter that gtktrayicon-x11.c relies on - might want to look into code paths in xevents specific code that might do it
Comment 41 Mart Raudsepp 2007-11-09 07:24:05 UTC
Created attachment 98803 [details] [review]
Fix the XEvent handling in gpm_button_filter_x_events

gpm_button_filter_x_events had all the key handling code inside the following if condition:
if (xev->type != KeyPress)
which is obviously wrong (should be == not !=), as if the XEvent type isn't KeyPress or KeyRelease, then xkey.keycode and xkey.state do not contain valid values. The patch changes the logic to first return GDK_FILTER_CONTINUE if it isn't a KeyPress, to let the event propagate up to gtk+ and the previously wrongly conditioned code is out of the condition, as at that point it's guaranteed it's a KeyPress - the returning before also ensures we don't stump on bad memory with the "keycode" and "state" variable assigning and is how gnome-control-center-2.18 did it for multimedia keys.

The bug of icon not appearing happened because addition of notification-area-applet generates an X Event for notification-manager ownership change, and the bug in gpm_button_filter_x_events didn't allow gtktrayicon-x11.c to see the event due to the propagation stopping from GDK_FILTER_REMOVE being returned on all non-keypresses.

So since the addition of --enable-xevents, all it did was stop the gpm tray icon from appearing on startup, as keypresses were never processed on a real keypress of the power management keys, so this codepath is probably completely untested. I might add that usually these keys work anyhow through other codepaths, so I'm not sure if for Gentoo we should include the patch to get the xevent functionality or just disable xevents until it's more tested
Comment 42 Mart Raudsepp 2007-11-09 07:37:26 UTC
Additionally maybe GDK_FILTER_CONTINUE should be returned (and not leaking hashkey) for "Key '%s' not found in hash!" case as well, to pass normal keypresses on, which might help with accessibility access to the icons context menu via only the keyboard. Not exactly sure though
Comment 43 Richard Hughes 2007-11-09 09:27:12 UTC
Mart! Well done! I've committed this to trunk (with your second suggestion also), could you please verify it works and then I'll push to 2-20 stable also:

2007-11-09  Richard Hughes  <richard@hughsie.com>

	* src/gpm-button.c: (gpm_button_filter_x_events),
	(gpm_button_grab_keystring), (gpm_button_button_key):
	Properly process the GdkXEvent so we don't hide the GtkStatusIcon
	when we compile with --enable-xevents.
	The bug of icon not appearing happened because addition of
	notification-area-applet generates an X Event for notification-manager
	ownership change, and the bug in gpm_button_filter_x_events didn't allow
	gtktrayicon-x11.c to see the event due to the propagation stopping from
	GDK_FILTER_REMOVE being returned on all non-keypresses.
	This is a slightly modied patch from Mart Raudsepp, many thanks.
	Fixes #413360
Comment 44 Mart Raudsepp 2007-11-09 09:37:44 UTC
Created attachment 98805 [details] [review]
Patch that was committed

Here's the patch that you committed to SVN, in case it's useful to anyone before a tarball gets released with a fix.
I think I was wrong in the accessibility concerns, as I didn't notice it's setting up the filter on the root window (just as gtktrayicon) and not the icon that could use some normal keypress handling.
I can't actually test if the keypress handling works and I'm concerned about this from downstream perspective.
I'll test if the icon works on notification applet remove/readd with this patch in a moment
Comment 45 Mart Raudsepp 2007-11-09 10:01:42 UTC
The icon appears good with the committed to trunk patch with --enable-xevents applied to 2.20.0.
However I don't see any debug messages from any keypresses still with gnome-power-manager --no-daemon --debug=power, so not sure if the "xevents" functionality itself works.

Btw, the handling of HAVE_XEVENTS is a bit interesting - there's a runtime gboolean have_xevents in gpm_button_init that gets set to TRUE if HAVE_XEVENTS is enabled, when it could instead wrap the gpm_button_button_key, gdk_window_add_filter call and the callback handler (gpm_button_filter_x_events) inside #if HAVE_XEVENTS for some trivial code size win in the default --disable-xevents case.
Comment 46 Mehdi Kabir 2007-11-10 07:20:57 UTC
Hi...I'm a newcomer to Linux and I'm not sure how to resolve this issue. I'm running gnome 2.20 on ubuntu 7.10 (gutsy)....i'm not really sure how I edit the "gpm-button.c" file since I can't find it...is there a package i have to install to access this file?...Any help is greatly appreciated. 
Comment 47 Maciej (Matthew) Piechotka 2007-11-10 08:50:28 UTC
(In reply to comment #46)
> Hi...I'm a newcomer to Linux and I'm not sure how to resolve this issue. I'm
> running gnome 2.20 on ubuntu 7.10 (gutsy)....i'm not really sure how I edit the
> "gpm-button.c" file since I can't find it...is there a package i have to
> install to access this file?...Any help is greatly appreciated. 
> 

1. If you really want compile from source.
2. Wait untill update for ubuntu will appear (strongly recommended).