Migrate a small demo from gtk 3.18 to gtk 3.22
Hello, I am working on some application, where we draw widgets like "RadioButton", "CheckButton" etc. by calling "gtk_render_option", "gtk_render_check" and so forth. Our application works fine on gtk 3.18, but on gtk 3.22, the widgets are not drawn correctly. I have gone through the changes made in theme handling on 3.20 and tried to make some changes in my application, but I am not able to understand what I need to do exactly. I have created a small demo where I draw "RadioButton" using the gtk_render_option API. This works fine for me in gtk-3.18, but the causes issue in gtk 3.22. I am attaching images and Demo.c for reference. It would be great if someone here can guide me on "How can I make this small demo work on gtk 3.22". I should be able to take care of the rest myself. I can provide any further information required. Note: I have tried both "radio" and "radiobutton" in gtk_style_context_add_class API. Both don't work for me. Thanks, Pankaj #include #include static gboolean draw_cb_options (GtkWidget *widget, cairo_t *cr) { GtkStyleContext *context; context = gtk_widget_get_style_context (widget); gtk_style_context_save (context); gtk_style_context_add_class (context, "radio"); gtk_style_context_set_state (context, 0); gtk_render_option (context, cr, 10, 50, 40, 40); gtk_style_context_set_state (context, GTK_STATE_FLAG_CHECKED); gtk_render_option (context, cr, 70, 50, 40, 40); gtk_style_context_set_state (context, GTK_STATE_FLAG_INCONSISTENT); gtk_render_option (context, cr, 120, 50, 40, 40); gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE); gtk_render_option (context, cr, 170, 50, 40, 40); gtk_style_context_restore (context); return TRUE; } int main (int argc, char *argv[]) { GtkWidget *window; GtkStyleContext *context; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "draw", G_CALLBACK (draw_cb_options), NULL); gtk_widget_show_all (window); gtk_main (); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk3 drag and drop sample/demo
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 gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: gtk3 drag and drop sample/demo
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:eba...@gmail.com] 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 mailto:gtk-app-devel-list@gnome.org"gtk-app-devel-list@gnome.org> 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 gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list