On Wed, 6 Aug 2025 19:03:54 GMT, Martin Fox <m...@openjdk.org> wrote:

>> There is `Util::waitForIdle(scene, pulseCount)`.
>> 
>> The real question is how to account for the platform-dependent transitions 
>> (which may take some time) reliably.  Waiting for a set amount of time might 
>> work, but we have to pick a good timeout value.  Is there any other 
>> possibility?
>> 
>> I am ok with 800ms - it feels like it should be long enough for any 
>> transition to take place.
>
> Changes to the maximized state are synchronous on all platforms. By the time 
> `runAndWait` returns the window should be maximized. On Mac and Windows the 
> JavaFX window state properties should be up-to-date because the OS 
> notifications are also synchronous. I added waitForIdle because on Linux the 
> configure events might come in later but we only need to wait long enough for 
> the event loop to receive the events. That should be far less than 800ms.
> 
>> The real question is how to account for the platform-dependent transitions 
>> (which may take some time) reliably.
> 
> I can't think of any window attribute change that performs an asynchronous 
> transition (but maybe I'm forgetting one). runAndWait should be enough on Mac 
> and Windows. On Linux you need to give the event loop a chance to spin a few 
> times.
> 
> The only real issue is (was?) fullscreen on macOS. The wait isn't really for 
> the transition (it's done by the time setFullScreen returns) but to avoid 
> scheduling deferred Runnables that might execute during the transition. 
> That's less of an issue since #1797 was integrated.

Yes, full-screen is the one I know does (or did) have some async behavior. If 
maximize is reliably synchronous then OK to keep the test the way you have it.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1860#discussion_r2258142820

Reply via email to