diff options
author | ZenWalker <[email protected]> | 2016-06-10 01:04:00 +0200 |
---|---|---|
committer | ZenWalker <[email protected]> | 2016-06-10 01:04:00 +0200 |
commit | 25c3dccb52628440615f97c9877f7dacd37d6646 (patch) | |
tree | d4e66880e12e350eebe59a220842fea22897c3ae /src/eggtreemultidnd.c | |
parent | a7d26da348796b4233cc0fa79b1fdcc618e13d7d (diff) | |
download | engrampa-25c3dccb52628440615f97c9877f7dacd37d6646.tar.bz2 engrampa-25c3dccb52628440615f97c9877f7dacd37d6646.tar.xz |
drag and drop: use the clicked row as drag icon
file-roller commit:
https://git.gnome.org/browse/file-roller/commit/?id=fbb39fcb4be47fec09d911292777835707977159
Diffstat (limited to 'src/eggtreemultidnd.c')
-rw-r--r-- | src/eggtreemultidnd.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/eggtreemultidnd.c b/src/eggtreemultidnd.c index 3d417fe..a8bb183 100644 --- a/src/eggtreemultidnd.c +++ b/src/eggtreemultidnd.c @@ -317,16 +317,39 @@ egg_tree_multi_drag_motion_event (GtkWidget *widget, model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); if (egg_tree_multi_drag_source_row_draggable (EGG_TREE_MULTI_DRAG_SOURCE (model), path_list)) { - GtkTargetList *target_list = gtk_target_list_new (target_table, - G_N_ELEMENTS (target_table)); - + GtkTargetList *target_list; + GtkTreePath *tree_path; + int cell_x; + int cell_y; + double cursor_pos; + + target_list = gtk_target_list_new (target_table, G_N_ELEMENTS (target_table)); context = gtk_drag_begin (widget, target_list, GDK_ACTION_COPY, priv_data->pressed_button, (GdkEvent*)event); set_context_data (context, path_list); - gtk_drag_set_icon_default (context); + + if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), + priv_data->x, + priv_data->y, + &tree_path, + NULL, + &cell_x, + &cell_y)) + { + cairo_surface_t *drag_icon; + + drag_icon = gtk_tree_view_create_row_drag_icon (GTK_TREE_VIEW (widget), tree_path); + cairo_surface_set_device_offset (drag_icon, -cell_x, -cell_y); + gtk_drag_set_icon_surface (context, drag_icon); + + cairo_surface_destroy (drag_icon); + gtk_tree_path_free (tree_path); + } + else + gtk_drag_set_icon_default (context); gtk_target_list_unref (target_list); } |