mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-21 01:43:20 +03:00
continue without keymap (#18)
This commit is contained in:
committed by
GitHub
parent
fae710aab6
commit
31eead5f8e
@@ -120,18 +120,20 @@ impl App {
|
|||||||
let keyboard: Vk = vkm.create_virtual_keyboard(&self.seat, &self.qh, ());
|
let keyboard: Vk = vkm.create_virtual_keyboard(&self.seat, &self.qh, ());
|
||||||
|
|
||||||
// receive keymap from device
|
// receive keymap from device
|
||||||
eprint!("\rconnecting to {} ", client.addr);
|
eprint!("\rtrying to recieve keymap from {} ", client.addr);
|
||||||
let mut attempts = 0;
|
let mut attempts = 0;
|
||||||
let data = loop {
|
let data = loop {
|
||||||
|
if attempts > 10 { break None }
|
||||||
let result = request::request_data(client.addr, Request::KeyMap);
|
let result = request::request_data(client.addr, Request::KeyMap);
|
||||||
eprint!("\rconnecting to {} ", client.addr);
|
eprint!("\rtrying to recieve keymap from {} ", client.addr);
|
||||||
for _ in 0..attempts {
|
|
||||||
eprint!(".");
|
|
||||||
}
|
|
||||||
match result {
|
match result {
|
||||||
Ok(data) => break data,
|
Ok(data) => break Some(data),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprint!(" - {} ", e);
|
eprint!(" - {} ", e);
|
||||||
|
for _ in 0..attempts % 4 {
|
||||||
|
eprint!(".");
|
||||||
|
}
|
||||||
|
eprint!(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
io::stderr().flush().unwrap();
|
io::stderr().flush().unwrap();
|
||||||
@@ -139,11 +141,9 @@ impl App {
|
|||||||
attempts += 1;
|
attempts += 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
eprint!("\rconnecting to {} ", client.addr);
|
if let Some(data) = data {
|
||||||
for _ in 0..attempts {
|
eprint!("\rtrying to recieve keymap from {} ", client.addr);
|
||||||
eprint!(".");
|
eprintln!(" - done! ");
|
||||||
}
|
|
||||||
eprintln!(" done! ");
|
|
||||||
|
|
||||||
// TODO use shm_open
|
// TODO use shm_open
|
||||||
let f = tempfile::tempfile().unwrap();
|
let f = tempfile::tempfile().unwrap();
|
||||||
@@ -151,6 +151,11 @@ impl App {
|
|||||||
buf.write_all(&data[..]).unwrap();
|
buf.write_all(&data[..]).unwrap();
|
||||||
buf.flush().unwrap();
|
buf.flush().unwrap();
|
||||||
keyboard.keymap(1, f.as_raw_fd(), data.len() as u32);
|
keyboard.keymap(1, f.as_raw_fd(), data.len() as u32);
|
||||||
|
} else {
|
||||||
|
eprint!("\rtrying to recieve keymap from {} ", client.addr);
|
||||||
|
eprintln!("no keyboard provided, using server keymap");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let vinput = VirtualInput::Wlroots { pointer, keyboard };
|
let vinput = VirtualInput::Wlroots { pointer, keyboard };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user