]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkdnd.c
GtkImage: Use gtk_widget_render_icon_pixbuf()
[~andy/gtk] / gtk / gtkdnd.c
index 7ee489495d426bb259611b774a91a874c0ccef36..84e651d668bceb72adc12bb2205ccd4bdaacea57 100644 (file)
@@ -1300,7 +1300,7 @@ gtk_drag_dest_set_proxy (GtkWidget      *widget,
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (!proxy_window || GDK_IS_WINDOW (proxy_window));
 
-  site = g_new (GtkDragDestSite, 1);
+  site = g_slice_new (GtkDragDestSite);
 
   site->flags = 0;
   site->have_drag = FALSE;
@@ -2329,7 +2329,7 @@ gtk_drag_begin_internal (GtkWidget         *widget,
 
       pointer = gdk_event_get_device (event);
 
-      if (pointer->source == GDK_SOURCE_KEYBOARD)
+      if (gdk_device_get_source (pointer) == GDK_SOURCE_KEYBOARD)
         {
           keyboard = pointer;
           pointer = gdk_device_get_associated_device (keyboard);
@@ -3109,8 +3109,8 @@ set_icon_stock_pixbuf (GdkDragContext    *context,
 
   if (stock_id)
     {
-      pixbuf = gtk_widget_render_icon (window, stock_id,
-                                      GTK_ICON_SIZE_DND, NULL);
+      pixbuf = gtk_widget_render_icon_pixbuf (window, stock_id,
+                                              GTK_ICON_SIZE_DND);
 
       if (!pixbuf)
        {
@@ -3241,13 +3241,18 @@ _gtk_cairo_surface_extents (cairo_surface_t *surface,
 
 /**
  * gtk_drag_set_icon_surface:
- * @context: the context for a drag. (This must be called 
- *            with a  context for the source side of a drag)
- * @surface: the surface to use as icon 
- * 
+ * @context: the context for a drag. (This must be called
+ *            with a context for the source side of a drag)
+ * @surface: the surface to use as icon
+ *
  * Sets @surface as the icon for a given drag. GTK+ retains
  * references for the arguments, and will release them when
  * they are no longer needed.
+ *
+ * To position the surface relative to the mouse, use
+ * cairo_surface_set_device_offset() on @surface. The mouse
+ * cursor will be positioned at the (0,0) coordinate of the
+ * surface.
  **/
 void 
 gtk_drag_set_icon_surface (GdkDragContext    *context,
@@ -3285,6 +3290,8 @@ gtk_drag_set_icon_surface (GdkDragContext    *context,
       cairo_t *cr;
 
       region = gdk_cairo_region_create_from_surface (surface);
+      cairo_region_translate (region, -extents.x, -extents.y);
+
       gtk_widget_shape_combine_region (window, region);
       cairo_region_destroy (region);
 
@@ -3297,7 +3304,7 @@ gtk_drag_set_icon_surface (GdkDragContext    *context,
       
       cr = cairo_create (saturated);
       cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR_ALPHA);
-      cairo_set_source_surface (cr, surface, extents.x, extents.y);
+      cairo_set_source_surface (cr, surface, -extents.x, -extents.y);
       cairo_paint (cr);
       cairo_set_operator (cr, CAIRO_OPERATOR_SATURATE);
       cairo_paint (cr);