fix(input): send events even when not in handler queue

This commit is contained in:
Nova
2024-06-30 22:22:41 -04:00
parent 2988ae3c28
commit 1e8d3a3d4c
5 changed files with 82 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
use super::{
input_method_client, InputDataTrait, InputDataType, InputHandler, InputMethodAspect,
input_method_client, InputData, InputDataTrait, InputDataType, InputHandler, InputMethodAspect,
InputMethodRefAspect, INPUT_HANDLER_REGISTRY, INPUT_METHOD_REF_ASPECT_ALIAS_INFO,
INPUT_METHOD_REGISTRY,
};
@@ -132,6 +132,27 @@ impl InputMethod {
self.handler_field_aliases
.remove_aspect(handler.field.as_ref());
}
pub(super) fn serialize(&self, alias_id: u64, handler: &Arc<InputHandler>) -> InputData {
let mut input = self.data.lock().clone();
input.transform(&self, &handler);
InputData {
id: alias_id,
input,
distance: self.distance(&handler.field),
datamap: self.datamap.lock().clone(),
order: self
.handler_order
.lock()
.iter()
.enumerate()
.find(|(_, h)| h.ptr_eq(&Arc::downgrade(handler)))
.unwrap()
.0 as u32,
captured: self.captures.get_valid_contents().contains(handler),
}
}
}
impl Aspect for InputMethod {
const NAME: &'static str = "InputMethod";