Skip to content

🧹 Refactor overly long native_screen_content_hash function - #41

Open
undivisible wants to merge 2 commits into
mainfrom
refactor-windows-capture-16484026348671401474
Open

🧹 Refactor overly long native_screen_content_hash function#41
undivisible wants to merge 2 commits into
mainfrom
refactor-windows-capture-16484026348671401474

Conversation

@undivisible

@undivisible undivisible commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🎯 What: The Windows-specific code inside the native_screen_content_hash function in src/lib.rs was extracted into a new module file, src/windows_capture.rs.
💡 Why: The function was overly long (104 lines), largely due to the Windows API calls for screen capture. This refactoring improves maintainability by segregating OS-specific logic into separate files, mirroring existing patterns (e.g., linux_input.rs, macos_capture.rs).
Verification: Verified by compiling the project with cargo check, formatting the code with cargo fmt, and successfully running the test suite with cargo test --lib.
Result: A more readable src/lib.rs file and better isolated platform-specific logic.


PR created automatically by Jules for task 16484026348671401474 started by @undivisible


Note

Low Risk
Behavior-preserving refactor of Windows screen hashing with no API or protocol changes.

Overview
Moves the Windows GDI virtual-screen capture and SHA-256 hashing logic out of native_screen_content_hash in lib.rs into a new windows_capture module, which lib.rs now calls on Windows builds.

This is a structural change only—the capture dimensions, pixel read path, and hash inputs (origin, size, pixel buffer) stay the same, aligning Windows with how Linux and macOS keep platform code in dedicated files.

Also fixes indentation in a CLI integration test helper.

Reviewed by Cursor Bugbot for commit a03b89f. Configure here.

Extracted the Windows-specific logic from `native_screen_content_hash`
into a new module `windows_capture`. This reduces the complexity
of `native_screen_content_hash` inside `src/lib.rs` and improves
readability.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…lure

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
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.

1 participant