GNOME Bugzilla – Bug 552953
_NET_SYSTEM_TRAY_VISUAL and real icon transparency
Last modified: 2008-12-08 14:59:20 UTC
This is a bit of a big patch. Highlights: * The _NET_SYSTEM_TRAY_VISUAL property is exposed on the tray selection manager window to indicate what visual the tray would prefer for child windows. http://lists.freedesktop.org/archives/xdg/2008-September/009919.html * The socket holding each icon is created with a visual matching the visual of the icon. This prevents a BadMatch if the icon uses a parent relative background. * If the visual of the icon is an RGBA visual and the Composite extension is present, gdk_window_set_composited() is used to get real alpha blending between the icon and the background. * Instead of complicated hooking up to various and sundry signals on GtkSocket, a GtkSocket subclass (NaTrayChild) is used. Also: * For fake parent-relative transparency, we now force a redraw each time the icon is moved, rather than at a random subset of times the icon might have moved. I have two code paths for the redraw ...the one that is active in this patch is slightly less safe against redraw problems, but causes less flicker. See comments in the patch for details. In order to get the real alpha-blended transparency, you need a tray icon that supports _NET_SYSTEM_TRAY_VISUAL (or that aggressively uses an RGBA visual regardless); I'll be creating a bug against GTK+ shortly to add support to GtkStatusIcon and will post a reference here. Note: I found 3 X server bugs working on this patch, but none of them affect the operation of the patch as posted here. What this patch does require to work properly is the following X server change: commit 866f092ca0160a366add01b48ad03438926c4d16 Author: Keith Packard <keithp@neko.keithp.com> Date: Tue Jul 3 14:29:11 2007 -0700 Make Composite manual redirect windows not clip their parent. This patch changes the semantics of manual redirect windows so that they no longer affect the clip list of their parent. Doing this means the parent can draw to the area covered by the child without using IncludeInferiors. More importantly, this also means that the parent receives expose events when that region is damaged by other actions. This change appeared in X server 1.4 so it should be widely, but not universally available. I'll file a bug against GTK+ to check for the corresponding composite protocol version 0.4 as part of gdk_display_supports_composite().
Created attachment 119018 [details] [review] Patch as described
Relevant GTK+ bugs: Bug 552956 - Should check composite extension version May get misbehavior on some older X servers without this patch Bug 552845 - Use DamageReportRawRectangles Occasional misdrawing will occur without this patch Bug 552959 - GtkTrayIcon: _NET_SYSTEM_TRAY_VISUAL and real transparency Without this patch, ARGB visuals won't be used (and in that case, neither of the two GDK patches matter...)
updates? Vuntz?
There was a slight issue with "priv->idle_redraw_id = 0;" being removed from idle_redraw_cb(). Else, it went in nearly unmodified (changed the code style a bit here and there). Thanks a lot!