nautilus r13737 - in trunk: . libnautilus-private
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r13737 - in trunk: . libnautilus-private
- Date: Wed, 13 Feb 2008 14:12:07 +0000 (GMT)
Author: alexl
Date: Wed Feb 13 14:12:06 2008
New Revision: 13737
URL: http://svn.gnome.org/viewvc/nautilus?rev=13737&view=rev
Log:
2008-02-13 Alexander Larsson <alexl redhat com>
* libnautilus-private/nautilus-icon-canvas-item.[ch]:
* libnautilus-private/nautilus-icon-dnd.c:
Support alpha icons during DnD on composited screens. (#500084)
Patch from Alexander "weej" Jones
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-icon-canvas-item.c
trunk/libnautilus-private/nautilus-icon-canvas-item.h
trunk/libnautilus-private/nautilus-icon-dnd.c
Modified: trunk/libnautilus-private/nautilus-icon-canvas-item.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-canvas-item.c (original)
+++ trunk/libnautilus-private/nautilus-icon-canvas-item.c Wed Feb 13 14:12:06 2008
@@ -454,12 +454,12 @@
GdkPixmap *
nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
- GdkBitmap **mask)
+ GdkBitmap **mask,
+ GdkColormap *colormap)
{
GdkPixmap *pixmap;
EelCanvas *canvas;
GdkScreen *screen;
- GdkColormap *colormap;
GdkGC *gc;
int width, height;
int item_offset_x, item_offset_y;
@@ -474,7 +474,6 @@
g_return_val_if_fail (NAUTILUS_IS_ICON_CANVAS_ITEM (item), NULL);
canvas = EEL_CANVAS_ITEM (item)->canvas;
- colormap = gtk_widget_get_colormap (GTK_WIDGET (canvas));
screen = gdk_colormap_get_screen (colormap);
/* Assume we're updated so canvas item data is right */
@@ -529,11 +528,14 @@
GDK_INTERP_BILINEAR, 255);
}
+ /* clear the pixmap */
+ cairo_t *cr;
+ cr = gdk_cairo_create (pixmap);
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
gc = gdk_gc_new (pixmap);
- gdk_draw_rectangle (pixmap, GTK_WIDGET (canvas)->style->white_gc,
- TRUE,
- 0, 0,
- width, height);
gdk_draw_pixbuf (pixmap, gc, pixbuf,
0, 0, 0, 0,
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
Modified: trunk/libnautilus-private/nautilus-icon-canvas-item.h
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-canvas-item.h (original)
+++ trunk/libnautilus-private/nautilus-icon-canvas-item.h Wed Feb 13 14:12:06 2008
@@ -62,7 +62,8 @@
void nautilus_icon_canvas_item_set_image (NautilusIconCanvasItem *item,
GdkPixbuf *image);
GdkPixmap * nautilus_icon_canvas_item_get_image (NautilusIconCanvasItem *item,
- GdkBitmap **mask);
+ GdkBitmap **mask,
+ GdkColormap *colormap);
void nautilus_icon_canvas_item_set_emblems (NautilusIconCanvasItem *item,
GList *emblem_pixbufs);
void nautilus_icon_canvas_item_set_show_stretch_handles (NautilusIconCanvasItem *item,
Modified: trunk/libnautilus-private/nautilus-icon-dnd.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-dnd.c (original)
+++ trunk/libnautilus-private/nautilus-icon-dnd.c Wed Feb 13 14:12:06 2008
@@ -1417,19 +1417,37 @@
gpointer data)
{
NautilusIconContainer *container;
+ GdkScreen *screen;
+ GdkColormap *colormap;
GdkPixmap *pixmap;
GdkBitmap *mask;
double x1, y1, x2, y2, winx, winy;
int x_offset, y_offset;
int start_x, start_y;
+ gboolean use_mask;
container = NAUTILUS_ICON_CONTAINER (widget);
+ screen = gtk_widget_get_screen (widget);
+ colormap = NULL;
+ if (gdk_screen_is_composited (screen)) {
+ colormap = gdk_screen_get_rgba_colormap (screen);
+ if (colormap != NULL) {
+ use_mask = FALSE;
+ }
+ }
+
+ /* Fall back on using the same colormap as the widget */
+ if (colormap == NULL) {
+ colormap = gtk_widget_get_colormap (widget);
+ use_mask = TRUE;
+ }
+
start_x = container->details->dnd_info->drag_info.start_x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
start_y = container->details->dnd_info->drag_info.start_y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
/* create a pixmap and mask to drag with */
- pixmap = nautilus_icon_canvas_item_get_image (container->details->drag_icon->item, &mask);
+ pixmap = nautilus_icon_canvas_item_get_image (container->details->drag_icon->item, &mask, colormap);
/* we want to drag semi-transparent pixbufs, but X is too slow dealing with
stippled masks, so we had to remove the code; this comment is left as a memorial
@@ -1444,8 +1462,8 @@
y_offset = start_y - winy;
gtk_drag_set_icon_pixmap (context,
- gtk_widget_get_colormap (GTK_WIDGET (container)),
- pixmap, mask,
+ colormap,
+ pixmap, (use_mask ? mask : NULL),
x_offset, y_offset);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]