RFR: JDK-8227366: Wrong stage gets focused after modal stage creation

2019-07-31 Thread Thiago Milczarek Sayao
Please, review (and remove WIP):
https://github.com/javafxports/openjdk-jfx/pull/520
https://bugs.openjdk.java.net/browse/JDK-8227366

Thanks.


Re: Platform dependent behavior in Platform.startup()

2019-07-31 Thread Kevin Rushforth
While there is always a danger in calling a method that runs a lambda 
from a static init method, this seems like a case that should work. The 
current Mac implementation precludes returning from Platform::startup 
until after the Runnable passed into that method has completed and 
returned, which is not what was intended or expected.


Your solution seems like a good one, although it will need to be 
well-tested.


-- Kevin


On 7/31/2019 2:24 AM, Johan Vos wrote:

Hi,

A pattern I increasingly use is to add JavaFX functionality to existing
non-JavaFX applications. Rather than adding a class that extends
javafx.application.Application, I add some code to an existing class, like
this:

javafx.platform.Platform.startup(() -> {System.err.println("JavaFX
started");});
javafx.platform.Platform.runLater(() -> {Stage, Scene,... });

I noticed that having Platform.startup() in a class initialiser works fine
on Linux/Windows, but fails on Mac when a lambda is passed to startup().

The reason for this is that on Mac, the main thread that starts Glass
blocks until Glass has been started.
But starting Glass also contains running the argument passed to startup().
In case this is a lambda, this requires the encapsulating class to be
initialized -- but initializing this class is happening already but blocked
on Glass being started.

The other platforms (Windows/Linux) are less strict. They don't block on
Glass being started (including running the Runnable passed to startup)
before they return.

I created issue https://github.com/javafxports/openjdk-jfx/issues/542 for
this and I propose to fix it via PR
https://github.com/javafxports/openjdk-jfx/pull/543 which considers Glass
to be started *before* the supplied runnable is executed.

- Johan




Platform dependent behavior in Platform.startup()

2019-07-31 Thread Johan Vos
Hi,

A pattern I increasingly use is to add JavaFX functionality to existing
non-JavaFX applications. Rather than adding a class that extends
javafx.application.Application, I add some code to an existing class, like
this:

javafx.platform.Platform.startup(() -> {System.err.println("JavaFX
started");});
javafx.platform.Platform.runLater(() -> {Stage, Scene,... });

I noticed that having Platform.startup() in a class initialiser works fine
on Linux/Windows, but fails on Mac when a lambda is passed to startup().

The reason for this is that on Mac, the main thread that starts Glass
blocks until Glass has been started.
But starting Glass also contains running the argument passed to startup().
In case this is a lambda, this requires the encapsulating class to be
initialized -- but initializing this class is happening already but blocked
on Glass being started.

The other platforms (Windows/Linux) are less strict. They don't block on
Glass being started (including running the Runnable passed to startup)
before they return.

I created issue https://github.com/javafxports/openjdk-jfx/issues/542 for
this and I propose to fix it via PR
https://github.com/javafxports/openjdk-jfx/pull/543 which considers Glass
to be started *before* the supplied runnable is executed.

- Johan