🧹 Refactor overly long native_screen_content_hash function - #41
🧹 Refactor overly long native_screen_content_hash function#41undivisible wants to merge 2 commits into
Conversation
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>
|
👋 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 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>
🎯 What: The Windows-specific code inside the
native_screen_content_hashfunction insrc/lib.rswas 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 withcargo fmt, and successfully running the test suite withcargo test --lib.✨ Result: A more readable
src/lib.rsfile 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_hashinlib.rsinto a newwindows_capturemodule, whichlib.rsnow 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.