async fn handle_ime_message(&self, msg: uii::InputMethodEditorRequest) -> Result<()> {
        match msg {
            ImeReq::SetKeyboardType { keyboard_type, .. } => {
                let mut state = self.0.lock().await;
                state.keyboard_type = keyboard_type;
                Ok(())
            }
            ImeReq::SetState { state, .. } => {
                self.set_state(state).await;
                Ok(())
            }
            ImeReq::InjectInput { .. } => {
                Err(format_err!("InjectInput is deprecated, use DispatchKey3!"))
            }
            ImeReq::DispatchKey3 { event, responder, .. } => {
                let key_event = {
                    let state = self.0.lock().await;
                    events::KeyEvent::new(&event, state.keys_pressed.clone())
                        .context("error converting key")?
                };
                self.inject_input(key_event).await?;
                self.update_keys_pressed(&event).await?;
                // False since legacy API doesn't support input handling.
                // Handling here depends on the hardcoded order of input processing.
                // This should be reworked in future IME design.
                responder.send(false).context("error sending response for DispatchKey3")
            }
            ImeReq::Show { .. } => {
                // clone to ensure we only hold one lock at a time
                let text_manager = self.0.lock().await.text_manager.clone();
                text_manager.show_keyboard().await;
                Ok(())
            }
            ImeReq::Hide { .. } => {
                // clone to ensure we only hold one lock at a time
                let text_manager = self.0.lock().await.text_manager.clone();
                text_manager.hide_keyboard().await;
                Ok(())
            }
        }
    }
/// Handles a request from the legancy IME API, an InputMethodEditorRequest.
Handles a request from the legancy IME API, an InputMethodEditorRequest.
Handles a request from the legancy IME API an InputMethodEditorRequest .
async fn handle_ime_message(&self, msg: uii::InputMethodEditorRequest) -> Result<()> {
        match msg {
            ImeReq::SetKeyboardType { keyboard_type, .. } => {
                let mut state = self.0.lock().await;
                state.keyboard_type = keyboard_type;
                Ok(())
            }
            ImeReq::SetState { state, .. } => {
                self.set_state(state).await;
                Ok(())
            }
            ImeReq::InjectInput { .. } => {
                Err(format_err!("InjectInput is deprecated, use DispatchKey3!"))
            }
            ImeReq::DispatchKey3 { event, responder, .. } => {
                let key_event = {
                    let state = self.0.lock().await;
                    events::KeyEvent::new(&event, state.keys_pressed.clone())
                        .context("error converting key")?
                };
                self.inject_input(key_event).await?;
                self.update_keys_pressed(&event).await?;
                // False since legacy API doesn't support input handling.
                // Handling here depends on the hardcoded order of input processing.
                // This should be reworked in future IME design.
                responder.send(false).context("error sending response for DispatchKey3")
            }
            ImeReq::Show { .. } => {
                // clone to ensure we only hold one lock at a time
                let text_manager = self.0.lock().await.text_manager.clone();
                text_manager.show_keyboard().await;
                Ok(())
            }
            ImeReq::Hide { .. } => {
                // clone to ensure we only hold one lock at a time
                let text_manager = self.0.lock().await.text_manager.clone();
                text_manager.hide_keyboard().await;
                Ok(())
            }
        }
    }
async fn handle_ime_message ( & self , msg : uii :: InputMethodEditorRequest ) -> Result < ( ) > { match msg { ImeReq :: SetKeyboardType { keyboard_type , .. } => { let mut state = self . 0 . lock ( ) . await ; state . keyboard_type = keyboard_type ; Ok ( ( ) ) } ImeReq :: SetState { state , .. } => { self . set_state ( state ) . await ; Ok ( ( ) ) } ImeReq :: InjectInput { .. } => { Err ( format_err ! ( " " ) ) } ImeReq :: DispatchKey3 { event , responder , .. } => { let key_event = { let state = self . 0 . lock ( ) . await ; events :: KeyEvent :: new ( & event , state . keys_pressed . clone ( ) ) . context ( " " ) ? } ; self . inject_input ( key_event ) . await ? ; self . update_keys_pressed ( & event ) . await ? ; // False since legacy API doesn't support input handling. // Handling here depends on the hardcoded order of input processing. // This should be reworked in future IME design. responder . send ( false ) . context ( " " ) } ImeReq :: Show { .. } => { // clone to ensure we only hold one lock at a time let text_manager = self . 0 . lock ( ) . await . text_manager . clone ( ) ; text_manager . show_keyboard ( ) . await ; Ok ( ( ) ) } ImeReq :: Hide { .. } => { // clone to ensure we only hold one lock at a time let text_manager = self . 0 . lock ( ) . await . text_manager . clone ( ) ; text_manager . hide_keyboard ( ) . await ; Ok ( ( ) ) } } }
Handles a request from the legancy IME API, an InputMethodEditorRequest.
Handles a request from the legancy IME API an InputMethodEditorRequest .
&self
msg
uii::InputMethodEditorRequest
&self
msg
uii::InputMethodEditorRequest