| 46 { NULL, "arrow-left.xpm", 0, -13/2 }, |
46 { NULL, "arrow-left.xpm", 0, -13/2 }, |
| 47 { NULL, "arrow-right.xpm", -16, -13/2 }, |
47 { NULL, "arrow-right.xpm", -16, -13/2 }, |
| 48 { NULL, NULL, 0, 0 } |
48 { NULL, NULL, 0, 0 } |
| 49 }; |
49 }; |
| 50 |
50 |
| 51 #if GTK_CHECK_VERSION(3,0,0) |
|
| 52 |
|
| 53 static void |
51 static void |
| 54 dnd_hints_realized_cb(GtkWidget *window, GtkWidget *pix) |
52 dnd_hints_realized_cb(GtkWidget *window, GtkWidget *pix) |
| 55 { |
53 { |
| 56 GdkPixbuf *pixbuf; |
54 GdkPixbuf *pixbuf; |
| 57 cairo_surface_t *surface; |
55 cairo_surface_t *surface; |
| 96 g_signal_connect(G_OBJECT(win), "realize", |
94 g_signal_connect(G_OBJECT(win), "realize", |
| 97 G_CALLBACK(dnd_hints_realized_cb), pix); |
95 G_CALLBACK(dnd_hints_realized_cb), pix); |
| 98 |
96 |
| 99 return win; |
97 return win; |
| 100 } |
98 } |
| 101 |
|
| 102 #else |
|
| 103 |
|
| 104 static GtkWidget * |
|
| 105 dnd_hints_init_window(const gchar *fname) |
|
| 106 { |
|
| 107 GdkPixbuf *pixbuf; |
|
| 108 GdkPixmap *pixmap; |
|
| 109 GdkBitmap *bitmap; |
|
| 110 GtkWidget *pix; |
|
| 111 GtkWidget *win; |
|
| 112 GdkColormap *colormap; |
|
| 113 |
|
| 114 pixbuf = gdk_pixbuf_new_from_file(fname, NULL); |
|
| 115 g_return_val_if_fail(pixbuf, NULL); |
|
| 116 |
|
| 117 win = gtk_window_new(GTK_WINDOW_POPUP); |
|
| 118 colormap = gtk_widget_get_colormap(win); |
|
| 119 gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, colormap, |
|
| 120 &pixmap, &bitmap, 128); |
|
| 121 g_object_unref(G_OBJECT(pixbuf)); |
|
| 122 |
|
| 123 pix = gtk_image_new_from_pixmap(pixmap, bitmap); |
|
| 124 gtk_container_add(GTK_CONTAINER(win), pix); |
|
| 125 gtk_widget_shape_combine_mask(win, bitmap, 0, 0); |
|
| 126 |
|
| 127 g_object_unref(G_OBJECT(pixmap)); |
|
| 128 g_object_unref(G_OBJECT(bitmap)); |
|
| 129 |
|
| 130 gtk_widget_show_all(pix); |
|
| 131 |
|
| 132 return win; |
|
| 133 } |
|
| 134 |
|
| 135 #endif |
|
| 136 |
99 |
| 137 static void |
100 static void |
| 138 get_widget_coords(GtkWidget *w, gint *x1, gint *y1, gint *x2, gint *y2) |
101 get_widget_coords(GtkWidget *w, gint *x1, gint *y1, gint *x2, gint *y2) |
| 139 { |
102 { |
| 140 gint ox, oy, width, height; |
103 gint ox, oy, width, height; |