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 552953 - _NET_SYSTEM_TRAY_VISUAL and real icon transparency
_NET_SYSTEM_TRAY_VISUAL and real icon transparency
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: notification area
git master
Other Linux
: Normal normal
: ---
Assigned To: Panel Maintainers
Panel Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-09-19 22:38 UTC by Owen Taylor
Modified: 2008-12-08 14:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch as described (29.92 KB, patch)
2008-09-19 22:39 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2008-09-19 22:38:21 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().
Comment 1 Owen Taylor 2008-09-19 22:39:04 UTC
Created attachment 119018 [details] [review]
Patch as described
Comment 2 Owen Taylor 2008-09-19 23:24:24 UTC
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...)
Comment 3 Andrea Cimitan 2008-10-08 16:44:21 UTC
updates?
Vuntz?
Comment 4 Vincent Untz 2008-12-08 14:59:20 UTC
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!