Bug 529151 (swtTidyOsBindings) - [Gtk] Move gtk/gdk function from OS.java to GTk.java and GDK.java
Summary: [Gtk] Move gtk/gdk function from OS.java to GTk.java and GDK.java
Status: RESOLVED FIXED
Alias: swtTidyOsBindings
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Leo Ufimtsev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-22 16:47 EST by Leo Ufimtsev CLA
Modified: 2018-04-06 07:45 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Ufimtsev CLA 2017-12-22 16:47:06 EST
Currently all gtk/gdk native functions are placed into OS.java.

If a *dynamic* gtk/gdk function is put into OS.java, then we have to *manually* link it to the proper library in os_custom.h like:
#define gdk_drag_context_list_targets_LIB LIB_GDK
#define gtk_event_controller_handle_event_LIB LIB_GTK

This is confusing to new swt/gtk developers and requires java developers to understand C code. Also it slows down development even if you know about them.

It would be much easier to have two separate classes 'GTK.java' and 'GDK.java', where if you put something in there, they're automatically hard-linked against those libraries.

I've quickly coded a proof of concept (>40 minutes of work). And tested with dynamic/static gtk function. Works well.

@SWT/Linx devs, please have a quick review of the patch and let me know if you have any objections moving forward.
Comment 1 Eclipse Genie CLA 2017-12-22 16:52:30 EST
New Gerrit change created: https://git.eclipse.org/r/114703
Comment 2 Eclipse Genie CLA 2018-01-25 15:11:25 EST
New Gerrit change created: https://git.eclipse.org/r/116065
Comment 4 Leo Ufimtsev CLA 2018-01-25 16:48:31 EST
Note to self:

Currently GObject/GIO functions are linked against glib.

@Alex, should I instead link them to the proper libraries?
libgobject-2.0.so.0
libgio-2.0.so.0
Comment 5 Leo Ufimtsev CLA 2018-01-26 17:48:53 EST
(GLIB)
Comment 6 Eclipse Genie CLA 2018-01-29 15:18:14 EST
New Gerrit change created: https://git.eclipse.org/r/116267
Comment 9 Eclipse Genie CLA 2018-02-01 15:22:34 EST
New Gerrit change created: https://git.eclipse.org/r/116557
Comment 10 Leo Ufimtsev CLA 2018-02-01 15:31:05 EST
Awaiting GDK.java patch review.

After that bug can be closed.
Comment 12 Leo Ufimtsev CLA 2018-02-02 10:08:08 EST
Done.

Dynamic functions in GTK.java/GDK.java don't need to be manually linked in os_custom.h anymore.
But functions in OS.java still need to be linked in os_cusotm.h.

As a note, for rapid prototyping or non gtk/gdk functions, one can temporarily put things into GTK.java and then upon submitting patch move/manually link in OS.java.

Also NativeStats show stats separate for Gtk/Gdk.
Hopefully that'll help us narrow down gtk3 performance issues in the future.
Comment 13 Alexander Kurtakov CLA 2018-02-02 10:17:38 EST
(In reply to Leo Ufimtsev from comment #12)
> Done.
> 
> Dynamic functions in GTK.java/GDK.java don't need to be manually linked in
> os_custom.h anymore.
> But functions in OS.java still need to be linked in os_cusotm.h.
> 
> As a note, for rapid prototyping or non gtk/gdk functions, one can
> temporarily put things into GTK.java and then upon submitting patch
> move/manually link in OS.java.

Let's not recommend taking such shortcuts as dlsym from another *.so file is something people should not do. I am also afraid that with such recommendations we will end up with many gerrits where time will be lost to remind people to move their bindings to the proper place. I have to remind of enough things already.

> 
> Also NativeStats show stats separate for Gtk/Gdk.
> Hopefully that'll help us narrow down gtk3 performance issues in the future.