On Tue, 2 Feb 2021 00:30:07 GMT, Phil Race <p...@openjdk.org> wrote:

>> src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m line 53:
>> 
>>> 51: @implementation ThreadUtilities
>>> 52: 
>>> 53: + (void)initialize {
>> 
>> I think we need to check how this new modes will work when the AWT is 
>> embedded inside SWT and FX.
>
> We are just specifying an additional run mode for JDK internal use.
> It means that when we are saying to process only events for that mode, then 
> only those will be processed.
> And it is used only for nested event loops.
> Nothing eternal should be assuming AWT uses JNF at all, never mind in a 
> particular way.
> 
> There is a special case for FX but I don't see a problem.
> 
> If you look at Java_sun_lwawt_macosx_LWCToolkit_doAWTRunLoopImpl
> there's a variable "inAWT".
>          isRunning = [[NSRunLoop currentRunLoop] runMode:(inAWT ? [JNFRunLoop 
> javaRunLoopMode] : NSDefaultRunLoopMode) ... ]];
> 
> This is specified as
>         inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() 
> {
>             @Override
>             public Boolean run() {
>                 return 
> !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", 
> "false"));
>             }
>         });
>     }
> 
> So generally FX doesn't care, and is ignorant of this new mode.
> Unless you set that property to true, in which case AWT use the  
> NSDefaultRunLoopMode and so again FX is unaffected.
> Nothing in the FX sources goes anywhere near JNF .. or has a reference to the 
> special mode.
> 
> Bottom line I don't see it being affected. 
> 
> I'll check with Kevin but also Gerard had a lot to do with the creation of 
> the current FX toolkit.

I ran some tests embedding JavaFX into Swing and vice versa both with and 
without `-Djavafx.embed.singleThread=true` and I don't see any regression in 
behavior.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2305

Reply via email to