Add follow-the-cursor multi-monitor cursor support#40
Conversation
On Wayland compositors (e.g. COSMIC/cosmic-comp) an absolute pointer device
is confined to a single output, so reframe's per-monitor servers could not
move the system cursor between monitors. This adds a "follow the stream"
behaviour:
- The streamer publishes which monitor currently shows the cursor (detected
from the DRM cursor plane each frame) to a shared, flock-guarded file
(/run/reframe/cursor-owner).
- On a pointer event for a monitor that does NOT currently hold the cursor,
the streamer emits one short relative burst on a dedicated relative-only
uinput device ("reframe-rel") to relocate the cursor onto this monitor
(a single large REL_X is ignored/capped by libinput; many small steps a
few ms apart are honoured — see AlynxZhou#36), then forwards the absolute event
unchanged for precise in-monitor positioning.
Within a monitor there is no relative motion at all (pure absolute), so
normal movement stays smooth and pixel-accurate.
New config key: position-x (the monitor's real desktop X position), kept
separate from monitor-x so absolute scaling stays full-range per monitor.
Known limitation: cross-monitor drag-and-drop is not handled.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Hi @AlynxZhou, a transparency note up front. This PR was implemented with AI assistance, and I want to be straight about that given your I believe I land on the "unless" side of that line, and I'll own it:
I'm a responsible human, and I'll engage with your review personally and in my own words. If you'd do any of it differently, say so and I'll revise. Thanks for reframe; it's the foundation all of this builds on. |
|
I don't think you really understand why we have to mapping pointer position. I don't use COSMIC, and AFAIK a mouse with more than 1 monitors for most desktops is:
So before reviewing the code, you need to tell me what you are going to solve: Do you mean COSMIC behave differently from other desktops? If they are the only one doing that, you should ask them first for following other desktop's behavior. I checked your code, while I cannot say the logic is good or bad, I think you should not change the meaning of current config keys, |
|
I've tested KDE/GNOME. They follow the behavior I said, don't know how COSMIC behaves. |
| // Publish ourselves as the owner. When the cursor is on | ||
| // the other monitor, our CRTC has no cursor plane, so we | ||
| // don't publish and the other streamer claims it. | ||
| cursor_owner_publish(this); |
There was a problem hiding this comment.
Obviously this is not enough, not all implementations have/use cursor plane.
What this does
ReFrame runs one server per monitor, but on Wayland compositors (e.g. COSMIC/
cosmic-comp) an absolute pointer device is confined to a single output, so the system cursor can't move between monitors. This adds "follow the cursor":/run/reframe;uinputdevice (a single largeREL_Xis ignored/capped by libinput; many small steps a few ms apart are honored; related to Can't control mouse #36), then forwards the absolute event for precise placement;New per-monitor config key
position-x(the monitor's real desktop X position), kept separate frommonitor-xso absolute scaling stays full-range per monitor. Documented indists/example.conf. The existing device stays absolute-only; the relative-only device is added specifically to avoid the absolute+relative same-device problem from #36.Tested
Pop!_OS 24.04, COSMIC (
cosmic-comp), Wayland, NVIDIA open kernel module 580.159.03, two monitors (1920×1080 + 1680×1050), VNC via libvncserver, client = Apache Guacamole. Verified crossing and precise in-monitor positioning in both directions and from either monitor's stream.Not tested / out of scope
cosmic-comp; other Wayland compositors and X11 untested.Happy to adjust the approach or naming to fit the project's conventions.