Index: gdk/gdkcursor.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkcursor.c,v
retrieving revision 1.18
diff -u -b -B -p -r1.18 gdkcursor.c
--- gdk/gdkcursor.c	20 Jun 2002 23:59:03 -0000	1.18
+++ gdk/gdkcursor.c	7 Feb 2003 23:39:41 -0000
@@ -96,3 +96,68 @@ gdk_cursor_new (GdkCursorType cursor_typ
 {
   return gdk_cursor_new_for_display (gdk_display_get_default(), cursor_type);
 }
+
+GdkCursor *
+gdk_cursor_new_from_pixbuf (GdkPixbuf  *pixbuf,
+			    GdkDisplay *display, 
+			    gint        hot_x,
+			    gint        hot_y)
+{
+  GdkCursor *cursor;
+  GdkPixmap *pixmap, *mask;
+  guint width, height, n_channels, rowstride, x, y;
+  guint8 *data, *mask_data, *buffer;
+  GdkColor fg, bg;
+  GdkScreen *screen;
+
+  width = gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
+  n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+  buffer = gdk_pixbuf_get_pixels (pixbuf);
+
+  data = g_new0 (guint8, (width + 7) / 8 * height);
+  mask_data = g_new0 (guint8, (width + 7) / 8 * height);
+  for (y = 0; y < height; y++)
+    for (x = 0; x < width; x++)
+      {
+	guint8 *d = data + (width + 7) / 8 * y + x / 8;
+	guint8 *md = mask_data + (width + 7) / 8 * y + x / 8;
+	guint8 *buf = buffer + y * rowstride + x * n_channels;
+	
+	if (buf[1] > 0)
+	  *d |= 1 << (x % 8);
+
+	if (n_channels == 3 || buf[3] > 0) {
+	  *md |= 1 << (x % 8);
+	}
+      }
+
+  screen = gdk_display_get_default_screen (display);
+  pixmap = gdk_bitmap_create_from_data (gdk_screen_get_root_window (screen), 
+					data, width, height);
+ 
+  mask = gdk_bitmap_create_from_data (gdk_screen_get_root_window (screen),
+				      mask_data, width, height);
+   
+  gdk_color_white (gdk_screen_get_system_colormap (screen), &fg);
+  gdk_color_black (gdk_screen_get_system_colormap (screen), &bg);
+   
+  cursor = gdk_cursor_new_from_pixmap (pixmap, mask, &fg, &bg, hot_x, hot_y);
+   
+  gdk_drawable_unref (pixmap);
+  gdk_drawable_unref (mask);
+  
+  return cursor;
+}
+
+GdkCursor *
+gdk_cursor_new_from_animation (GdkPixbufAnimation  *animation,
+			       GdkDisplay          *display, 
+			       gint                 hot_x,
+			       gint                 hot_y)
+{
+  GdkPixbuf *pixbuf = gdk_pixbuf_animation_get_static_image (animation);
+
+  return gdk_cursor_new_from_pixbuf (display, pixbuf, hot_x, hot_y);
+}
Index: gdk/gdkcursor.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkcursor.h,v
retrieving revision 1.8
diff -u -b -B -p -r1.8 gdkcursor.h
--- gdk/gdkcursor.h	18 Jun 2002 20:59:32 -0000	1.8
+++ gdk/gdkcursor.h	7 Feb 2003 23:39:41 -0000
@@ -2,6 +2,7 @@
 #define __GDK_CURSOR_H__
 
 #include <gdk/gdktypes.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -116,6 +117,15 @@ GdkCursor* gdk_cursor_new_from_pixmap	 (
 					  GdkColor	  *bg,
 					  gint		   x,
 					  gint		   y);
+GdkCursor *gdk_cursor_new_from_pixbuf    (GdkPixbuf       *pixbuf,
+			                  GdkDisplay      *display, 
+		     	                  gint             hot_x,
+			                  gint             hot_y);
+GdkCursor *gdk_cursor_new_from_animation (GdkPixbufAnimation *animation,
+			                  GdkDisplay         *display, 
+		     	                  gint                hot_x,
+			                  gint                hot_y);
+
 GdkDisplay* gdk_cursor_get_display	 (GdkCursor	  *cursor);
 GdkCursor*  gdk_cursor_ref               (GdkCursor       *cursor);
 void        gdk_cursor_unref             (GdkCursor       *cursor);
