Repository navigation
Conversation
ext-image-copy-capture-v1 lets a client ask, with a pointer cursor session on an output or a toplevel, whether and where the pointer is on it: the standard way for a screenshot tool to take the screen under the pointer, since Wayland says nothing of the pointer outside a client's own surfaces. ShojiWM made no cursor session at all. Keep them, give each the pointer's place in its source's buffer after every motion and output change, and announce cursor buffer constraints so smithay keeps the sessions (cursor frames themselves still fail).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Wayland tells a client nothing about the pointer outside its own surfaces. The standard way for a screenshot tool to find the screen (or the window) under the pointer is an ext-image-copy-capture-v1 pointer cursor session on an output or a toplevel: the session sends
enter,positionandleave. ShojiWM created no cursor session at all. smithay keeps a cursor session only when the handler returns buffer constraints for it, and the default returns none.Fix
handlers/mod.rs:cursor_capture_constraintsreturns constraints for a source that resolves to a size: a square of the cursor theme size times the source's scale,Argb8888shm. The cursor image itself is not rendered yet: cursor frames still fail through the trait's defaultcursor_frame.new_cursor_sessionkeeps the session and sends the current position at once.cursor_session_destroyeddrops it.ShojiWM::update_cursor_capture_sessionssets each session's cursor position: the pointer's logical offset in the output or window geometry, scaled to the source's buffer size, orNonewhen the pointer is not on the source. Captures are rendered upright, so no transform is applied. smithay sends events only for changes.source_window,source_scaleandcursor_position_on_source.state.rs: new fieldimage_copy_cursor_sessions. The update runs afterwarp_cursor_to_output_center, and after an output configuration is applied (an output that moves or changes scale moves the pointer on it).input.rs: the update runs after pointer motion (request_redraw_for_pointer_motion) and inforward_locked_pointer_motion.Tests
New integration test
src/shojiwm_rs/tests/cursor_capture_session.rs,cursor_session_follows_the_pointer_on_its_output: with the pointer off the only output, the session sends nothing; moving onto it givesenterandposition(100, 200); a second motion gives onlyposition; moving off givesleave.cargo test --workspacepasses, except two tests that also fail on upstreammainin our environment:evaluator::tests::embedded_runtime_ipc_does_not_leak_fds_across_reloadsandinput_method_keyboard_grab_gets_the_keymap_of_the_keys_it_is_sent.This change has been running daily in the author's own session (a Windows-7-like desktop on ShojiWM).