From c28f508865f21658ad4319a561f999c87cf94703 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Thu, 18 Oct 2012 15:00:30 +0200 Subject: [lc-p] port caja-icon-dnd to cairo drawing http://git.gnome.org/browse/nautilus/commit/?id=34a376c97717cb05187b3d880e991c2d23511109 --- libcaja-private/caja-icon-dnd.c | 46 +++++++---------------------------------- libcaja-private/caja-icon-dnd.h | 8 +------ 2 files changed, 9 insertions(+), 45 deletions(-) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-icon-dnd.c b/libcaja-private/caja-icon-dnd.c index 12cc5cbf..204f9e80 100644 --- a/libcaja-private/caja-icon-dnd.c +++ b/libcaja-private/caja-icon-dnd.c @@ -98,7 +98,6 @@ create_selection_shadow (CajaIconContainer *container, { EelCanvasGroup *group; EelCanvas *canvas; - GdkBitmap *stipple; int max_x, max_y; int min_x, min_y; GList *p; @@ -115,9 +114,6 @@ create_selection_shadow (CajaIconContainer *container, return NULL; } - stipple = container->details->dnd_info->stipple; - g_return_val_if_fail (stipple != NULL, NULL); - canvas = EEL_CANVAS (container); gtk_widget_get_allocation (GTK_WIDGET (container), &allocation); @@ -164,7 +160,6 @@ create_selection_shadow (CajaIconContainer *container, "x2", (double) x2, "y2", (double) y2, "outline_color", "black", - "outline_stipple", stipple, "width_pixels", 1, NULL); } @@ -1664,6 +1659,7 @@ drag_highlight_expose (GtkWidget *widget, { gint x, y, width, height; GdkWindow *window; + cairo_t *cr; x = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (widget))); y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (widget))); @@ -1682,10 +1678,12 @@ drag_highlight_expose (GtkWidget *widget, NULL, widget, "dnd", x, y, width, height); - gdk_draw_rectangle (window, - (gtk_widget_get_style(widget))->black_gc, - FALSE, - x, y, width - 1, height - 1); + cr = gdk_cairo_create (window); + cairo_set_line_width (cr, 1.0); + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_rectangle (cr, x + 0.5, y + 0.5, width - 1, height - 1); + cairo_stroke (cr); + cairo_destroy (cr); return FALSE; } @@ -2029,25 +2027,7 @@ drag_data_received_callback (GtkWidget *widget, } void -caja_icon_dnd_set_stipple (CajaIconContainer *container, - GdkBitmap *stipple) -{ - if (stipple != NULL) - { - g_object_ref (stipple); - } - - if (container->details->dnd_info->stipple != NULL) - { - g_object_unref (container->details->dnd_info->stipple); - } - - container->details->dnd_info->stipple = stipple; -} - -void -caja_icon_dnd_init (CajaIconContainer *container, - GdkBitmap *stipple) +caja_icon_dnd_init (CajaIconContainer *container) { GtkTargetList *targets; int n_elements; @@ -2096,11 +2076,6 @@ caja_icon_dnd_init (CajaIconContainer *container, G_CALLBACK (drag_drop_callback), NULL); g_signal_connect (container, "drag_leave", G_CALLBACK (drag_leave_callback), NULL); - - if (stipple != NULL) - { - container->details->dnd_info->stipple = g_object_ref (stipple); - } } void @@ -2112,11 +2087,6 @@ caja_icon_dnd_fini (CajaIconContainer *container) { stop_auto_scroll (container); - if (container->details->dnd_info->stipple != NULL) - { - g_object_unref (container->details->dnd_info->stipple); - } - caja_drag_finalize (&container->details->dnd_info->drag_info); container->details->dnd_info = NULL; } diff --git a/libcaja-private/caja-icon-dnd.h b/libcaja-private/caja-icon-dnd.h index 1070c41f..6cf14aa0 100644 --- a/libcaja-private/caja-icon-dnd.h +++ b/libcaja-private/caja-icon-dnd.h @@ -39,19 +39,13 @@ typedef struct gboolean highlighted; - /* Stipple for drawing icon shadows during DnD. */ - GdkBitmap *stipple; - /* Shadow for the icons being dragged. */ EelCanvasItem *shadow; } CajaIconDndInfo; -void caja_icon_dnd_init (CajaIconContainer *container, - GdkBitmap *stipple); +void caja_icon_dnd_init (CajaIconContainer *container); void caja_icon_dnd_fini (CajaIconContainer *container); -void caja_icon_dnd_set_stipple (CajaIconContainer *container, - GdkBitmap *stipple); void caja_icon_dnd_begin_drag (CajaIconContainer *container, GdkDragAction actions, gint button, -- cgit v1.2.1