Skip to content

feat(screenshot): use native cursor shapes - #3155

Merged
bbedward merged 3 commits into
duxlabs-dev:masterfrom
hthienloc:feat/screenshot-region-resize
Aug 23, 2026
Merged

bbedward merged 3 commits into
duxlabs-dev:masterfrom
hthienloc:feat/screenshot-region-resize

Conversation

@hthienloc

Copy link
Copy Markdown
Member

Port wp_cursor_shape_manager_v1 to the Go screenshot backend and use compositor-native cursor shapes for the region selector.

This establishes the cursor protocol layer for follow-up PRs that add Ctrl-drag selection behavior and transition between Crosshair, Grab, and Grabbing. This PR intentionally does not include the Ctrl-drag interaction itself.

@hthienloc

Copy link
Copy Markdown
Member Author

/claude review

Comment thread core/internal/screenshot/region.go Outdated
@claude

claude Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Claude review

Looks good — protocol wiring is correct; one minor resource-lifecycle note.

  • Cursor-shape device allocated/destroyed per event, and set twice on pointer enter; manager not destroyed in cleanup() — core/internal/screenshot/region.go:633

Checked: wp_cursor_shape_v1 opcodes (manager destroy=0/get_pointer=1, device destroy=0/set_shape=1), shape enum values (crosshair=8, grab=16, grabbing=17) and v1 bind, evdev keycodes 29/97 for Ctrl matching the existing 1/25/28/57/96 convention, Ctrl mod mask 4 alongside the existing shift mask 1, serial capture on pointer enter, fallback shm-cursor path, and cleanup/leak paths (a fresh wl connection per Run() closes via ctx.Close()). No QML, translation, go.mod or mock changes in the diff. Note movingSelection is never assigned, so the Grabbing branch is currently unreachable — expected given the PR defers the Ctrl-drag interaction. Model: claude-opus-5.

@@ -0,0 +1,64 @@
package wp_cursor_shape

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the XML spec included in the proto/xml directory and generate this file instead of hand writing it.

The README command is outdated and I'll fix that, but the command would look like this once the XML is added

go run github.com/AvengeMedia/dankgo/cmd/go-wayland-scanner@latest \
  -i internal/proto/xml/cursor-shape-v1.xml \
  -pkg wlr_gamma_control -o internal/proto/wp_cursor_shape/cursor_shape.go

@hthienloc
hthienloc force-pushed the feat/screenshot-region-resize branch from f221049 to ef591ca Compare August 23, 2026 17:33
@hthienloc

Copy link
Copy Markdown
Member Author

/claude review

@claude

claude Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found — the two review points from the last round are addressed.

Checked: the wp_cursor_shape binding against the vendored XML (manager destroy=0/get_pointer=1, device destroy=0/set_shape=1, shape enum 1–34, crosshair=8/grab=16/grabbing=17) and against the codegen style of the other internal/proto packages (uint32 enum args, MarkZombie destructors, arg-derived new_id var names) — consistent with scanner output; the device is now created once and cached, and both it and the manager are destroyed in cleanup() alongside the other bound globals; the duplicate set-shape on pointer enter is gone (cursorSerial captured, single refreshCursor() at the end of the handler); shm-cursor fallback still applies when the global is absent (region_input.go:33); serial is always the latest wl_pointer.enter serial as set_shape requires; Ctrl tracking via mod mask 4 and evdev 29/97 matches the existing shift/keycode conventions. No QML, translation, go.mod or mock changes.

Note (not blocking): the vendored cursor-shape-v1.xml omits the get_tablet_tool_v2 request that upstream v1 carries. Opcodes 0/1 are unaffected so the generated code is correct, and dropping it avoids needing a zwp_tablet_tool_v2 binding — just worth knowing the file is not byte-identical to upstream if it is ever re-synced.

movingSelection is still never assigned, so the Grabbing branch is unreachable; expected, since the PR defers the Ctrl-drag interaction.

Model: claude-opus-5.

@bbedward
bbedward merged commit 4d9d342 into duxlabs-dev:master Aug 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants