Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8225571

Port Linux glass drag source (DND) to use gtk instead of gdk

XMLWordPrintable

      Rationale:

      While working on JDK-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.

      The JDK-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.

            tsayao Thiago Sayao
            tsayao Thiago Sayao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: