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

David Hill David.Hill at Oracle.com
Sun Apr 24 14:43:47 UTC 2016

On 4/23/16, 4:22 PM, Tom Schindl wrote:
> Hi,
> For FXCanvas it should be doable because you can check if SWT is running
> with GTK3 using
> ----8<----
> org.eclipse.swt.internal.gtk.OS.GTK3 : boolean
> ----8<----
> 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!
There is an interesting idea. I had not thought about using java reflection. The newness of the variable is a down side though.

Will have to try some stuff once I get the initial - non-detecting work cleaned up enough to get in place. In particular - a last look at using dlopen, and maybe the proc stuff.

The detection code could go in as a bug fix after the initial submital  of the functionality.

Tom, Sounds like you might be able to help us test after we integrate :-)

> Tom
> [1]http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/tree/bundles/runtime/org.eclipse.fx.osgi/src/org/eclipse/fx/osgi/fxloader/FXClassLoader.java
> 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.

David Hill<David.Hill at Oracle.com>
Java Embedded Development

"A man's feet should be planted in his country, but his eyes should survey the world."
-- George Santayana (1863 - 1952)

More information about the openjfx-dev mailing list