early draft for 8087516: [JavaFX] Conditional support for GTK 3 on Linux

Tom Schindl tom.schindl at bestsolution.at
Sat Apr 23 20:22:01 UTC 2016


For FXCanvas it should be doable because you can check if SWT is running
with GTK3 using

org.eclipse.swt.internal.gtk.OS.GTK3 : boolean

This is what e(fx)clipse uses today to cancel loading of FXCanvas
because it would core-dump your application [1]. IIRC this flag is there
since the last SWT release!



On 23.04.16 20:30, Philip Race wrote:
> That may be [need to be] ironed out later.
> We are not certain there is a 100% reliable mechanism for this.
> Some experiments on the AWT equivalent using dlopen(..) with
> RTLD_NOLOAD is apparently failing to detect that gtk3 was loaded
> in the case it was loaded by SWT.
> An alternative but not very pretty approach using /proc has been proposed.
> '
> Any boiler plate code that works across all versions of Linux/Unix and
> where you do not control the manner in which gtk3 was loaded is proving
> elusive.
> And nothing will help in the case that FX is loaded first and gtk/swt is
> loaded later.
> -phil.
> On 4/23/16, 10:32 AM, Tom Schindl wrote:
>> David / Kevin,
>> Do you see chances to detect for the SWT case if we are running with SWT
>> on Gtk3 or Gtk2 and not having to use -Djdk.gtk.version=3
>> The problem with requiring one to switch by setting the System-Property
>> is that eg if someone want to use FX in the Eclipse IDE he does not
>> control the Java-Launch Process.
>> Tom
>> On 23.04.16 00:50, David Hill wrote:
>>> Kevin, Phil, anyone else interested.
>>> Here is an early draft of [JavaFX] Conditional support for GTK 3 on
>>> Linux<https://bugs.openjdk.java.net/browse/JDK-8087516>
>>> http://cr.openjdk.java.net/~ddhill/8087516.1/
>>> There are some rough edges left, particularly with the GTK 3 side of
>>> shaped windows.
>>> Given my time frame, I am interested in feedback on what is there
>>> because the core of it is complete.
>>> I have done limited testing on this, some with GTK3 and have not found
>>> any problems so far. I have more unit testing planned for next week.
>>> The default GTK version will be GTK2. To use GTK3, use the following:
>>>     -Djdk.gtk.version=3
>>> To enable some really verbose output:
>>>      -Djdk.gtk.verbose=true
>>> This verbosity will be reduced before I commit this - and only a message
>>> about the version actually used will be output.
>>> Known issues: Marked with a DAVE for easy cleanup later.
>>>      * shaped windows with GTK3 - need to verify the new region methods
>>>      * debug code that will be used to check that all of the code paths
>>> are tested.
>>>      * move the disableGrab back into the main code logic.

Thomas Schindl, CTO
BestSolution.at EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck

More information about the openjfx-dev mailing list