diff options
author | Jasmine Hassan <[email protected]> | 2012-10-18 15:00:30 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-11-14 09:42:33 +0200 |
commit | c28f508865f21658ad4319a561f999c87cf94703 (patch) | |
tree | 18c2b90fcab7894e8ef20ac742f609e9447cf550 | |
parent | a694648f1a1a373f96e97b632627bb30d1c5646b (diff) | |
download | caja-c28f508865f21658ad4319a561f999c87cf94703.tar.bz2 caja-c28f508865f21658ad4319a561f999c87cf94703.tar.xz |
[lc-p] port caja-icon-dnd to cairo drawing
http://git.gnome.org/browse/nautilus/commit/?id=34a376c97717cb05187b3d880e991c2d23511109
-rw-r--r-- | libcaja-private/caja-icon-dnd.c | 46 | ||||
-rw-r--r-- | libcaja-private/caja-icon-dnd.h | 8 |
2 files changed, 9 insertions, 45 deletions
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, |