mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-17 09:10:41 +01:00
Host: accept the official text_input {content} action on any channel and type it on
X11 via spare-keycode Unicode keysyms (verified with xev); log non-CONTROL JSON
action names. Viewer: Windows-type hosts get only the case-10 text change (a rich
format list overwrote it and was never rendered), Mac gets only the rich offer.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
e4a2cc4698
commit
63ebb3e78a
9 files changed
+148
-15
No files matched your search
@@ -15,6 +15,9 @@ pub enum ControlInput {
|
||||
MouseAbsolute { x: f64, y: f64 },
|
||||
MouseRelative { dx: i32, dy: i32 },
|
||||
MouseScroll { dx: i32, dy: i32 },
|
||||
/// Official Windows host `text_input {content}` (KeyboardMouseRunner::execTextInput): text typed by the
|
||||
/// mobile clients' own input method. Never logged.
|
||||
TextInput { text: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
@@ -58,6 +61,11 @@ pub fn decode_control(data: &[u8]) -> Result<ControlMessage, String> {
|
||||
"mouse_move_relative" => ControlInput::MouseRelative {
|
||||
dx: integer(&v, "delta_x")?, dy: integer(&v, "delta_y")?,
|
||||
},
|
||||
"text_input" => {
|
||||
let text = v.get("content").and_then(Value::as_str).ok_or("CONTROL field content must be a string")?;
|
||||
if text.len() > 16 * 1024 { return Err("text_input content exceeds 16 KiB".into()); }
|
||||
ControlInput::TextInput { text: text.to_owned() }
|
||||
}
|
||||
"mouse_scroll" => ControlInput::MouseScroll {
|
||||
dx: integer(&v, "delta_x")?, dy: integer(&v, "delta_y")?,
|
||||
},
|
||||
@@ -137,6 +145,9 @@ mod tests {
|
||||
#[test]
|
||||
fn does_not_invent_actions_for_unknown_json() {
|
||||
assert!(matches!(decode_control(br#"{"action":"unverified"}"#).unwrap(), ControlMessage::Unsupported(_)));
|
||||
assert_eq!(decode_control("{\"action\":\"text_input\",\"content\":\"你好 a\"}".as_bytes()).unwrap(),
|
||||
ControlMessage::Input(ControlInput::TextInput { text: "你好 a".into() }));
|
||||
assert!(decode_control(br#"{"action":"text_input"}"#).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user