boxpointer: Swap arrow alignment on RTL

The current code uses the arrow alignment to align the menu between
the top/left (0) and bottom/right(1), regardless of the text direction.

Instead of adjusting code everywhere, reinterpret the parameter
to refer to start/end instead, and swap the alignment with an
RTL text direction.

Credit to Sebastian Keller for spotting the cause of the issue.

Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5261
Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7356

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3150>
This commit is contained in:
Florian Müllner 2024-01-29 17:41:54 +01:00
parent e889bff1c6
commit 4e70315fbb

View File

@ -533,6 +533,9 @@ export const BoxPointer = GObject.registerClass({
switch (this._arrowSide) { switch (this._arrowSide) {
case St.Side.TOP: case St.Side.TOP:
case St.Side.BOTTOM: case St.Side.BOTTOM:
if (this.text_direction === Clutter.TextDirection.RTL)
alignment = 1.0 - alignment;
resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment); resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment);
resX = Math.max(resX, workarea.x + padding); resX = Math.max(resX, workarea.x + padding);