Rationale:
While working onJDK-8211302 I have stumbled on many differences between gdk versions. On the gdk3 line, I have found many backends (X11, Wayland) code differences on the GTK side. While the fix works (refering to JDK-8211302), it's not perfect. For example, the dragview (the window that follows the mouse showing image/icon) does not work well on scenebuilder, because it sets it to be under the cursor and it ends up stealing the events. This does not happen with the gtk port because gtk handles it well, as it does with many other systems/versions differences.
TheJDK-8211302 patch has this code:
#ifdef GLASS_GTK3
if (gtk_get_minor_version() >= 20) {
// according to GDK docs, this is only fired on managed mode, but
// on 3.20+ the GDK_DROP_FINISHED event stopped working and this signal
// works (even when not managed).
g_signal_connect(ctx, "dnd-finished",
G_CALLBACK(dnd_finished_callback), NULL);
}
I don't feel this is secure because it uses something that docs says otherwise.
UI Consistency:
Gtk shows an default icon while dragging which is consistent with the gnome desktop and desktop theme. It also shows an animation when drag fails, where the dragview comes back to the origin. (Can change some behaviors if they go against javafx UI policies).
Conclusion:
In essence, this change makes the code easier to maintain, adds UI consistency and works better (as gtk handles systems differences internally)
PR:
https://github.com/javafxports/openjdk-jfx/pull/490
This PR is well tested on Ubuntu 16.04, 18.04 and 19.04 with gtk2 fallback and gtk3. Scenebuilder also works well with the patch and gtk3. On 19.04 it works with wayland.
Code changes are restricted to drag source (destination is untouched) and some minor necessary changes on other places.
While working on
The
#ifdef GLASS_GTK3
if (gtk_get_minor_version() >= 20) {
// according to GDK docs, this is only fired on managed mode, but
// on 3.20+ the GDK_DROP_FINISHED event stopped working and this signal
// works (even when not managed).
g_signal_connect(ctx, "dnd-finished",
G_CALLBACK(dnd_finished_callback), NULL);
}
I don't feel this is secure because it uses something that docs says otherwise.
UI Consistency:
Gtk shows an default icon while dragging which is consistent with the gnome desktop and desktop theme. It also shows an animation when drag fails, where the dragview comes back to the origin. (Can change some behaviors if they go against javafx UI policies).
Conclusion:
In essence, this change makes the code easier to maintain, adds UI consistency and works better (as gtk handles systems differences internally)
PR:
https://github.com/javafxports/openjdk-jfx/pull/490
This PR is well tested on Ubuntu 16.04, 18.04 and 19.04 with gtk2 fallback and gtk3. Scenebuilder also works well with the patch and gtk3. On 19.04 it works with wayland.
Code changes are restricted to drag source (destination is untouched) and some minor necessary changes on other places.
- blocks
-
JDK-8227004 Using an image with Dragboard.setDragView() on GTK3 breaks drag and drop
-
- Closed
-
- duplicates
-
JDK-8227004 Using an image with Dragboard.setDragView() on GTK3 breaks drag and drop
-
- Closed
-
- relates to
-
JDK-8211302 DragAndDrop no longer works with GTK3
-
- Resolved
-
-
JDK-8255723 Gtk glass backend should run with Gtk+ 3.8 (minimum)
-
- Resolved
-
- links to
-
Commit openjdk/jfx/3bbcbfb4
(1 links to)