Bug 153193 - GTK applications with tray icons crash
Summary: GTK applications with tray icons crash
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: HI crash with 24 votes (vote)
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 154210 156260 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-30 21:34 UTC by Luca Gambetta
Modified: 2008-01-20 20:57 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Backtrace for gtk+icon crash. (3.74 KB, text/plain)
2008-01-05 10:49 UTC, Jeffrey Coleman
Details
Cross-bitdepth support for 4.0.0 (3.55 KB, patch)
2008-01-09 14:02 UTC, Jason Stubbs
Details
Plasma::Theme::backroundColor() patch (1.07 KB, patch)
2008-01-09 15:02 UTC, Jason Stubbs
Details
Gtk icon cutted (46.86 KB, image/png)
2008-01-09 20:42 UTC, Daniele
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Gambetta 2007-11-30 21:34:10 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 4.2.2 
OS:                Linux

Claws Mail has a plugin to show a status icon on the system tray. When I enable it on KDE 4 from SVN, Claws Mail crashes instantly. It works flawlessy on KDE 3 and others DE.
The error message is:

The program 'claws-mail' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 16009 error_code 8 request_code 2 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Comment 1 Luca Gambetta 2007-12-01 14:22:19 UTC
On 12/01/07 Krush-day a user confirmed me that some other GTK applications crashed with the same error (i.e: Pidgin).
This bug is filed under the wrong component, not "general" but "plasma".
Comment 2 Riccardo Iaconelli 2007-12-05 00:29:12 UTC
CC'ing panel-devel too as it seems a rather grave bug, a showstopper I'd say.
Comment 3 Aaron J. Seigo 2007-12-05 01:15:03 UTC
this is almost certainly a bug in gtk+. seems they don't handle setting the background of an xembeded window with argb visuals. suck. anybody feel like filing a gtk bug? =)
Comment 4 Luca Gambetta 2007-12-05 08:07:46 UTC
If it is a GTK+ error, why it doesn't happens with KDE 3? Anyway if confirmed I can file the bug to GTK... 
Comment 5 Aaron J. Seigo 2007-12-05 08:37:24 UTC
> If it is a GTK+ error, why it doesn't happens with KDE 3?

kde3 doesn't use gtk. it uses qt3. there's no connection between the two toolkits.
Comment 6 Luca Gambetta 2007-12-05 10:31:16 UTC
Yes, sure kde 3 doesn't use GTK ;)
After reading your blog post (http://aseigo.blogspot.com/2007/12/argb-visuals.html) I figured out why it doesn't work...
Comment 7 Riccardo Iaconelli 2007-12-18 17:33:41 UTC
Bug in GNOME's bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=501842
Comment 8 Lubos Lunak 2007-12-18 19:02:18 UTC
I think we could use a proxy window that'd handle the background or different visuals somehow. That will still probably leave the systray with ugly background for those icons.
Comment 9 Riccardo Iaconelli 2007-12-19 00:05:12 UTC
Seems gnome panel here is using ARGB visuals, and applications are not crashing:
http://www.cimitan.com/blog/2007/12/12/gtk-rgba-transparent-widgets-with-the-murrine-engine/

The panel transparency could be a hack, Cimi doesn't talks specifically of that, but I don't think so given what the post talks about.

DISCLAIMER: I don't know that code, just reporting from what I saw on the web :-)
Comment 10 Aaron J. Seigo 2007-12-19 01:12:29 UTC
obviously if all the apps are using ARGB visuals there would be no mismatch. which is the entire problem here. notice how in that blog entry every single widget in every single app is using alpha?
Comment 11 Riccardo Iaconelli 2007-12-19 12:18:13 UTC
for the records, xchat doesn't crash here, yesterday's svn.
Comment 12 Adam Tulinius 2007-12-23 12:21:50 UTC
It still crashes here (with xchat), using version 3.97.1, release 6.5, from the open suse build service.
Comment 13 Mathieu Jobin 2007-12-29 15:31:05 UTC
but we can't wait for GTK+ to fix this ... 
what is the workaround ?
Comment 14 Mathieu Jobin 2007-12-29 16:35:36 UTC
can't you detect if the client application supports ARGB or not? if the apps does not support it, could not you default to some settings or wrap it into something so the app would run anyway, even though those apps might get uglier for a while. It does not matter so much I believe.

Please do not wait for them to fix/implement this.
Comment 15 Jeffrey Coleman 2008-01-05 10:49:01 UTC
Created attachment 22842 [details]
Backtrace for gtk+icon crash.

I reproduced this bug with both pidgin and azureus. Here is the backtrace for
azureus.
Comment 16 Luca Gambetta 2008-01-05 16:16:31 UTC
The audio player Audacious shows the systray icon without problems. It's a gtk application.
Comment 17 Lubos Lunak 2008-01-07 12:01:53 UTC
SVN commit 758247 by lunakl:

Work around problems with embedding windows with different visuals/depths.
BUG: 153193



 M  +2 -1      CMakeLists.txt  
 M  +37 -3     qx11embed_x11.cpp  
 M  +16 -5     qx11embed_x11.h  
 M  +1 -6      systemtraycontainer.cpp  
 M  +2 -2      systemtraycontainer.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=758247
Comment 18 Daniele 2008-01-07 13:09:05 UTC
I've tried to compile all (after the fix) with emesene and pidgin and the problem IS NOT fix for me.
Comment 19 Lubos Lunak 2008-01-07 15:28:23 UTC
What is the error/backtrace for it?
Comment 20 Daniele 2008-01-07 15:44:49 UTC
With pidgin the program crash..
 
Usign emesene I see this text
The program 'emesene' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 3030 error_code 8 request_code 2 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Comment 21 Lubos Lunak 2008-01-07 16:00:06 UTC
That doesn't make sense. Please try to get a backtrace as said in the error message.
Comment 22 Daniele 2008-01-07 16:12:41 UTC
I've tried to pass --sync parameter to emesene but the error I received it is the same. Have you tried Pidgin in your computer to see if it's works ok? 
Comment 23 Gabriel C 2008-01-07 16:28:11 UTC
try to start emesene it in gdb ?
Comment 24 Stephen 2008-01-07 17:12:40 UTC
it works for me now, but the draw back is an ugly system tray. 

unfortunately we can't have both I guess
Comment 25 Lubos Lunak 2008-01-07 18:42:00 UTC
*** Bug 154210 has been marked as a duplicate of this bug. ***
Comment 26 Craig Duquette 2008-01-08 01:13:40 UTC
I haven't had a chance to look at any of the code related to this issue, but is it possible to paint the background black? Right now the icons are encased in white boxes, but people wouldn't notice if they were encased in boxes that matched the color of the panel.
Comment 27 Aaron J. Seigo 2008-01-08 02:45:09 UTC
> but people wouldn't notice if they were encased in boxes that matched the
> color of the panel

until they use a white panel svg ;) it should really use Plasma::Theme::self()->backgroundColor() i suppose, though i'm not sure how compatible that is with how it's done now in the systray applet; e.g. does WhitePixel return an indexed colour or an actual rgb value? i think the former which would make things difficult indeed.
Comment 28 Craig Duquette 2008-01-08 06:00:36 UTC
I saw that commit 758246 removed these lines from systemtraycontainer.cpp

       // HACK: Tell the client to draw it's own black background rather than   
       // taking ours as things are broken with ARGB visuals it seems.   
       XSetWindowBackgroundPixmap(QX11Info::display(), clientId, None);   
       XSetWindowBackground(QX11Info::display(), clientId, 0 /* black */);

What was the reason behind removing them? We get a good looking systray when added back in and GTK apps still launch here.
Comment 29 Jason Stubbs 2008-01-08 06:24:46 UTC
Those lines were what was causing GTK apps to crash ;)
Comment 30 Daniele 2008-01-08 09:17:56 UTC
Now I can confirm that this workaround works with my emesene and pidgin... but the white background is really very ugly :-)
Comment 31 Aaron J. Seigo 2008-01-08 17:29:04 UTC
> but the white background is really very ugly

yep. best thing would be if gtk+ would simply fix their toolkit, but apparently they are living in some sort of state of denial (you'd think that just because everyone else can get their toolkit to Do The Right Thing(tm) that they'd be able to as well).

next best thing will be to wrap the entire systray icons glob in a white-background widget; while still glaring it at least won't have those visibly hard edges with black gaps between each icon.

ultimate solution is a long term one: kill the systray in its current incarnation because it is, by design, broken. i've been saying this for 4 years now, i know that Lubos is certain sympathetic to the idea now, as are the enlightenment people ... maybe the rest of the world will be able to catch up with the concept as well and we can move to something that works a lot better for modern needs. but yeah .. until then ... uglyness will be our friend.
Comment 32 Lubos Lunak 2008-01-08 17:48:24 UTC
This is not gtk's fault. It may be at most too strict about it, but it has every right to expect nobody will mess with its own windows.
Making the whole systray applet use normal background is the easiest workaround. Another possibility could be to patch QSystemTrayIcon to set shape on the window, matching the shape of the icon (not quite sure that'd work and possibly this would also have to be Plasma-only).
As for replacing systray with something else, I've hated systray since a looong time ago. I remember playing with alternatives as long ago as Ludwigsburg. I should finally find time to create something usable :-/.
Comment 33 Jason Stubbs 2008-01-09 13:34:01 UTC
White backgrounds are gone now
Comment 34 Rex Dieter 2008-01-09 13:45:03 UTC
Any chance to see a patch against kde-4.0.0 for packagers to use? :)  (I've tried to naively make a svn diff of l.lunak's recent commits wrt this, but I failed miserably).
Comment 35 Jason Stubbs 2008-01-09 14:02:14 UTC
Created attachment 22913 [details]
Cross-bitdepth support for 4.0.0

There are a few other changes been made since 4.0.0 but this is just the
changes relevant to this bug (to be on the safe side)
Comment 36 Jason Stubbs 2008-01-09 15:02:36 UTC
Created attachment 22914 [details]
Plasma::Theme::backroundColor() patch

Turns out that the above change needs this addition to libplasma as well.
Both have been added to the 4.0 branch.
Comment 37 Rex Dieter 2008-01-09 16:29:04 UTC
Thank you Jason!
Comment 38 Daniele 2008-01-09 20:31:19 UTC
Thank you very much Jason! Now the situation is really better!
I have another question, with pidgin and emesene the icon appair bigger than the kde icons. I try to explain me better: The space used from the icon is the same but the gtk icon are painted bigger and than cutted to stay in this space..
Comment 39 Daniele 2008-01-09 20:42:53 UTC
Created attachment 22919 [details]
Gtk icon cutted

To explain me better I attach this image. In the first part you can see the
icon that I define "cutted". It's strange that when I close pidgin icon,
emesene icon became normal.
Comment 40 Daniele 2008-01-09 20:56:32 UTC
Ok..I can confirm this situation:
- When you start a gtk application like (pidgin, emesene etc) the icon in the tray appair bigger (like in my attachment)
- If you close one application that has an icon in the tray (a kde application,too) and a refresh is done to the tray then the icons are painted normal

I try also opening pidgin, emesene and kmix. The first time pidgin and emesene used bigger icon, when I close kmix the pidgin and msn icons appair normal.

I hope this information could be useful for you.

Comment 41 Jason Stubbs 2008-01-10 03:22:20 UTC
Please open a seperate bug for this. This bug's been closed and your issue is a different one, although possibly related. After opening a new one, you might want to link to it from here though so that those that care can find it easily.
Comment 42 Daniele 2008-01-10 09:08:00 UTC
Ok Jason. I've opened a new bug. Bug 155381 - https://bugs.kde.org/show_bug.cgi?id=155381
Comment 43 Lubos Lunak 2008-01-20 20:57:20 UTC
*** Bug 156260 has been marked as a duplicate of this bug. ***