RFR: 8368021: Window buttons of extended RTL stage are on the wrong side

Andy Goryachev angorya at openjdk.org
Tue Sep 30 18:52:26 UTC 2025


On Sat, 27 Sep 2025 04:56:51 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

> When an extended stage is shown with RTL orientation (either using a RTL window + `Scene.nodeOrientation == INHERIT`, or using a LTR window and `Scene.nodeOrientation == RIGHT_TO_LEFT`), the default window buttons are placed on the wrong side of the window. This bug only manifests on Windows and Linux, both of which use `HeaderButtonOverlay` to render the default window buttons.
> 
> `HeaderButtonOverlay` is not a part of the scene graph, it is shown on top of the scene graph as an overlay (like the warning overlay that appears when entering full-screen mode). For [CSS-related reasons](https://github.com/openjdk/jfx/pull/1605#issuecomment-2967977276), the parent of an overlay is the scene root (but the scene root doesn't know that). This implementation detail can mess up the calculation of orientation flags and mirroring transforms in `Node`, as depending on the `NodeOrientation` of the root node, the code may mistakenly mirror (or not mirror) the orientation.
> 
> The solution I've come up with is as follows: the overlay node is marked with the `Node.INHERIT_ORIENTATION_FROM_SCENE` flag, which causes it to resolve its effective orientation against the scene only, and never against the root node. With this change, the effective orientation and mirroring transforms are computed correctly.
> 
> The easiest way to test this fix is with Monkey Tester -> Tools -> Stage Tester.

Works as expected on windows 11 (using the monkey tester).
No ill effects on macOS.

One minor suggestion.

Did not test on Linux - @Ziad-Mid could you please test on Linux?
Also, could you test the behavior on Windows in the RTL mode set by default?

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/ViewSceneOverlay.java line 53:

> 51:         this.scene = scene;
> 52:         this.painter = painter;
> 53:         this.subscription = Subscription.combine(

should this var be called `subscriptions` then?

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/ViewSceneOverlay.java line 55:

> 53:         this.subscription = Subscription.combine(
> 54:             scene.rootProperty().subscribe(this::onSceneRootChanged),
> 55:             scene.effectiveNodeOrientationProperty().subscribe(this::onEffectiveNodeOrientationInvalidated));

side note to @hjohn : 
would it make sense to add a `Subscription.subscribe(Runnable)` method for cases like this?

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

Marked as reviewed by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1921#pullrequestreview-3286140206
PR Review Comment: https://git.openjdk.org/jfx/pull/1921#discussion_r2392418600
PR Review Comment: https://git.openjdk.org/jfx/pull/1921#discussion_r2392424549


More information about the openjfx-dev mailing list