JDK-8316419 : [macos] Setting X/Y makes Stage maximization not work before show
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: jfx11,8u152,9,jfx20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2023-09-18
  • Updated: 2023-11-17
  • Resolved: 2023-11-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx22 b16Fixed
Related Reports
Relates :  
Relates :  
Description
This issue came out as a part of recently added Stage Attributes test (see related issue).

When a new Stage is created and not yet shown, setting its X/Y coordinates and calling setMaximized(true) causes the latter to be ignored - Stage is created at requested X/Y spot, but does not maximize. This behavior works fine on Windows (Stage is maximized when show() is called).

Run attached test program to see the behavior. This was checked on macOS Ventura 13.5.1.
Comments
Changeset: f41e3ec0 Author: Martin Fox <beldenfox@users.noreply.github.com> Committer: Andy Goryachev <angorya@openjdk.org> Date: 2023-11-01 20:38:26 +0000 URL: https://git.openjdk.org/jfx/commit/f41e3ec02bdbdff1417ed20b8e02645348825e4d
01-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jfx/pull/1258 Date: 2023-10-12 05:52:04 +0000
12-10-2023

When the bounds of the window are set (before the platform window is made visible) the Mac glass code calls MacWindow.notifyMove. This takes a boolean indicating whether the window is already maximized or not. If not maximized MacWindow.notifyMove calls handleWindowEvent(WindowEvent.RESTORE). This makes the system think the window has entered the restored state so it sets the maximized and iconified properties to false. This all happens before the window is made visible. The core Java code doesn't even attempt to send the maximized property onto the platform until after the window is visible (see Stage.doVisibleChanged) at which point the original property value has been lost. The custom override of notifyMove was added to address JDK-8160241.
19-09-2023