mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
only allow the observer of the key presses to be registered once
This commit is contained in:
parent
cd8b539557
commit
a91292509e
1 changed files with 11 additions and 9 deletions
|
|
@ -839,15 +839,17 @@ fn main() -> ! {
|
||||||
Some(Opcode::RegisterKeyObserver) => {
|
Some(Opcode::RegisterKeyObserver) => {
|
||||||
let buffer = unsafe{Buffer::from_memory_message(msg.body.memory_message().unwrap())};
|
let buffer = unsafe{Buffer::from_memory_message(msg.body.memory_message().unwrap())};
|
||||||
let kr = buffer.as_flat::<KeyboardRegistration, _>().unwrap();
|
let kr = buffer.as_flat::<KeyboardRegistration, _>().unwrap();
|
||||||
match xns.request_connection_blocking(kr.server_name.as_str()) {
|
if observer_conn.is_none() {
|
||||||
Ok(cid) => {
|
match xns.request_connection_blocking(kr.server_name.as_str()) {
|
||||||
observer_conn = Some(cid);
|
Ok(cid) => {
|
||||||
observer_op = Some(kr.listener_op_id as usize);
|
observer_conn = Some(cid);
|
||||||
}
|
observer_op = Some(kr.listener_op_id as usize);
|
||||||
Err(e) => {
|
}
|
||||||
log::error!("couldn't connect to observer: {:?}", e);
|
Err(e) => {
|
||||||
observer_conn = None;
|
log::error!("couldn't connect to observer: {:?}", e);
|
||||||
observer_op = None;
|
observer_conn = None;
|
||||||
|
observer_op = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue