Sorry for adding to the confusion; it is still working now (and I've also fixed the remaining part in the meantime), but actually the problem was another one. GDK_BUTTON1_MASK was present also in the GTK3 version of my program. gtk_tree_view_enable_model_drag_source () takes now four arguments instead of five, and I simply misplaced the other arguments, in conjunction with forgetting one of them. By pure chance the argument types were matching so I received no error message.
Thanks for reading anyway! 2018-03-12 23:09 GMT+01:00 Marcus Schätzle <[email protected]>: > I have found the solution for the dragging part. > While > gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview), 1, > enable_list, GDK_ACTION_MOVE); // enable_list is a GtkTargetEntry structure > was working in GTK3 (in fact this was a leftover from the GTK2 beginnings > of the program), it has to be now > gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview), > GDK_BUTTON1_MASK, content_formats, GDK_ACTION_MOVE); // content_formats is > a GdkContentFormats structure > > So the real difference was using GDK_BUTTON1_MASK in GTK4. > > The actual process of moving the tree rows inside the tree view is not yet > working in the GTK4 version, but if I can't make it work I can come back > here later. > > 2018-03-12 21:30 GMT+01:00 <[email protected]>: > >> On 12.03.2018 19:45, Marcus Schätzle wrote: >> >>> Hi all, >>> >>> I've done a port of a program to GTK4 (3.93.3); there is a part that I >>> have not yet gotten to work and that is drag and drop inside a tree view. >>> >>> I have particularly trouble understanding using the target formats >>> inside gtk_tree_view_enable_model_drag_dest (). For the GTK 3 version I >>> use a GtkTargetEntry structure initialised with {{ "STRING", >>> GTK_TARGET_SAME_WIDGET, 0 }}, which has always worked fine so far. >>> >> >> That is surprising. Usually i'd go for "UTF8_STRING". >> >> For GTK 4 I am supposed to use GdkContentFormats. But which mime types am >>> I supposed to fill into gtk_content_formats_new ()? >>> >> >> "text/plain;charset=utf-8" is the GTK4 equivalent of "UTF8_STRING" >> >> That's all i know. >> >> Note that last time i checked there was a bug that prevented DnD from >> working correctly in some cases. For example, DnD of text didn't work for >> GtkTextView, but did work for GtkEntry. >> >> >> _______________________________________________ >> gtk-list mailing list >> [email protected] >> https://mail.gnome.org/mailman/listinfo/gtk-list >> >> >
_______________________________________________ gtk-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtk-list
