changeset 3800:5dc0aaa97966 trunk

Automated merge with file:/home/ccr/audacious/core
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Sep 2007 06:29:33 +0300
parents 5a267ba155cb (current diff) 56e2a8704164 (diff)
children 701de882bcc2
files
diffstat 4 files changed, 53 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/main.c	Fri Sep 14 06:27:59 2007 +0300
+++ b/src/audacious/main.c	Fri Sep 14 06:29:33 2007 +0300
@@ -957,6 +957,52 @@
     g_object_unref(icon);
 }
 
+#ifdef GDK_WINDOWING_QUARTZ
+static void
+set_dock_icon(void)
+{
+    GdkPixbuf *icon, *pixbuf;
+    CGColorSpaceRef colorspace;
+    CGDataProviderRef data_provider;
+    CGImageRef image;
+    gpointer data;
+    gint rowstride, pixbuf_width, pixbuf_height;
+    gboolean has_alpha;
+
+    icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm);
+    pixbuf = gdk_pixbuf_scale_simple(icon, 128, 128, GDK_INTERP_BILINEAR);
+
+    data = gdk_pixbuf_get_pixels(pixbuf);
+    pixbuf_width = gdk_pixbuf_get_width(pixbuf);
+    pixbuf_height = gdk_pixbuf_get_height(pixbuf);
+    rowstride = gdk_pixbuf_get_rowstride(pixbuf);
+    has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
+
+    /* create the colourspace for the CGImage. */
+    colorspace = CGColorSpaceCreateDeviceRGB();
+    data_provider = CGDataProviderCreateWithData(NULL, data, pixbuf_height * rowstride, NULL);
+    image = CGImageCreate(pixbuf_width, pixbuf_height, 8,
+	has_alpha ? 32 : 24, rowstride, colorspace,
+	has_alpha ? kCGImageAlphaLast : 0,
+	data_provider, NULL, FALSE,
+	kCGRenderingIntentDefault);
+
+    /* release the colourspace and data provider, we have what we want. */
+    CGDataProviderRelease(data_provider);
+    CGColorSpaceRelease(colorspace);
+
+    /* set the dock tile images */
+    SetApplicationDockTileImage(image);
+
+#if 0
+    /* and release */
+    CGImageRelease(image);
+    g_object_unref(icon);
+    g_object_unref(pixbuf);
+#endif
+}
+#endif
+
 static void
 register_aud_stock_icons(void)
 {
@@ -1369,6 +1415,9 @@
         register_aud_stock_icons();
 
         bmp_set_default_icon();
+#ifdef GDK_WINDOWING_QUARTZ
+        set_dock_icon();
+#endif
 
         gtk_accel_map_load(bmp_paths[BMP_PATH_ACCEL_FILE]);
 
--- a/src/audacious/platform/smartinclude.h	Fri Sep 14 06:27:59 2007 +0300
+++ b/src/audacious/platform/smartinclude.h	Fri Sep 14 06:29:33 2007 +0300
@@ -28,3 +28,7 @@
 #endif
 
 #include <gdk/gdkkeysyms.h>
+
+#ifdef GDK_WINDOWING_QUARTZ
+# include <Carbon/Carbon.h>
+#endif
--- a/src/audacious/ui_jumptotrack.c	Fri Sep 14 06:27:59 2007 +0300
+++ b/src/audacious/ui_jumptotrack.c	Fri Sep 14 06:29:33 2007 +0300
@@ -41,8 +41,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <X11/Xlib.h>
-
 #include <sys/types.h>
 
 #if defined(USE_REGEX_ONIGURUMA)
--- a/src/audacious/ui_main.c	Fri Sep 14 06:27:59 2007 +0300
+++ b/src/audacious/ui_main.c	Fri Sep 14 06:29:33 2007 +0300
@@ -41,8 +41,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <X11/Xlib.h>
-
 #include <sys/types.h>
 
 #if defined(USE_REGEX_ONIGURUMA)