changeset 1079:d94ba9133f94 trunk

[svn] - update transparency pixmap if root window pixmap changes
author nenolod
date Fri, 19 May 2006 12:48:02 -0700
parents 069d4503ce54
children 440cb13c5051
files audacious/playlist_list.c
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/playlist_list.c	Fri May 19 12:24:07 2006 -0700
+++ b/audacious/playlist_list.c	Fri May 19 12:48:02 2006 -0700
@@ -62,6 +62,8 @@
 
 GdkPixmap *rootpix;
 
+void playlist_list_draw(Widget * w);
+
 /* Sort of stolen from XChat, but not really, as theres uses Xlib */
 static void
 shade_gdkimage_generic (GdkVisual *visual, GdkImage *ximg, int bpl, int w, int h, int rm, int gm, int bm, int bg)
@@ -145,6 +147,30 @@
     return retval;
 }
 
+static GdkFilterReturn
+root_event_cb (GdkXEvent *xev, GdkEventProperty *event, gpointer data)
+{
+        static Atom at = None;
+        XEvent *xevent = (XEvent *)xev;
+
+        if (xevent->type == PropertyNotify)
+        {
+                if (at == None)
+                        at = XInternAtom (xevent->xproperty.display, "_XROOTPMAP_ID", True);
+
+                if (at == xevent->xproperty.atom)
+		{
+                        rootpix = shade_pixmap(get_transparency_pixmap(), 0, 0, 0, 0, gdk_screen_width(), gdk_screen_height(),
+                            skin_get_color(bmp_active_skin, SKIN_PLEDIT_NORMALBG));
+
+			if (cfg.playlist_transparent)
+				playlist_list_draw(WIDGET(data));
+		}
+        }
+
+        return GDK_FILTER_CONTINUE;
+}
+
 #else
 
 GdkPixmap *get_transparency_pixmap(void)
@@ -849,6 +875,11 @@
 
     widget_list_add(wlist, WIDGET(pl));
 
+#ifdef GDK_WINDOWING_X11
+    gdk_window_set_events (gdk_get_default_root_window(), GDK_PROPERTY_CHANGE_MASK);
+    gdk_window_add_filter (gdk_get_default_root_window(), (GdkFilterFunc)root_event_cb, pl);
+#endif
+
     return pl;
 }