Skip to content

Capture the cursor at the enlarged pointer size on Windows - #21

Merged
Marc-André Moreau (mamoreau-devolutions) merged 1 commit into
masterfrom
copilot/fix-enlarged-cursor-capture
Nov 2, 2026
Merged

Marc-André Moreau (mamoreau-devolutions) merged 1 commit into
masterfrom
copilot/fix-enlarged-cursor-capture

Conversation

@mamoreau-devolutions

Copy link
Copy Markdown
Contributor

User feedback: with an enlarged mouse pointer (Settings > Accessibility > Mouse pointer > Size), recorded video showed the standard-size pointer.

Cause

GetCursorInfo returns cursor handles with their nominal 32 px bitmaps. The system enlarges the pointer only when it draws it, so DrawIconEx drew the small cursor. The standalone cursor image used for cursor-as-object was also hardcoded to a 64 px box, which would cut off larger cursors.

Fix (crates/jiffshot-capture/src/win/screen.rs)

  • Read the pointer size with SPI_GETCURSORBASESIZE (0x2028, undocumented, default 32). When it's above 32, CursorSnapshot::take copies the cursor at the larger size with CopyImage(..., LR_COPYFROMRESOURCE) so it uses the cursor file's sharp large image. If that fails, it falls back to a stretched copy. The hotspot comes from the scaled copy.
  • draw_onto draws at the snapshot's real size, and image() sizes its frame from the cursor instead of a fixed 64 px.
  • This applies to both recordings and screenshots, which share CursorSnapshot.

Verification

  • New unit tests: no copy is made at the default size, the image and hotspot scale correctly, and the image covers the whole enlarged cursor.
  • Manual check: I temporarily set the pointer size to 96 and compared against a Windows.Graphics.Capture frame. The system draws the arrow at about 38×57 px. The snapshot is now 96×96 with a visible area of about 34×56 at the correct hotspot. Before the fix it was 12×19. At the default size the output is the same as before.
  • On a 120-DPI monitor, the drawn cursor did not scale with DPI, so only the pointer size is applied.

Cursor handles keep their nominal 32 px bitmaps; the system enlarges the
pointer only when drawing it, so screenshots and recordings showed the
standard-size cursor. Scale the snapshot by the accessibility pointer size
(SPI_GETCURSORBASESIZE), preferring the cursor file's larger image, and size
the standalone cursor image from the icon instead of a fixed 64 px.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) merged commit fe2f309 into master Nov 2, 2026
14 checks passed
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) deleted the copilot/fix-enlarged-cursor-capture branch November 2, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant