From b95eb68beeac96b5cf774174f578b54d4d0ef9d2 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Fri, 19 Jun 2020 14:47:34 +0100 Subject: [PATCH] Part fix #396: GTK3 collections https://github.com/BestImageViewer/geeqie/issues/396 The helper icon marker.xpm was not shown when making drag-and-drop on a collection window. The patch includes a FIXME, but works well enough. --- src/collect-table.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/collect-table.c b/src/collect-table.c index 3474840c..71eb1b7b 100644 --- a/src/collect-table.c +++ b/src/collect-table.c @@ -1479,6 +1479,11 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, { gboolean after = FALSE; GdkRectangle cell; + GdkWindow *parent; + gint x_parent, y_parent; + + parent = gtk_widget_get_window(gtk_widget_get_toplevel(ct->listview)); + gdk_window_get_position(parent, &x_parent, &y_parent); if (!enable) { @@ -1495,7 +1500,6 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, if (!ct->marker_window) { - GdkWindow *parent = gtk_tree_view_get_bin_window(GTK_TREE_VIEW(ct->listview)); GdkWindowAttr attributes; gint attributes_mask; GdkPixbuf *pb = gdk_pixbuf_new_from_xpm_data((const gchar **)marker_xpm); @@ -1509,7 +1513,7 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, attributes.event_mask = gtk_widget_get_events(ct->listview); attributes_mask = 0; - ct->marker_window = gdk_window_new(parent, &attributes, attributes_mask); + ct->marker_window = gdk_window_new(NULL, &attributes, attributes_mask); #if GTK_CHECK_VERSION(3,0,0) cairo_region_t *mask; @@ -1518,7 +1522,9 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, cairo_t *cr = cairo_create(img); gdk_cairo_set_source_pixbuf(cr, pb, 0, 0); cairo_paint(cr); - pattern = cairo_pattern_create_for_surface(img); + // FIXME: this is a hack to get the background color + //~ pattern = cairo_pattern_create_for_surface(img); + pattern = cairo_pattern_create_rgb (1.0, 0.0, 0.0); mask = gdk_cairo_region_create_from_surface(img); gdk_window_shape_combine_region(ct->marker_window, mask, 0, 0); gdk_window_set_background_pattern(ct->marker_window, pattern); @@ -1559,6 +1565,9 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, x -= (w / 2); y = cell.y + (cell.height / 2) - (h / 2); + x = x + x_parent; + y = y + y_parent; + gdk_window_move(ct->marker_window, x, y); #if !GTK_CHECK_VERSION(3,0,0) gdk_window_clear(ct->marker_window); -- 2.20.1