RFR: 8176813: Mac: Failure to exit full-screen programmatically in some cases

Martin Fox mfox at openjdk.org
Tue Apr 29 17:14:52 UTC 2025


On Mon, 28 Apr 2025 20:54:25 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> question: could this deferral of runnables cause some kind of race condition in respect to other synchronous changes? Like, for example, trying to hide the window while is being transitioned to or from full screen?

One of the goals of this PR is to try to avoid making calls on the NSWindow during the transition. In general the OS either rejects the call or it triggers a bug of some sort.

I can only think of two ways for an NSWindow change request to come in during the transition. One is a runLater runnable getting fired by the event loop. This PR fixes that. The other route is if the OS sends us a notification in the middle of the transition. A JavaFX change listener or event handler could make a call that affects the NSWindow. Luckily it looks like the OS takes mercy on us and doesn't send us notifications mid-transition. For example, it doesn't notify us that the NSWindow's size or position has changed until the transition is done. So I think this PR would make it very hard to even attempt to do something like hide the window during the transition.

Beyond that this PR just shifts the execution of these runnables to a later point which matches when they would be executed on Windows or Linux. So if there's an issue with the order in which modifications to the stage are executed I think it would be similar across platforms.

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

PR Comment: https://git.openjdk.org/jfx/pull/1797#issuecomment-2839632677


More information about the openjfx-dev mailing list