Repository navigation
Conversation
|
@akurtakov in case you have time, please review, its in two commits to separate the two different changes, the first one is a protection against bad callers, the second the fix for the issue. |
There was a problem hiding this comment.
Pull request overview
Anchors GTK3 Wayland coordinates to monitor origins and prevents invalid negative shell allocations.
Changes:
- Aligns shell, control, cursor, and menu coordinates with monitor geometry.
- Converts display coordinates back before native positioning.
- Clamps shell content allocations to non-negative sizes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Shell.java |
Anchors shell coordinates and hardens allocation sizing. |
Menu.java |
Converts popup positions to shell-relative coordinates. |
Display.java |
Anchors cursor coordinates to a monitor. |
Control.java |
Adds monitor-aware coordinate conversion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fdfe5fb to
11e33fc
Compare
c9af240 to
cae94f1
Compare
cae94f1 to
14721d1
Compare
785e864 to
02d3bf8
Compare
|
Needs manual rebase. |
02d3bf8 to
4b6d43a
Compare
|
I'm using this patch since weeks in my custom IDE build and plan to merge this tomorrow unless I hear otherwise. |
4b6d43a to
2cc53e9
Compare
|
I don't have the multimonitor setup to properly test but my claude analysis pointed few things, it would be nice to try them just so we are sure: Blocking
Should fix
|
2cc53e9 to
2739f90
Compare
|
Thanks, updated the commit.
|
2739f90 to
c6326ea
Compare
c6326ea to
f637c0f
Compare
|
Addressed the Copilot findings in the updated commit:
|
f637c0f to
8be39a7
Compare
|
All findings are handled in 8be39a7:
|
8be39a7 to
61a8799
Compare
|
Fixed |
61a8799 to
9910235
Compare
9910235 to
2273e4e
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new tests do not deterministically exercise Wayland with a nonzero monitor origin, so they cannot catch the reported regression on standard CI layouts.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (1)
| public void test_popupLocationRoundTrip() { | ||
| // JFace reuses one popup: position, show, hide, reposition. Every pass has to round-trip, | ||
| // including the ones where the shell is still mapped. See issue 3539. | ||
| assumeTrue(SwtTestUtil.isGTK && !SwtTestUtil.isGTK4()); |
945ee64 to
1767421
Compare
Wayland never tells a client where its window is, so gdk_window_get_origin returns window relative values while Monitor geometry is global. Code that clips a location against a monitor then mixes two coordinate spaces. The JFace information controls do exactly that. With a monitor layout whose client areas do not start near y=0, every anchor is rejected: hovers come up empty and the content assist javadoc popup lands on a different monitor. Wayland does report which monitor a surface is on. Anchor display coordinates to that origin, and remove it again when positioning a window or a menu. Display.getCursorLocation(), the MenuDetect event and DropTarget event coordinates get the same treatment, since callers compare them against Control.toDisplay() or convert them with toControl(). The cursor location takes its anchor from the shell under the pointer and no longer adds popup positions, which the pointer lookup already includes. Balloon ToolTips, the IME preedit window and the Tracker overlay remove the origin before gtk_window_move(), and Tracker(Display) adds it to its pointer positions. The Tracker overlay spans all monitors on GTK3 Wayland, including those at a negative origin. The accessibility callbacks that translate ATK window coordinates for the Accessible listeners add the same anchor to the toplevel origin, since the listeners answer with toDisplay() coordinates. Each toplevel window is anchored to its own monitor. An ON_TOP popup shares the anchor of its parent, since it is positioned relative to it and one that is hidden or straddles a monitor edge gets a guessed or a different monitor of its own. A child dialog uses its parent's anchor until it is shown. The window's position within its monitor is still unknown. Popups are placed relative to their parent and unaffected by that remaining error. The anchor is also not known before the root shell is realized and changes without an SWT.Move event when the root shell moves to another monitor, so display coordinates taken across either of these are off by the monitor origin. X11 and GTK4 are unchanged. The two tests pass on a single monitor whose origin is 0,0, so they only bite on a multi-monitor Wayland session, but test_popupLocationRoundTrip covers the reuse cycle that JFace performs, which is where a wrong anchor shows up. Both are GTK3 only, since GTK4 toDisplay() is still shell relative. Fixes eclipse-platform#3539 Fixes eclipse-platform#538 Assisted-by: multiple AI agents and layers of automated tooling 🤖
1767421 to
966d12d
Compare



On Wayland a client is never told where its window is, so SWT returned window relative display coordinates while
Monitorgeometry stayed global. Anything that clips a location against a monitor was therefore mixing two coordinate spaces, which the JFace information controls do: on a multi-monitor layout whose client areas do not start near y=0, every candidate position is rejected, so javadoc hovers came up empty and the content assist javadoc popup opened on a different monitor.Wayland does tell us which monitor a surface is on, so display coordinates are now anchored to that monitor origin and the offset is removed again when a window or menu is positioned. A whole shell tree uses the monitor of its root toplevel as the one anchor, since child shells are positioned relative to their parent and a hidden or edge-straddling popup reports no or a different monitor of its own.
Display.getCursorLocation()is anchored the same way, since callers compare it againstControl.toDisplay().Fixes #3539
Fixes #538
The reporter of #3539 confirmed both the empty hovers and the misplaced content assist popup are gone on their three monitor setup. #538 is the same root cause reported from several setups, all of them with a second monitor whose top edge is not aligned with the primary, and all of them worked around by aligning the monitors. The window position within its monitor is still unknown, but popups are placed relative to their parent and unaffected by that. X11 and GTK4 are unchanged.