Skip to content

Hover popup appears on the wrong monitor #1

Description

@Tricked-dev

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

  1. Start mpv as a native Wayland window on one monitor.
  2. Move the pointer between native Wayland and X11/XWayland applications on different monitors.
  3. Return to mpv and hover a Japanese subtitle token.
  4. 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:

gpu-context=x11egl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions