-
Enhancement
-
Resolution: Fixed
-
P2
-
8, 9
-
b118
Gtk 3.0 has been around for a while (since ~2011), so we should consider migrating to it.
Gtk 4.0 is not scheduled for shipment until late 2015 so should not be considered.
AWT and Swing use Gtk 2.0 and are not likely to be updated in JDK9 time frame.
Currently it is possible to encounter difficulties with the GTK version when using other
technologies with JFX that depend on GTK3 - like SWT (
Over the life of JDK9, it may become likely that GTK2 is no longer installed by default.
(Ubuntu 14, 15, OEL 7 seem to install GTK2 and GTK3 runtime by default)
There are a limited number of ways to launch a JFX app:
* FXCanvas - Used to support interop with SWT, fails on newer systems where SWT uses GTK3.0
* JFXPanel - Swing Interop, requires GTK2
* Application subclass - The "normal" way to use JFX
* Platform.startup - A JDK9 added API to initiate the JFX toolkit.
* Application, then JFXPanel - JFX is started prior to JFXPanel being used. Requires GTK2.
Pros:
Gtk 3.0 is the currently supported code stream
Swt 4.4 uses Gtk 3.0 by default (can fall back to Gtk 2.0 though, with ENV setting )
Cons:
Swt 3.x uses Gtk 2.0 by default and linking JFX with Gtk 3.0 would cause issues.
Unknown amount of porting effort
Coverage testing of the port.
There is a GTK migration guide at:
https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html
Proposed solution for this bug:
Create and use a dynamic wrapper using dlopen/dlsym. This mechanism
is a common pattern used in JFX for other purposes, and so is well
understood. In short, a dynamic GTK function table will be used
to access the basic functionality of GTK. At startup time, dlopen/dlsym
will be used to populate the function table. JFX code in Glass/GTK
will be modified to call through the function table. As needed
"shim" functions will be created as needed to isolate and handle
API changes.
A system property will be created that will contain the desired
order for GTK discovery. It will be possible for a user to specify
the property to force GTK2 or GTK3 usage.
Documentation will need to be added for this property.
In some cases we will be able to set the default order to hide what
is happening, and just work. For example in the case of JFXPanel -
we can set the system property to indicate that only GTK2 may be
used, and so, if JFXPanel then causes the JFX runtime to be started,
the correct version will be selected. Note that in the case of
Application then JFXPanel, the FX runtime will already have been
started so if for some reason GTK3 has been selected, JFXPanel will
fail, unless the user specified the property.
Normally we will default the property to load GTK2, falling forward
to GTK3, if GTK2 is not present.
- blocks
-
JDK-8154546 Retire sun.misc.GThreadHelper
-
- Resolved
-
-
JDK-8089584 [SWT,Linux] FXCanvas will hang or crash on startup with swt-4.4 on Linux
-
- Closed
-
- is blocked by
-
JDK-8065658 Modernize the GTK3 Look and Feel implementation
-
- Closed
-
- relates to
-
JDK-8042110 gtk3 support for gtk-nimbus-engine
-
- Open
-
-
JDK-8145547 [AWT/Swing] Conditional support for GTK 3 on Linux
-
- Resolved
-
-
JDK-8145568 JEP 283: Enable GTK 3 on Linux
-
- Closed
-
-
JDK-8206246 [JavaFX] Backport GTK3 support on Linux to 8u
-
- Closed
-
-
JDK-8212147 [JavaFX] Backport GTK3 support on Linux to 8u
-
- Closed
-