input_method/
input_method.rs1use std::time::Duration;
2use tokio::{sync::{mpsc, oneshot}, time::sleep};
3use wayland_protocols_async::zwp_input_method_v2::handler::InputMethodHandler;
4
5#[tokio::main]
6async fn main() {
7 let (input_method_msg_tx, mut input_method_msg_rx) = mpsc::channel(128);
9
10 let (input_method_event_tx, mut input_method_event_rx) = mpsc::channel(128);
12
13 let mut input_method_handler = InputMethodHandler::new(input_method_event_tx);
15
16
17 let input_method_t = tokio::spawn(async move {
19 let _ = input_method_handler.run(input_method_msg_rx).await;
20 });
21
22 let input_method_event_t = tokio::spawn(async move {
24 loop {
25 let msg = input_method_event_rx.recv().await;
26 if msg.is_none() {
27 continue;
28 }
29 println!("received input_method_event event={:?}", msg);
30 }
31 });
32
33 let _ = input_method_t.await.unwrap();
34 let _ = input_method_event_t.await.unwrap();
35}