Skip to content

screencopy: add support for separate cursor capturing

Quantum requested to merge github/fork/quantum5/scpy-pointer into master

This is a proposal for the version 4 of the screencopy protocol, which will support separate cursor capturing. The intended use case would be for custom composition of the cursor after capture, which is suitable for applications like wayvnc or Looking Glass, and also implementing the metadata cursor mode for xdg-desktop-portal-wlr.

Judging by existing discussions, the ideal place to add this feature would be to the screencopy protocol, which is exactly what is done here.

Issues regarding software cursors has been brought up here. I think there is no real nice solution to capture software cursors separately, nor does it make sense to try. An application could always draw what looks like a cursor on the screen, which could also be nowhere near the actual pointer location. Therefore, specifying 0 for overlay_cursor cannot guarantee no visible cursor appears in the captured image.

Instead, I think the solution is to capture only hardware cursors separately, and if that is not possible, then we simply report that the cursor is invisible and have it be composed onto the screen. This works for all custom composition use cases. This approach is also taken by other capturing APIs, such as DXGI Desktop Duplication on Windows.

Implementation-wise, this should be fairly simple. The existing capture_output and capture_output_region can remain unchanged. capture_cursor can be implemented by reading the hardware cursor, and zwlr_screencopy_pointer_reporter_v1 can be implemented by a few calls in wlr_seat_pointer.c.

/cc @emersion @any1 @Xyene

Merge request reports

Loading