Skip to content

Sync with core 8535b032c (add screen capture bindings, Swift support, and Flutter example) - #75

Merged
lijy91 merged 5 commits into
mainfrom
feat/screen-capture
Dec 3, 2026
Merged

lijy91 merged 5 commits into
mainfrom
feat/screen-capture

Conversation

@lijy91

@lijy91 lijy91 commented Dec 1, 2026

Copy link
Copy Markdown
Member

Fresh PR based cleanly on main (supersedes #19).

Depends on libnativeapi/nativeapi-core#112 (core commit 8535b032c). Merge core first; refresh the core gitlink if core is squash-merged.

Summary

  • Expose CaptureSource, ScreenCapturer, and ScreenRecorder across all 7 language bindings (Dart, Rust, C#, JS/TS, Python, Go, and Swift) plus the website API reference (website/content/api/).
  • Add static-only class codegen support (Class::is_static()) across C ABI and all bindings, including idiomatic caseless public enum ScreenCapturer in Swift.
  • Update native link settings in bindings/dart/cnativeapi/hook/build.dart, bindings/rust/cnativeapi/build.rs, and bindings/swift/Package.swift (weak-linking ScreenCaptureKit on macOS; adding WGC / D3D11 / Media Foundation libraries on Windows).
  • Add specs/screen-capture.md and examples/flutter_screen_capture_example.

Verification (macOS)

  • ./codegen check: passed (85 C ABI files, 426 binding/reference files, 0 new skipped APIs)
  • cargo test --manifest-path tools/codegen/Cargo.toml: 32 passed
  • Core: cmake --build + ctest -R screen_capture_test passed
  • Dart / Flutter: dart analyze (nativeapi) + flutter analyze (flutter_screen_capture_example) passed
  • Rust: cargo test -p nativeapi --test screen_capture passed
  • Swift: swift build + swift test (6 passed)
  • C#: dotnet build NativeAPI.slnx (0 warnings, 0 errors)
  • JS/TS: npx tsc -p tsconfig.json --noEmit passed
  • Go: cmake --build bindings/go/build + go test -run "Screen|Capture|Record" passed
  • Python: cmake --build bindings/python/build + pytest tests/test_screen_capture.py (2 passed)

Freeze the display under the window, then let the user drag, move and
resize a selection in a full-display overlay and copy, save or keep the
cropped image.

On macOS the overlay sits above the menu bar and Dock and appears without
flicker: the window hides without AppKit's fade-and-shrink, the frozen
frame is decoded before the overlay shows, and the window stays
transparent until Flutter has rendered at the new size.
@lijy91
lijy91 merged commit 3ef9343 into main Dec 3, 2026
30 of 31 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.

1 participant