changeset 1379:5767c05ce900 trunk

[svn] - do transparency the X11 way
author nenolod
date Mon, 10 Jul 2006 02:34:37 -0700
parents 27d9eb18c7cf
children 3ede6ff9794f
files ChangeLog audacious/playlist_list.c audacious/playlist_list.h
diffstat 3 files changed, 45 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 10 01:18:38 2006 -0700
+++ b/ChangeLog	Mon Jul 10 02:34:37 2006 -0700
@@ -1,3 +1,15 @@
+2006-07-10 08:18:38 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1670]
+  - some improvements to song_change, still sucky
+  - jackd volume saving stuff (via galiyosha)
+  
+
+  Changes:        Modified:
+  +4 -9           trunk/Plugins/General/song_change/song_change.c  
+  +20 -2          trunk/Plugins/Output/jack/jack.c  
+  +1 -0           trunk/Plugins/Output/jack/jack.h  
+
+
 2006-07-10 05:59:20 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1668]
   - properly respect signedness in get_spc_info_().
--- a/audacious/playlist_list.c	Mon Jul 10 01:18:38 2006 -0700
+++ b/audacious/playlist_list.c	Mon Jul 10 02:34:37 2006 -0700
@@ -85,9 +85,9 @@
 			b = bm * (pixel & visual->blue_mask) + bgb;
 
 			gdk_image_put_pixel (ximg, x, y,
-							((r >> 8) & visual->red_mask) |
-							((g >> 8) & visual->green_mask) |
-							((b >> 8) & visual->blue_mask));
+				((r >> 8) & visual->red_mask) |
+				((g >> 8) & visual->green_mask) |
+				((b >> 8) & visual->blue_mask));
 		}
 	}
 }
@@ -120,31 +120,40 @@
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 
-GdkPixmap *get_transparency_pixmap(void)
+GdkDrawable *get_transparency_pixmap(void)
 {
-    Atom type;
-    static Atom prop = None;
-    int format;
-    unsigned long length, after;
-    unsigned char *data;
-    GdkPixmap *retval = NULL;
+	GdkDrawable *root;
+	XID *pixmaps;
+	GdkAtom prop_type;
+	gint prop_size;
+	GdkPixmap *pixmap;
+	gboolean ret;
+
+	root = gdk_get_default_root_window();
+
+	pixmap = NULL;
+	pixmaps = NULL;
+
+	gdk_error_trap_push();
 
-    if(prop == None)
-        prop = XInternAtom(GDK_DISPLAY(), "_XROOTPMAP_ID", True);
-    if(prop == None)
-        return NULL;
+	ret = gdk_property_get(root, gdk_atom_intern("_XROOTPMAP_ID", TRUE),
+			0, 0, INT_MAX - 3,
+			FALSE,
+			&prop_type, NULL, &prop_size,
+			(guchar **) &pixmaps);
 
-    XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), prop, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
+	gdk_error_trap_pop();
 
-    if (data)
-    {
-        if(type == XA_PIXMAP)
-           retval = gdk_pixmap_foreign_new(*((Pixmap *)data));
+	if ((ret == TRUE) && (prop_type == GDK_TARGET_PIXMAP) && (prop_size >= sizeof(XID)) && (pixmaps != NULL))
+	{
+		pixmap = gdk_pixmap_foreign_new_for_display(gdk_drawable_get_display(root),
+			pixmaps[0]);
 
-        XFree(data);
-    }
+		if (pixmaps != NULL)
+			g_free(pixmaps);
+	}
 
-    return retval;
+	return GDK_DRAWABLE(pixmap);
 }
 
 static GdkFilterReturn
--- a/audacious/playlist_list.h	Mon Jul 10 01:18:38 2006 -0700
+++ b/audacious/playlist_list.h	Mon Jul 10 02:34:37 2006 -0700
@@ -50,7 +50,7 @@
 int playlist_list_get_playlist_position(PlayList_List * pl, gint x, gint y);
 void playlist_list_set_font(const gchar * font);
 GdkPixmap *rootpix;
-GdkPixmap *shade_pixmap(GdkPixmap *in, gint x, gint y, gint x_offset, gint y_offset, gint w, gint h, GdkColor *shade_color);
-GdkPixmap *get_transparency_pixmap(void);
+GdkPixmap *shade_pixmap(GdkDrawable *in, gint x, gint y, gint x_offset, gint y_offset, gint w, gint h, GdkColor *shade_color);
+GdkDrawable *get_transparency_pixmap(void);
 
 #endif