changeset 1047:91f6db060a8b trunk

[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
author nenolod
date Sun, 14 May 2006 13:35:06 -0700
parents 18ef6f3089d4
children b10e09537428
files audacious/playlist_list.c audacious/ui_playlist.c
diffstat 2 files changed, 58 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/playlist_list.c	Sun May 14 11:45:51 2006 -0700
+++ b/audacious/playlist_list.c	Sun May 14 13:35:06 2006 -0700
@@ -57,6 +57,45 @@
 static gint width_colon, width_colon_third;
 static gint width_approx_digits, width_approx_digits_half;
 
+#ifdef GDK_WINDOWING_X11
+
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+static GdkPixmap *get_transparency_pixmap(void)
+{
+    Atom prop, type;
+    int format;
+    unsigned long length, after;
+    unsigned char *data;
+    static GdkPixmap *retval = NULL;
+
+    if(retval)
+        return retval;
+
+    prop = XInternAtom(GDK_DISPLAY(), "_XROOTPMAP_ID", True);
+
+    if(prop == None)
+        return NULL;
+
+    XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), prop, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
+
+    if(type == XA_PIXMAP)
+        retval = gdk_pixmap_foreign_new(*((Pixmap *)data));
+
+    return retval;
+}
+
+#else
+
+static GdkPixmap *get_transparency_pixmap(void)
+{
+    return NULL;
+}
+
+#endif
+
 static gboolean
 playlist_list_auto_drag_down_func(gpointer data)
 {
@@ -391,11 +430,22 @@
 
     gdk_gc_set_clip_origin(gc, 31, 58);
     gdk_gc_set_clip_rectangle(gc, playlist_rect);
-    gdk_gc_set_foreground(gc,
-                          skin_get_color(bmp_active_skin,
-                                         SKIN_PLEDIT_NORMALBG));
-    gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, pl->pl_widget.y,
-                       width, height);
+
+    if (cfg.playlist_transparent == FALSE)
+    {
+        gdk_gc_set_foreground(gc,
+                              skin_get_color(bmp_active_skin,
+                                             SKIN_PLEDIT_NORMALBG));
+        gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, pl->pl_widget.y,
+                              width, height);
+    }
+    else
+    {
+        GdkPixmap *rootpix = get_transparency_pixmap();
+        gdk_draw_pixmap(obj, gc, rootpix, cfg.playlist_x + pl->pl_widget.x,
+                    cfg.playlist_y + pl->pl_widget.y, pl->pl_widget.x, pl->pl_widget.y,
+                    width, height);
+    }
 
     if (!playlist_list_font) {
         g_critical("Couldn't open playlist font");
--- a/audacious/ui_playlist.c	Sun May 14 11:45:51 2006 -0700
+++ b/audacious/ui_playlist.c	Sun May 14 13:35:06 2006 -0700
@@ -569,10 +569,9 @@
     playlistwin_resizing = FALSE;
     gdk_flush();
 
-#if 0
-        if (cfg.playlist_transparent)
-            playlistwin_update_list();
-#endif
+    if (cfg.playlist_transparent)
+        playlistwin_update_list();
+
     gtk_object_remove_data(GTK_OBJECT(playlistwin), "is_moving");
     gtk_object_remove_data(GTK_OBJECT(playlistwin), "offset_x");
     gtk_object_remove_data(GTK_OBJECT(playlistwin), "offset_y");