Detailed changes
@@ -750,6 +750,21 @@ dependencies = [
"winx",
]
+[[package]]
+name = "capture"
+version = "0.1.0"
+dependencies = [
+ "block",
+ "cocoa",
+ "core-foundation",
+ "core-graphics",
+ "foreign-types",
+ "gpui",
+ "log",
+ "objc",
+ "simplelog",
+]
+
[[package]]
name = "castaway"
version = "0.1.2"
@@ -0,0 +1,21 @@
+[package]
+name = "capture"
+version = "0.1.0"
+edition = "2021"
+description = "An example of screen capture"
+
+[package.metadata.bundle]
+name = "Capture"
+identifier = "dev.zed.Capture"
+
+[dependencies]
+gpui = { path = "../gpui" }
+
+block = "0.1"
+cocoa = "0.24"
+core-foundation = "0.9.3"
+core-graphics = "0.22.3"
+foreign-types = "0.3"
+log = { version = "0.4.16", features = ["kv_unstable_serde"] }
+objc = "0.2"
+simplelog = "0.9"
@@ -0,0 +1,3 @@
+fn main() {
+ println!("cargo:rustc-link-lib=framework=ScreenCaptureKit");
+}
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cargo bundle
+TTY=`tty`
+open ../../target/debug/bundle/osx/Capture.app --stdout $TTY --stderr $TTY
@@ -33,10 +33,12 @@ fn main() {
unsafe {
let block = ConcreteBlock::new(move |content: id, error: id| {
- println!("got response with shareable content");
- dbg!(content);
- dbg!(error);
- dbg!(string_from_objc(msg_send![error, localizedDescription]));
+ println!(
+ "got response with shareable content {:?} {:?} {:?}",
+ content,
+ error,
+ string_from_objc(msg_send![error, localizedDescription]),
+ )
});
let _: id = msg_send![
@@ -12,11 +12,6 @@ doctest = false
[features]
test-support = ["backtrace", "dhat", "env_logger", "collections/test-support"]
-[package.metadata.bundle.example.capture]
-name = "Capture"
-identifier = "rs.gpui.examples.Capture"
-description = "An example of screen capture"
-
[dependencies]
collections = { path = "../collections" }
gpui_macros = { path = "../gpui_macros" }
@@ -9,9 +9,6 @@ fn main() {
compile_context_predicate_parser();
compile_metal_shaders();
generate_shader_bindings();
-
- // Support screen capture
- println!("cargo:rustc-link-lib=framework=ScreenCaptureKit");
}
fn generate_dispatch_bindings() {
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-cargo bundle --example capture
-open ../../target/debug/examples/bundle/osx/Capture.app