I am working on Oracle Java Swing/JavaFX dev team and we are facing some issues with drag and drop functionality in JavaFX since we have migrated to gtk 3.20. I had posted a similar question some time back, but this one has much more details.
JavaFX uses gtk for full event handling. We register a callback with gtk and receive all the events from gtk. We are not using the g_signal, but we have set a callback using following code. Gtk gives call for all the mouse, keyboard events using this one callback only and we handle the event appropriately.
//Callback declaration static void **process_events** (GdkEvent*, gpointer); //Registering the callback gdk_event_handler_set( **process_events** , NULL, NULL); GdkScreen *default_gdk_screen = gdk_screen_get_default(); GdkWindow *root = gdk_screen_get_root_window(default_gdk_screen); gdk_window_set_events(root, static_cast<GdkEventMask>(gdk_window_get_events(root) | GDK_PROPERTY_CHANGE_MASK));
Since gtk 3.20, We are not getting any drag and drop event from gtk side. Below are links for small demos, I have for the behavior with gtk 3.18 and gtk 3.22. The drag detection event in demo is initiated artificially by JavaFX on receiving mouse move after mouse pressed. Rest of the events dnd enter, dnd over, dnd exit are triggered by gtk and are corresponding to GDK_DRAG_ENTER, GDK_DRAG_MOTION and GDK_DRAG_LEAVE events respectively.
You can easily see in the demo that, the GDK_DRAG_ENTER, GDK_DRAG_MOTION and GDK_DRAG_LEAVE are not being triggered for gtk 3.20 when the mouse is moved with the mouse button pressed. Instead, as soon as the mouse button is released, GDK_DRAG_ENTER, GDK_DRAG_MOTION and GDK_DRAG_LEAVE triggered once. The GDK_DRAG_ENTER should be received at beginning of dnd and GDK_DRAG_MOTION should be triggered repeatedly on mouse motion while in dnd state. GDK_DRAG_LEAVE at end on releasing the mouse button. But all three events are received once on releasing the mouse button.
All works well in gtk3.18.
Any leads on what has been changed in gtk3.20 to cause such issues. I was suggested to look at wiki-gnome-org-Newcomers-DragNDropTutorial, but this one uses g_signal to register callbacks for dnd. We have a huge code base. So looking for a way to make it work without g_signal if possible. Changing our code to use g_signal will be the last resort. Please let me know if any further information is required from my side.