Fix drawing of icons with alpha transparency

Icons with real alpha transparency weren't being drawn correctly
because the NaTrayIcon was being set redirected in addition to the
window holding it. And nothing drew the icon onto the window holding
it. Use the newly added na_tray_icon_set_composited() to fix.
This commit is contained in:
Owen W. Taylor 2009-04-18 17:06:14 -04:00
parent 58e718ac0c
commit a0dcee1b81

View File

@ -236,6 +236,14 @@ na_tray_icon_added (NaTrayManager *na_manager, GtkWidget *socket,
ShellTrayManagerChild *child; ShellTrayManagerChild *child;
GdkPixmap *bg_pixmap; GdkPixmap *bg_pixmap;
/* We don't need the NaTrayIcon to be composited on the window we
* put it in: the window is the same size as the tray icon
* and transparent. We can just use the default X handling of
* subwindows as mode of SOURCE (replace the parent with the
* child) and then composite the parent onto the stage.
*/
na_tray_child_set_composited (NA_TRAY_CHILD (socket), FALSE);
win = gtk_window_new (GTK_WINDOW_POPUP); win = gtk_window_new (GTK_WINDOW_POPUP);
gtk_container_add (GTK_CONTAINER (win), socket); gtk_container_add (GTK_CONTAINER (win), socket);
@ -252,11 +260,8 @@ na_tray_icon_added (NaTrayManager *na_manager, GtkWidget *socket,
* that color and setting it as our background. Then "parent-relative" * that color and setting it as our background. Then "parent-relative"
* background on the socket and the plug within that will cause * background on the socket and the plug within that will cause
* the icons contents to appear on top of our background color. * the icons contents to appear on top of our background color.
*
* Ordering warning: na_tray_child_is_composited() doesn't work
* until the tray child has been realized.
*/ */
if (!na_tray_child_is_composited (NA_TRAY_CHILD (socket))) if (!na_tray_child_has_alpha (NA_TRAY_CHILD (socket)))
{ {
bg_pixmap = create_bg_pixmap (gtk_widget_get_colormap (win), bg_pixmap = create_bg_pixmap (gtk_widget_get_colormap (win),
&manager->priv->bg_color); &manager->priv->bg_color);