gtk3 drag and drop sample/demo

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gtk3 drag and drop sample/demo

Gtk+ - Apps Dev mailing list
Hi All,

 

I am working with OpenJDK JavaFX dev group and we are facing some problems with drag and drop functionality with gtk3.20 or later. You can have a look at the bug for more information https://bugs.openjdk.java.net/browse/JDK-8211302. It will be great if someone can point out any big change done with respect to drag and drop from gtk3.20.

 

I am looking for a sample/demo for drag and drop functionality using gtk3. I can see that there is one demo at [1], but it is not compatible with gtk3 as it is using gtk4 specific structs and functions. I am not able to find any other working demo/sample working with gtk3. It would be great if anyone can point to me to something useful.

 

[1] https://github.com/GNOME/gtk/blob/master/demos/gtk-demo/dnd.c

 

-Pankaj
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: gtk3 drag and drop sample/demo

Gtk+ - Apps Dev mailing list
On Mon, 15 Apr 2019 at 12:45, Pankaj Bansal via gtk-app-devel-list <
[hidden email]> wrote:


> I am working with OpenJDK JavaFX dev group and we are facing some problems
> with drag and drop functionality with gtk3.20 or later. You can have a look
> at the bug for more information
> https://bugs.openjdk.java.net/browse/JDK-8211302. It will be great if
> someone can point out any big change done with respect to drag and drop
> from gtk3.20.
>

First of all, it's kind of rude to ask people to go to a random bug tracker
and ask for a code review without stating what the issue is.

Can you explain what issues are you experiencing?


> I am looking for a sample/demo for drag and drop functionality using gtk3.
> I can see that there is one demo at [1], but it is not compatible with gtk3
> as it is using gtk4 specific structs and functions. I am not able to find
> any other working demo/sample working with gtk3. It would be great if
> anyone can point to me to something useful.
>

The drag and drop code in GTK 3 hasn't really changed from the 2.x days,
and has been substantially reworked for GTK 4.

The old drag and drop tutorial may be of help:
https://wiki.gnome.org/Newcomers/DragNDropTutorial

Ciao,
 Emmanuele.

--
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

RE: gtk3 drag and drop sample/demo

Gtk+ - Apps Dev mailing list
Hello Emmanaele,

 

Thanks for replying and sorry if I sounded unreasonable to go and check the issue. I was referring to look at the issue and reproducer for the issue.

 

Issue:

In Ubuntu 16.04 (gtk3.18) all works fine for in JavaFX.

For Ubuntu 18.04 (gtk3.20 or later), the dnd stops working. I have found that we are not getting any calls from gtk side. I mean gtk is not calling the event callback function. I see that there is only one DragEnter event, one DragMotion event and then one DragEnd event. Whereas with gtk 3.18, we get many DragMotionm events which is what supposed to happen.

 

Below is a sample code, which can be used to easily see the issue. It is using the JavaFX for dnd.

 

I was hoping to get hands on some dnd native sample/demo which works fine with gtk3.20 or later. But if you are saying that nothing has changed, so I have to see what makes our code stop working from gtk3.20

 

 

//Sample Fx11draggError.java

 

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.control.Button;

import javafx.scene.input.ClipboardContent;

import javafx.scene.input.TransferMode;

import javafx.stage.Stage;

public class Fx11draggError extends Application{

@Override

public void start(Stage stage) throws Exception {

               Button button = new Button("test");

               button.setOnDragDetected(e -> {

                              System.out.println("Drag detected");

                              ClipboardContent content = new ClipboardContent();

                              content.putString("It works");

                              button.startDragAndDrop(TransferMode.COPY).setContent(content);

                              e.consume();

               });

        button.setOnDragOver((ev)-> {System.out.println("Drag over"); ev.consume();});

        button.setOnDragDropped((ev)-> {System.out.println("Drag end"); ev.consume();});

        button.setOnDragDone((ev)-> {System.out.println("Drag done"); ev.consume();});

       stage.setScene(new Scene(button, 200, 200));

       stage.show();

}

public static void main(String[] args) {

launch();

}

}

 

-Pankaj

 

From: Emmanuele Bassi [mailto:[hidden email]]
Sent: Monday, April 15, 2019 5:26 PM
To: Pankaj Bansal
Cc: gtk-app-devel-list list
Subject: Re: gtk3 drag and drop sample/demo

 

On Mon, 15 Apr 2019 at 12:45, Pankaj Bansal via gtk-app-devel-list <HYPERLINK "mailto:[hidden email]"[hidden email]> wrote:

 

I am working with OpenJDK JavaFX dev group and we are facing some problems with drag and drop functionality with gtk3.20 or later. You can have a look at the bug for more information https://bugs.openjdk.java.net/browse/JDK-8211302. It will be great if someone can point out any big change done with respect to drag and drop from gtk3.20.

 

First of all, it's kind of rude to ask people to go to a random bug tracker and ask for a code review without stating what the issue is.

 

Can you explain what issues are you experiencing?

 

I am looking for a sample/demo for drag and drop functionality using gtk3. I can see that there is one demo at [1], but it is not compatible with gtk3 as it is using gtk4 specific structs and functions. I am not able to find any other working demo/sample working with gtk3. It would be great if anyone can point to me to something useful.

 

The drag and drop code in GTK 3 hasn't really changed from the 2.x days, and has been substantially reworked for GTK 4.

 

The old drag and drop tutorial may be of help: HYPERLINK "https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.gnome.org_Newcomers_DragNDropTutorial&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=nHVEjVI-guB2suhUDbwru96xVVrQOkjZ4oHvLp8rBFo&m=k76mPqvxlua5kHEVFWSnXbdNteF7JdealQN3v-KVELc&s=3cUNH1P03apgAfDvBiT0NPIXKGbGVyAOQ2uhcFlSjzY&e="https://wiki.gnome.org/Newcomers/DragNDropTutorial

 

Ciao,

 Emmanuele.

 

--

HYPERLINK "https://urldefense.proofpoint.com/v2/url?u=https-3A__www.bassi.io&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=nHVEjVI-guB2suhUDbwru96xVVrQOkjZ4oHvLp8rBFo&m=k76mPqvxlua5kHEVFWSnXbdNteF7JdealQN3v-KVELc&s=adNpmoTJk5ufLg6lUH49hjZcSXWNzTTWCMInMXMuGs4&e="https://www.bassi.io
[@] ebassi [@HYPERLINK "https://urldefense.proofpoint.com/v2/url?u=http-3A__gmail.com&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=nHVEjVI-guB2suhUDbwru96xVVrQOkjZ4oHvLp8rBFo&m=k76mPqvxlua5kHEVFWSnXbdNteF7JdealQN3v-KVELc&s=1HMnpf-boburUX2mA71lOOnlacW-IU1aoV3WwBRXQEY&e="gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list