@desklink/host 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +3 -0
- package/README.md +63 -15
- package/bin/desklink-host.mjs +12 -4
- package/dist/engineProcess.d.ts +6 -1
- package/dist/engineProcess.d.ts.map +1 -1
- package/dist/engineProcess.js +34 -4
- package/dist/engineProcess.js.map +1 -1
- package/dist/protocol.d.ts +32 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/resolveEngine.d.ts +6 -0
- package/dist/resolveEngine.d.ts.map +1 -1
- package/dist/resolveEngine.js +45 -6
- package/dist/resolveEngine.js.map +1 -1
- package/docs/PROTOCOL.md +119 -6
- package/engine/Cargo.lock +2 -2
- package/engine/Cargo.toml +7 -12
- package/engine/build.rs +61 -5
- package/engine/native/agent_overlay_mac.m +51 -4
- package/engine/native/agent_overlay_wayland.c +145 -12
- package/engine/native/agent_overlay_x11.c +72 -0
- package/engine/src/capture.rs +92 -3
- package/engine/src/capture_win.rs +23 -0
- package/engine/src/clipboard_win.rs +8 -0
- package/engine/src/cursor.rs +118 -0
- package/engine/src/indicator.rs +104 -3
- package/engine/src/input_win.rs +91 -0
- package/engine/src/keymap_win.rs +39 -0
- package/engine/src/mac.rs +28 -6
- package/engine/src/main.rs +165 -23
- package/engine/src/portal.rs +42 -4
- package/engine/src/portal_win.rs +37 -0
- package/engine/src/protocol.rs +49 -0
- package/engine/src/session.rs +467 -17
- package/engine/src/win.rs +110 -0
- package/engine/src/x11.rs +15 -0
- package/package.json +4 -4
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//! Windows host command entry point; native desktop access remains unavailable.
|
|
2
|
+
|
|
3
|
+
use serde_json::{json, Value};
|
|
4
|
+
|
|
5
|
+
pub fn capabilities() -> Value {
|
|
6
|
+
let mut value = json!({
|
|
7
|
+
"protocol": 3,
|
|
8
|
+
"engine": format!("desklink-host/{}", env!("CARGO_PKG_VERSION")),
|
|
9
|
+
"platform": "windows",
|
|
10
|
+
"session": { "kind": "windows" },
|
|
11
|
+
"x11": { "available": false },
|
|
12
|
+
"capture": {
|
|
13
|
+
"mechanism": "unavailable",
|
|
14
|
+
"backends": [],
|
|
15
|
+
"formats": [],
|
|
16
|
+
"cursor": "unavailable",
|
|
17
|
+
"cursor_modes": [],
|
|
18
|
+
"audio": false,
|
|
19
|
+
"displays": crate::portal::displays(),
|
|
20
|
+
"grant": "unavailable",
|
|
21
|
+
"unavailable_reason": {
|
|
22
|
+
"reason": crate::capture::unavailable_reason(),
|
|
23
|
+
"remedy": "Use a future Windows capture-enabled build."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"encode": {
|
|
27
|
+
"codecs": [],
|
|
28
|
+
"hardware": false,
|
|
29
|
+
"unavailable_reason": {
|
|
30
|
+
"reason": "Windows encoding is not implemented in this build; libvpx is not linked.",
|
|
31
|
+
"remedy": "Use a future Windows VP9-enabled build."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"encoded": { "codecs": [] },
|
|
35
|
+
"input": {
|
|
36
|
+
"mechanism": "unavailable",
|
|
37
|
+
"pointer": false,
|
|
38
|
+
"wheel": false,
|
|
39
|
+
"keyboard": false,
|
|
40
|
+
"text": [],
|
|
41
|
+
"layout": crate::keymap::keyboard_layout(),
|
|
42
|
+
"grant": "unavailable",
|
|
43
|
+
"unavailable_reason": {
|
|
44
|
+
"reason": crate::input::unavailable_reason(),
|
|
45
|
+
"remedy": "Use a future Windows input-enabled build."
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"clipboard": {
|
|
49
|
+
"read": false,
|
|
50
|
+
"write": false,
|
|
51
|
+
"mime": [],
|
|
52
|
+
"maxBytes": crate::clipboard::MAX_CLIPBOARD_BYTES,
|
|
53
|
+
"unavailable_reason": {
|
|
54
|
+
"reason": "Windows clipboard transfer is not implemented in this build.",
|
|
55
|
+
"remedy": "Use a future Windows clipboard-enabled build."
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if cfg!(desklink_vpx) {
|
|
60
|
+
value["encode"] = json!({"codecs": ["vp9"], "hardware": false,
|
|
61
|
+
"h264": {"encoder": null, "hardware": false}});
|
|
62
|
+
value["encoded"] = json!({"codecs": ["h264"]});
|
|
63
|
+
}
|
|
64
|
+
value
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
pub fn run() -> i32 {
|
|
68
|
+
let command = std::env::args()
|
|
69
|
+
.nth(1)
|
|
70
|
+
.unwrap_or_else(|| String::from("help"));
|
|
71
|
+
match command.as_str() {
|
|
72
|
+
"version" | "--version" | "-V" => println!("{}", env!("CARGO_PKG_VERSION")),
|
|
73
|
+
"capabilities" => {
|
|
74
|
+
#[cfg(desklink_vpx)]
|
|
75
|
+
let value = crate::session::capabilities();
|
|
76
|
+
#[cfg(not(desklink_vpx))]
|
|
77
|
+
let value = capabilities();
|
|
78
|
+
println!("{}", serde_json::to_string_pretty(&value).unwrap());
|
|
79
|
+
}
|
|
80
|
+
"serve" => {
|
|
81
|
+
#[cfg(desklink_vpx)]
|
|
82
|
+
{
|
|
83
|
+
let runtime = match tokio::runtime::Builder::new_multi_thread()
|
|
84
|
+
.enable_all()
|
|
85
|
+
.build()
|
|
86
|
+
{
|
|
87
|
+
Ok(runtime) => runtime,
|
|
88
|
+
Err(error) => {
|
|
89
|
+
eprintln!("error: cannot start the runtime: {error}");
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return crate::report(runtime.block_on(crate::serve()));
|
|
94
|
+
}
|
|
95
|
+
#[cfg(not(desklink_vpx))]
|
|
96
|
+
{
|
|
97
|
+
eprintln!("serve requires a VP9-enabled build; set DESKLINK_VPX_STATIC_DIR when building on Windows");
|
|
98
|
+
return 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
"help" | "--help" | "-h" => {
|
|
102
|
+
println!("desklink-host — Windows host preview\n\nCommands: version, capabilities, serve\nWindows session serving requires a static libvpx build.");
|
|
103
|
+
}
|
|
104
|
+
_ => {
|
|
105
|
+
eprintln!("unknown command: {command}; run desklink-host --help");
|
|
106
|
+
return 2;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
0
|
|
110
|
+
}
|
package/engine/src/x11.rs
CHANGED
|
@@ -349,6 +349,21 @@ impl X11Desktop {
|
|
|
349
349
|
.context("the X11 connection dropped")
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
/// Query the root pointer independently of pixel damage. GetImage and
|
|
353
|
+
/// MIT-SHM do not contain the server cursor and we never composite it.
|
|
354
|
+
pub fn cursor_position(&self) -> Result<(i32, i32, bool)> {
|
|
355
|
+
let pointer = self.connection.query_pointer(self.root)?.reply()?;
|
|
356
|
+
Ok((
|
|
357
|
+
i32::from(pointer.root_x),
|
|
358
|
+
i32::from(pointer.root_y),
|
|
359
|
+
pointer.same_screen
|
|
360
|
+
&& pointer.root_x >= 0
|
|
361
|
+
&& pointer.root_y >= 0
|
|
362
|
+
&& (pointer.root_x as usize) < self.width
|
|
363
|
+
&& (pointer.root_y as usize) < self.height,
|
|
364
|
+
))
|
|
365
|
+
}
|
|
366
|
+
|
|
352
367
|
pub fn move_pointer(&self, x: i64, y: i64) -> Result<()> {
|
|
353
368
|
let (x, y) = self.clamp(x, y);
|
|
354
369
|
self.connection
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desklink/host",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Per-user, on-demand desktop capture, encode and input engine with a versioned local control protocol",
|
|
6
6
|
"type": "module",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"node": ">=22"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"ws": "
|
|
33
|
+
"ws": "8.21.3"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@desklink/host-linux-x64-gnu": "0.3.
|
|
37
|
-
"@desklink/host-darwin-arm64": "0.3.
|
|
36
|
+
"@desklink/host-linux-x64-gnu": "0.3.1",
|
|
37
|
+
"@desklink/host-darwin-arm64": "0.3.1"
|
|
38
38
|
}
|
|
39
39
|
}
|