Re: drag'n'drop sample application
2011/9/13 John Emmas john...@tiscali.co.uk: On 11 Sep 2011, at 19:24, John Emmas wrote: src/gtk+-2.20.0/tests/testtreeview.c src/gtk+-2.20.0/prop-editor.c [...] I know there aren't many people here who use gtk-win32 but if anyone does (and can spare a few minutes) could you try building those two modules and see if you can reproduce the problem? I'd like to find out if TreeView dnd is something that isn't working generally in gtk-win32 or if the problem is specific to my copy for some reason. FWIW I came across some old postings I'd made on this mailing list (circa April 2010) and realised that I already flagged up this problem when I was using gtk-win32 v2.14, about 18 months ago. For the past 6 months or so I've been using v2.20 and it still seems to be present in that version although I think gtk is up to about 2.24 now. I'm planning to investigate the TreeView DND issue sometime soon but it'd be handy to know if anyone else is working on it (or if it's already been fixed). To recap, TreeView controls seem to support drag'n'drop if I build them for Linux - but not if I build them for Windows. If anyone has any information that might be helpful I'd really appreciate it. Thanks. Better ask that on the devel list, not on the app-devel_list Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: drag'n'drop sample application
On 13 Sep 2011, at 08:42, Bernhard Schuster wrote: Better ask that on the devel list, not on the app-devel_list Good suggestion Bernhard. In fact, gtk-list might be more appropriate (and I think I'm already subscribed to that one!) Thanks. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: drag'n'drop sample application
On 8 Sep 2011, at 11:20, John Emmas wrote: On 7 Sep 2011, at 15:13, Craig wrote: Hi John, Depending upon your installation of gtk, I think there is a very good example of drag and drop in the /usr/bin/gtk-demo. [...] Other than that, I would do a web search for gtk-demo. Thanks for the prompt help guys. I really appreciate it. I took a look at Allin's code which seemed really straightforward so I just built it (I'm using gtk-win32 BTW). Anyway, it builds and runs flawlessly and at least confirms that dnd is working in my copy of gtk. I think I spoke too soon Allin's app provided me with a good example of dragging and dropping from different sources (both internal to the app and also external). I also added a drag source of my own so I could learn how it all works. My addition was just something very simple (a label) whereas the actual app that I'm having problems with is dragging (to and from) TreeView controls. Luckily, the gtk toolkit provides a small application for building and testing a TreeView control - crucially, it includes the drag'n'drop functionality. So I built the application which only needed me to build these 2 modules:- src/gtk+-2.20.0/tests/testtreeview.c src/gtk+-2.20.0/prop-editor.c First I compiled the app in Linux (linking to gtk-x11) and then in Windows (linking to gtk-win32). To my amazement, this small sample app exhibits the same problem as the bigger one that I was originally trying to debug - i.e. dnd works in the Linux build but not in the Windows build. Running the app in Linux, I can re-order its treeview items by dragging and dropping. However, this just doesn't work in the Windows version. I've established that drag'n'drop does work for other gtk objects but I haven't found any way of making it work with a TreeView control..! I know there aren't many people here who use gtk-win32 but if anyone does (and can spare a few minutes) could you try building those two modules and see if you can reproduce the problem? I'd like to find out if TreeView dnd is something that isn't working generally in gtk-win32 or if the problem is specific to my copy for some reason. Hopefully, someone will be able to spare the time. Thanks. John. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: drag'n'drop sample application
On 7 Sep 2011, at 15:13, Craig wrote: Hi John, Depending upon your installation of gtk, I think there is a very good example of drag and drop in the /usr/bin/gtk-demo. [...] Other than that, I would do a web search for gtk-demo. Thanks for the prompt help guys. I really appreciate it. I took a look at Allin's code which seemed really straightforward so I just built it (I'm using gtk-win32 BTW). Anyway, it builds and runs flawlessly and at least confirms that dnd is working in my copy of gtk. Best of all, the functionality is neatly in one place so I should be able to trace my way through it quite easily. Thanks Allin. John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
drag'n'drop sample application
Using gtk-win32, I'm porting a GTK+ application (originally written for Linux and OS-X) to the Windows platform and have been pleasantly surprised at how well it's all worked. However, part of the app's functionality includes a drag'n'drop feature to move items from one part of the GUI to another part. This feature works fine on the other platforms but doesn't work in Windows. I see a drag icon when moving the item but when I let go of it, it remains in its original position instead of moving to the new position. I've established that the individual elements of the drag'n'drop operation seem to be working. e.g. if I grab an item and drag it, all the various 'drag_source()' functions get called, just like they do on the other platforms. Likewise, if I drag an item from outside the app, I can successfully drop it onto a drop destination within the GUI. So both parts of the operation work individually but they don't seem to work with each other. My theory is that when I drag an internal item and let go of it, something must be preventing it from realising it's above a valid drop target. Unfortunately, the app itself is very large and complicated so it's pretty difficult to figure out what's supposed to be happening. Does anyone know of a handy example that I could use to study GTK+ drag'n'drop at a simpler level (with source code, obviously) ? John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: drag'n'drop sample application
On Wed, 7 Sep 2011, John Emmas wrote: Using gtk-win32, I'm porting a GTK+ application (originally written for Linux and OS-X) to the Windows platform and have been pleasantly surprised at how well it's all worked. However, part of the app's functionality includes a drag'n'drop feature to move items from one part of the GUI to another part. [not working on Windows] Unfortunately, the app itself is very large and complicated so it's pretty difficult to figure out what's supposed to be happening. Does anyone know of a handy example that I could use to study GTK+ drag'n'drop at a simpler level (with source code, obviously) ? I'm attaching a little test program that I once used for diagnosing GTK dnd problems on Windows. Allin Cottrell /* Test program for drag and drop with two sorts of targets available. Allin Cottrell (cottr...@wfu.edu), March 2003. */ #include gtk/gtk.h enum { DRAG_FILENAME, DRAG_POINTER }; GtkTargetEntry test_drag_targets[] = { { text/uri-list, 0, DRAG_FILENAME }, { pointer, GTK_TARGET_SAME_APP, DRAG_POINTER } }; void app_exit (GtkWidget *w, gpointer p) { gtk_main_quit(); } static void msgbox (const char *msg) { GtkWidget *dialog; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, msg); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } static void get_drag_pointer (GtkWidget *w, GdkDragContext *context, GtkSelectionData *sel, guint info, guint t, gpointer ptr) { gtk_selection_data_set(sel, GDK_SELECTION_TYPE_INTEGER, 8, (const guchar *) ptr, sizeof ptr); } static void pointer_window_drag_connect (GtkWidget *widget, gpointer ptr) { gtk_drag_source_set(widget, GDK_BUTTON1_MASK, test_drag_targets[DRAG_POINTER], 1, GDK_ACTION_COPY); g_signal_connect(G_OBJECT(widget), drag_data_get, G_CALLBACK(get_drag_pointer), ptr); } static void pointer_window (void) /* mock-up of a window which supplies a pointer to drop */ { GtkWidget *pw, *plabel; pw = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_print(Pointer window is at %p\n, (void *) pw); plabel = gtk_label_new(\n Pointer window \n); gtk_container_add(GTK_CONTAINER(pw), plabel); pointer_window_drag_connect(pw, (gpointer) pw); gtk_widget_show_all(pw); } static void handle_drag_data (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer p) { gchar *input = NULL; if (info == DRAG_FILENAME) { input = g_strdup_printf(Got uri-list: %s, data-data); } else if (info == DRAG_POINTER) { input = g_strdup_printf(Got pointer (address of pointer window):\n %p, *(void **) data-data); } else { input = g_strdup(Got unknown drag input); } msgbox(input); g_free(input); } static void main_window_drag_connect (GtkWidget *widget) { gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_ALL, test_drag_targets, 2, GDK_ACTION_COPY); g_signal_connect (G_OBJECT(widget), drag_data_received, G_CALLBACK(handle_drag_data), NULL); } int main (int argc, char *argv[]) { GtkWidget *w, *label; gtk_init(argc, argv); w = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(w), destroy, G_CALLBACK(app_exit), NULL); label = gtk_label_new(\n Drag onto me, from a file icon \n or from the pointer window. \n); gtk_container_add(GTK_CONTAINER(w), label); main_window_drag_connect(label); gtk_widget_show_all(w); pointer_window(); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list