Re: GTK4: gtk_tree_view_enable_model_drag_dest () and GdkContentFormats
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: > 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 : > >> 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 >> gtk-list@gnome.org >> https://mail.gnome.org/mailman/listinfo/gtk-list >> >> > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK4: gtk_tree_view_enable_model_drag_dest () and GdkContentFormats
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: > 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 > gtk-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-list > > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK4: gtk_tree_view_enable_model_drag_dest () and GdkContentFormats
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. signature.asc Description: OpenPGP digital signature ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
GTK4: gtk_tree_view_enable_model_drag_dest () and GdkContentFormats
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. For GTK 4 I am supposed to use GdkContentFormats. But which mime types am I supposed to fill into gtk_content_formats_new ()? The tree store contains one element each of GDK_TYPE_PIXBUF and G_TYPE_UINT; the rest of the tree store consists of G_TYPE_STRING elements. What I've essentialy done in GTK 3 is using gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (treeview), enable_list, 1, GDK_ACTION_MOVE); (enable_list is the structure which I mentioned above). together with gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview), GDK_BUTTON1_MASK, enable_list, 1, GDK_ACTION_MOVE); For testing of the GTK 4 version I've tried simply with "text/plain" as mime type in GdkContentFormat. I can't drag anything yet, and there is no warning or error message printed if I try to do so. I've done my testing on an installation of Siduction (Debian ustable distro) inside VirtualBox. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list