Issue body
I ran into a multi-monitor positioning issue on KDE Plasma Wayland where the dictionary popup can open on a different monitor from the mpv window and hovered subtitle.
Environment
- JitenMPV 0.1.1 /
master at 015b58c
- Linux
- KDE Plasma Wayland
- Multi-monitor setup
- mpv using its native Wayland presentation path
- JitenMPV companion running through XWayland
Steps to reproduce
- Start mpv as a native Wayland window on one monitor.
- Move the pointer between native Wayland and X11/XWayland applications on different monitors.
- Return to mpv and hover a Japanese subtitle token.
- Wait for the JitenMPV dictionary popup.
Expected behavior
The popup opens on the monitor containing mpv and the hovered subtitle.
Actual behavior
The popup can open on the monitor containing the last pointer position known to XWayland instead.
Workaround
Forcing mpv to use XWayland keeps X11's global pointer state current while the pointer is over mpv:
This resolves the wrong-monitor symptom locally, but it means giving up mpv's native Wayland path.
Investigation notes
CursorPositionHelper.cs uses XQueryPointer to obtain a global point. AvaloniaPopupPresenter.cs then selects a screen from that point.
XWayland does not receive pointer movement over an unrelated native Wayland surface, so the returned point can belong to a previously used X11 window.
This appears to explain why the selected monitor is stale rather than random.
Possible direction
One option would be to pass mpv's own mouse coordinates and window-id to the companion, then translate the mpv-local point to root coordinates when mpv has an X11 window. If a reliable global point is unavailable on native Wayland, a deterministic fixed-anchor fallback would be safer than reusing stale X11
state.
I can test any proposed change on KDE Wayland with multiple monitors.
Issue body
I ran into a multi-monitor positioning issue on KDE Plasma Wayland where the dictionary popup can open on a different monitor from the mpv window and hovered subtitle.
Environment
masterat015b58cSteps to reproduce
Expected behavior
The popup opens on the monitor containing mpv and the hovered subtitle.
Actual behavior
The popup can open on the monitor containing the last pointer position known to XWayland instead.
Workaround
Forcing mpv to use XWayland keeps X11's global pointer state current while the pointer is over mpv:
gpu-context=x11eglThis resolves the wrong-monitor symptom locally, but it means giving up mpv's native Wayland path.
Investigation notes
CursorPositionHelper.csusesXQueryPointerto obtain a global point.AvaloniaPopupPresenter.csthen selects a screen from that point.XWayland does not receive pointer movement over an unrelated native Wayland surface, so the returned point can belong to a previously used X11 window.
This appears to explain why the selected monitor is stale rather than random.
Possible direction
One option would be to pass mpv's own mouse coordinates and
window-idto the companion, then translate the mpv-local point to root coordinates when mpv has an X11 window. If a reliable global point is unavailable on native Wayland, a deterministic fixed-anchor fallback would be safer than reusing stale X11state.
I can test any proposed change on KDE Wayland with multiple monitors.