diff --git a/atspi-common/src/error.rs b/atspi-common/src/error.rs index 32b407dd..98b9c1be 100644 --- a/atspi-common/src/error.rs +++ b/atspi-common/src/error.rs @@ -15,6 +15,9 @@ pub enum AtspiError { /// On specific types, if the event / message member does not match the Event's name. InterfaceMatch(String), + /// On specific types, if the event / kind discriminant does not match the Event's discriminant. + KindMismatch(String), + /// To indicate a match or equality test on a signal body signature failed. UnknownBusSignature(String), @@ -79,6 +82,9 @@ impl std::fmt::Display for AtspiError { Self::InterfaceMatch(e) => { f.write_str(format!("atspi: interface mismatch in conversion: {e}").as_str()) } + Self::KindMismatch(e) => { + f.write_str(format!("atspi: kind mismatch in conversion: {e}").as_str()) + } Self::UnknownBusSignature(e) => { f.write_str(format!("atspi: Unknown bus body signature: {e:?}").as_str()) } diff --git a/atspi-common/src/events/mod.rs b/atspi-common/src/events/mod.rs index fba66441..4a4a684e 100644 --- a/atspi-common/src/events/mod.rs +++ b/atspi-common/src/events/mod.rs @@ -940,7 +940,7 @@ assert_obj_safe!(EventProperties); /// For a similar, but object-safe trait, see [`EventProperties`]. pub trait BusProperties { /// The `DBus` member for the event. - /// For example, for an [`object::TextChangedEvent`] this should be `"TextChanged"` + /// For example, for an [`object::TextInsertedEvent`] this should be `"TextChanged"` const DBUS_MEMBER: &'static str; /// The `DBus` interface name for this event. /// For example, for any event within [`object`], this should be "org.a11y.atspi.Event.Object". diff --git a/atspi-common/src/events/object.rs b/atspi-common/src/events/object.rs index bed64eae..77fdb482 100644 --- a/atspi-common/src/events/object.rs +++ b/atspi-common/src/events/object.rs @@ -18,8 +18,10 @@ pub enum ObjectEvents { LinkSelected(LinkSelectedEvent), /// See: [`StateChangedEvent`]. StateChanged(StateChangedEvent), - /// See: [`ChildrenChangedEvent`]. - ChildrenChanged(ChildrenChangedEvent), + /// See: [`ChildrenInsertedEvent`]. + ChildrenInserted(ChildrenInsertedEvent), + /// See: [`ChildrenDeletedEvent`]. + ChildrenDeleted(ChildrenDeletedEvent), /// See: [`VisibleDataChangedEvent`]. VisibleDataChanged(VisibleDataChangedEvent), /// See: [`SelectionChangedEvent`]. @@ -48,8 +50,10 @@ pub enum ObjectEvents { TextBoundsChanged(TextBoundsChangedEvent), /// See: [`TextSelectionChangedEvent`]. TextSelectionChanged(TextSelectionChangedEvent), - /// See: [`TextChangedEvent`]. - TextChanged(TextChangedEvent), + /// See: [`TextInsertedEvent`]. + TextInserted(TextInsertedEvent), + /// See: [`TextDeletedEvent`]. + TextDeleted(TextDeletedEvent), /// See: [`TextAttributesChangedEvent`]. TextAttributesChanged(TextAttributesChangedEvent), /// See: [`TextCaretMovedEvent`]. @@ -63,7 +67,8 @@ impl EventTypeProperties for ObjectEvents { Self::BoundsChanged(inner) => inner.member(), Self::LinkSelected(inner) => inner.member(), Self::StateChanged(inner) => inner.member(), - Self::ChildrenChanged(inner) => inner.member(), + Self::ChildrenInserted(inner) => inner.member(), + Self::ChildrenDeleted(inner) => inner.member(), Self::VisibleDataChanged(inner) => inner.member(), Self::SelectionChanged(inner) => inner.member(), Self::ModelChanged(inner) => inner.member(), @@ -78,7 +83,8 @@ impl EventTypeProperties for ObjectEvents { Self::ColumnDeleted(inner) => inner.member(), Self::TextBoundsChanged(inner) => inner.member(), Self::TextSelectionChanged(inner) => inner.member(), - Self::TextChanged(inner) => inner.member(), + Self::TextInserted(inner) => inner.member(), + Self::TextDeleted(inner) => inner.member(), Self::TextAttributesChanged(inner) => inner.member(), Self::TextCaretMoved(inner) => inner.member(), } @@ -89,7 +95,8 @@ impl EventTypeProperties for ObjectEvents { Self::BoundsChanged(inner) => inner.interface(), Self::LinkSelected(inner) => inner.interface(), Self::StateChanged(inner) => inner.interface(), - Self::ChildrenChanged(inner) => inner.interface(), + Self::ChildrenInserted(inner) => inner.interface(), + Self::ChildrenDeleted(inner) => inner.interface(), Self::VisibleDataChanged(inner) => inner.interface(), Self::SelectionChanged(inner) => inner.interface(), Self::ModelChanged(inner) => inner.interface(), @@ -104,7 +111,8 @@ impl EventTypeProperties for ObjectEvents { Self::ColumnDeleted(inner) => inner.interface(), Self::TextBoundsChanged(inner) => inner.interface(), Self::TextSelectionChanged(inner) => inner.interface(), - Self::TextChanged(inner) => inner.interface(), + Self::TextInserted(inner) => inner.interface(), + Self::TextDeleted(inner) => inner.interface(), Self::TextAttributesChanged(inner) => inner.interface(), Self::TextCaretMoved(inner) => inner.interface(), } @@ -115,7 +123,8 @@ impl EventTypeProperties for ObjectEvents { Self::BoundsChanged(inner) => inner.match_rule(), Self::LinkSelected(inner) => inner.match_rule(), Self::StateChanged(inner) => inner.match_rule(), - Self::ChildrenChanged(inner) => inner.match_rule(), + Self::ChildrenInserted(inner) => inner.match_rule(), + Self::ChildrenDeleted(inner) => inner.match_rule(), Self::VisibleDataChanged(inner) => inner.match_rule(), Self::SelectionChanged(inner) => inner.match_rule(), Self::ModelChanged(inner) => inner.match_rule(), @@ -130,7 +139,8 @@ impl EventTypeProperties for ObjectEvents { Self::ColumnDeleted(inner) => inner.match_rule(), Self::TextBoundsChanged(inner) => inner.match_rule(), Self::TextSelectionChanged(inner) => inner.match_rule(), - Self::TextChanged(inner) => inner.match_rule(), + Self::TextInserted(inner) => inner.match_rule(), + Self::TextDeleted(inner) => inner.match_rule(), Self::TextAttributesChanged(inner) => inner.match_rule(), Self::TextCaretMoved(inner) => inner.match_rule(), } @@ -141,7 +151,8 @@ impl EventTypeProperties for ObjectEvents { Self::BoundsChanged(inner) => inner.registry_string(), Self::LinkSelected(inner) => inner.registry_string(), Self::StateChanged(inner) => inner.registry_string(), - Self::ChildrenChanged(inner) => inner.registry_string(), + Self::ChildrenInserted(inner) => inner.registry_string(), + Self::ChildrenDeleted(inner) => inner.registry_string(), Self::VisibleDataChanged(inner) => inner.registry_string(), Self::SelectionChanged(inner) => inner.registry_string(), Self::ModelChanged(inner) => inner.registry_string(), @@ -156,7 +167,8 @@ impl EventTypeProperties for ObjectEvents { Self::ColumnDeleted(inner) => inner.registry_string(), Self::TextBoundsChanged(inner) => inner.registry_string(), Self::TextSelectionChanged(inner) => inner.registry_string(), - Self::TextChanged(inner) => inner.registry_string(), + Self::TextInserted(inner) => inner.registry_string(), + Self::TextDeleted(inner) => inner.registry_string(), Self::TextAttributesChanged(inner) => inner.registry_string(), Self::TextCaretMoved(inner) => inner.registry_string(), } @@ -170,7 +182,8 @@ impl EventProperties for ObjectEvents { Self::BoundsChanged(inner) => inner.path(), Self::LinkSelected(inner) => inner.path(), Self::StateChanged(inner) => inner.path(), - Self::ChildrenChanged(inner) => inner.path(), + Self::ChildrenInserted(inner) => inner.path(), + Self::ChildrenDeleted(inner) => inner.path(), Self::VisibleDataChanged(inner) => inner.path(), Self::SelectionChanged(inner) => inner.path(), Self::ModelChanged(inner) => inner.path(), @@ -185,7 +198,8 @@ impl EventProperties for ObjectEvents { Self::ColumnDeleted(inner) => inner.path(), Self::TextBoundsChanged(inner) => inner.path(), Self::TextSelectionChanged(inner) => inner.path(), - Self::TextChanged(inner) => inner.path(), + Self::TextInserted(inner) => inner.path(), + Self::TextDeleted(inner) => inner.path(), Self::TextAttributesChanged(inner) => inner.path(), Self::TextCaretMoved(inner) => inner.path(), } @@ -196,7 +210,8 @@ impl EventProperties for ObjectEvents { Self::BoundsChanged(inner) => inner.sender(), Self::LinkSelected(inner) => inner.sender(), Self::StateChanged(inner) => inner.sender(), - Self::ChildrenChanged(inner) => inner.sender(), + Self::ChildrenInserted(inner) => inner.sender(), + Self::ChildrenDeleted(inner) => inner.sender(), Self::VisibleDataChanged(inner) => inner.sender(), Self::SelectionChanged(inner) => inner.sender(), Self::ModelChanged(inner) => inner.sender(), @@ -211,7 +226,8 @@ impl EventProperties for ObjectEvents { Self::ColumnDeleted(inner) => inner.sender(), Self::TextBoundsChanged(inner) => inner.sender(), Self::TextSelectionChanged(inner) => inner.sender(), - Self::TextChanged(inner) => inner.sender(), + Self::TextInserted(inner) => inner.sender(), + Self::TextDeleted(inner) => inner.sender(), Self::TextAttributesChanged(inner) => inner.sender(), Self::TextCaretMoved(inner) => inner.sender(), } @@ -424,27 +440,28 @@ pub struct StateChangedEvent { pub enabled: i32, } -/// A child of an [`ObjectRef`] has been added or removed. +/// A child of an [`ObjectRef`] has been added. #[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)] -pub struct ChildrenChangedEvent { +pub struct ChildrenInsertedEvent { /// The [`ObjectRef`] which the event applies to. pub item: crate::events::ObjectRef, - /// Operation, which may be one of: - /// - /// * "insert/system" - /// * "insert" - /// * "delete/system" - /// * "delete" - /// - /// The operation is the same whether it contains the "/system" suffix or not. - /// TODO: This should be an enum. - pub operation: String, - /// Index to remove from/add to. + /// Index to insert into. pub index_in_parent: i32, /// A reference to the new child. pub child: ObjectRef, } +/// A child of an [`ObjectRef`] has been removed. +#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)] +pub struct ChildrenDeletedEvent { + /// The [`ObjectRef`] which the event applies to. + pub item: crate::events::ObjectRef, + /// Index to remove. + pub index_in_parent: i32, + /// A reference to the old child. + pub child: ObjectRef, +} + #[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)] pub struct VisibleDataChangedEvent { /// The [`ObjectRef`] which the event applies to. @@ -540,26 +557,29 @@ pub struct TextSelectionChangedEvent { pub item: crate::events::ObjectRef, } -/// Text has changed within an [`ObjectRef`]. +/// Text insertion within an [`ObjectRef`]. #[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)] -pub struct TextChangedEvent { +pub struct TextInsertedEvent { /// The [`ObjectRef`] which the event applies to. pub item: crate::events::ObjectRef, - /// Operation, which may be one of: - /// - /// * "insert/system" - /// * "insert" - /// * "delete/system" - /// * "delete" - /// - /// The operation is the same whether it contains the "/system" suffix or not. - /// TODO: This should be an enum. - pub operation: String, - /// starting index of the insertion/deletion + /// Starting index of the insertion pub start_pos: i32, - /// length of the insertion/deletion + /// Length of the insertion pub length: i32, - /// the text being inserted/deleted + /// The text being inserted + pub text: String, +} + +/// Text deletion within an [`ObjectRef`]. +#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)] +pub struct TextDeletedEvent { + /// The [`ObjectRef`] which the event applies to. + pub item: crate::events::ObjectRef, + /// Starting index of the deletion + pub start_pos: i32, + /// Length of the deletion + pub length: i32, + /// The text being deleted pub text: String, } @@ -652,7 +672,7 @@ impl BusProperties for StateChangedEvent { } } -impl BusProperties for ChildrenChangedEvent { +impl BusProperties for ChildrenInsertedEvent { const DBUS_MEMBER: &'static str = "ChildrenChanged"; const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object"; const MATCH_RULE_STRING: &'static str = @@ -662,12 +682,25 @@ impl BusProperties for ChildrenChangedEvent { type Body = EventBodyOwned; fn from_message_parts(item: ObjectRef, body: Self::Body) -> Result { - Ok(Self { - item, - operation: body.kind, - index_in_parent: body.detail1, - child: body.any_data.try_into()?, - }) + Ok(Self { item, index_in_parent: body.detail1, child: body.any_data.try_into()? }) + } + fn body(&self) -> Self::Body { + let copy = self.clone(); + copy.into() + } +} + +impl BusProperties for ChildrenDeletedEvent { + const DBUS_MEMBER: &'static str = "ChildrenChanged"; + const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object"; + const MATCH_RULE_STRING: &'static str = + "type='signal',interface='org.a11y.atspi.Event.Object',member='ChildrenChanged'"; + const REGISTRY_EVENT_STRING: &'static str = "Object:"; + + type Body = EventBodyOwned; + + fn from_message_parts(item: ObjectRef, body: Self::Body) -> Result { + Ok(Self { item, index_in_parent: body.detail1, child: body.any_data.try_into()? }) } fn body(&self) -> Self::Body { let copy = self.clone(); @@ -931,7 +964,30 @@ impl BusProperties for TextSelectionChangedEvent { } } -impl BusProperties for TextChangedEvent { +impl BusProperties for TextInsertedEvent { + const DBUS_MEMBER: &'static str = "TextChanged"; + const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object"; + const MATCH_RULE_STRING: &'static str = + "type='signal',interface='org.a11y.atspi.Event.Object',member='TextChanged'"; + const REGISTRY_EVENT_STRING: &'static str = "Object:"; + + type Body = EventBodyOwned; + + fn from_message_parts(item: ObjectRef, body: Self::Body) -> Result { + Ok(Self { + item, + start_pos: body.detail1, + length: body.detail2, + text: body.any_data.try_into()?, + }) + } + fn body(&self) -> Self::Body { + let copy = self.clone(); + copy.into() + } +} + +impl BusProperties for TextDeletedEvent { const DBUS_MEMBER: &'static str = "TextChanged"; const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object"; const MATCH_RULE_STRING: &'static str = @@ -943,7 +999,6 @@ impl BusProperties for TextChangedEvent { fn from_message_parts(item: ObjectRef, body: Self::Body) -> Result { Ok(Self { item, - operation: body.kind, start_pos: body.detail1, length: body.detail2, text: body.any_data.try_into()?, @@ -1004,7 +1059,18 @@ impl TryFrom<&zbus::Message> for ObjectEvents { "BoundsChanged" => Ok(ObjectEvents::BoundsChanged(ev.try_into()?)), "LinkSelected" => Ok(ObjectEvents::LinkSelected(ev.try_into()?)), "StateChanged" => Ok(ObjectEvents::StateChanged(ev.try_into()?)), - "ChildrenChanged" => Ok(ObjectEvents::ChildrenChanged(ev.try_into()?)), + "ChildrenChanged" => { + let body: EventBodyOwned = ev.try_into()?; + match body.kind.as_str() { + "insert" | "insert/system" => { + Ok(ObjectEvents::ChildrenInserted(ev.try_into()?)) + } + "delete" | "delete/system" => Ok(ObjectEvents::ChildrenDeleted(ev.try_into()?)), + _ => { + Err(AtspiError::KindMismatch("No matching kind for ChildrenChanged".into())) + } + } + } "VisibleDataChanged" => Ok(ObjectEvents::VisibleDataChanged(ev.try_into()?)), "SelectionChanged" => Ok(ObjectEvents::SelectionChanged(ev.try_into()?)), "ModelChanged" => Ok(ObjectEvents::ModelChanged(ev.try_into()?)), @@ -1019,7 +1085,14 @@ impl TryFrom<&zbus::Message> for ObjectEvents { "ColumnDeleted" => Ok(ObjectEvents::ColumnDeleted(ev.try_into()?)), "TextBoundsChanged" => Ok(ObjectEvents::TextBoundsChanged(ev.try_into()?)), "TextSelectionChanged" => Ok(ObjectEvents::TextSelectionChanged(ev.try_into()?)), - "TextChanged" => Ok(ObjectEvents::TextChanged(ev.try_into()?)), + "TextChanged" => { + let body: EventBodyOwned = ev.try_into()?; + match body.kind.as_str() { + "insert" | "insert/system" => Ok(ObjectEvents::TextInserted(ev.try_into()?)), + "delete" | "delete/system" => Ok(ObjectEvents::TextDeleted(ev.try_into()?)), + _ => Err(AtspiError::KindMismatch("No matching kind for TextChanged".into())), + } + } "TextAttributesChanged" => Ok(ObjectEvents::TextAttributesChanged(ev.try_into()?)), "TextCaretMoved" => Ok(ObjectEvents::TextCaretMoved(ev.try_into()?)), _ => Err(AtspiError::MemberMatch("No matching member for Object".into())), @@ -1138,25 +1211,59 @@ impl From for EventBodyOwned { } impl_from_user_facing_event_for_interface_event_enum!( - ChildrenChangedEvent, + ChildrenInsertedEvent, + ObjectEvents, + ObjectEvents::ChildrenInserted +); +impl_from_user_facing_type_for_event_enum!(ChildrenInsertedEvent, Event::Object); +impl_try_from_event_for_user_facing_type!( + ChildrenInsertedEvent, + ObjectEvents::ChildrenInserted, + Event::Object +); +event_test_cases!(ChildrenInsertedEvent); +impl_to_dbus_message!(ChildrenInsertedEvent); +impl_from_dbus_message!(ChildrenInsertedEvent); +impl_event_properties!(ChildrenInsertedEvent); + +impl_from_user_facing_event_for_interface_event_enum!( + ChildrenDeletedEvent, ObjectEvents, - ObjectEvents::ChildrenChanged + ObjectEvents::ChildrenDeleted ); -impl_from_user_facing_type_for_event_enum!(ChildrenChangedEvent, Event::Object); +impl_from_user_facing_type_for_event_enum!(ChildrenDeletedEvent, Event::Object); impl_try_from_event_for_user_facing_type!( - ChildrenChangedEvent, - ObjectEvents::ChildrenChanged, + ChildrenDeletedEvent, + ObjectEvents::ChildrenDeleted, Event::Object ); -event_test_cases!(ChildrenChangedEvent); -impl_to_dbus_message!(ChildrenChangedEvent); -impl_from_dbus_message!(ChildrenChangedEvent); -impl_event_properties!(ChildrenChangedEvent); -impl From for EventBodyOwned { - fn from(event: ChildrenChangedEvent) -> Self { +event_test_cases!(ChildrenDeletedEvent); +impl_to_dbus_message!(ChildrenDeletedEvent); +impl_from_dbus_message!(ChildrenDeletedEvent); +impl_event_properties!(ChildrenDeletedEvent); + +impl From for EventBodyOwned { + fn from(event: ChildrenInsertedEvent) -> Self { + EventBodyOwned { + properties: std::collections::HashMap::new(), + kind: "insert".to_string(), + detail1: event.index_in_parent, + detail2: i32::default(), + // `OwnedValue` is constructed from the `ObjectRef` + // Only path to fail is to convert a Fd into an `OwnedValue`. + // Therefore, this is safe. + any_data: Value::from(event.child) + .try_into() + .expect("Failed to convert child to OwnedValue"), + } + } +} + +impl From for EventBodyOwned { + fn from(event: ChildrenDeletedEvent) -> Self { EventBodyOwned { properties: std::collections::HashMap::new(), - kind: event.operation, + kind: "delete".to_string(), detail1: event.index_in_parent, detail2: i32::default(), // `OwnedValue` is constructed from the `ObjectRef` @@ -1551,25 +1658,58 @@ impl From for EventBodyOwned { } impl_from_user_facing_event_for_interface_event_enum!( - TextChangedEvent, + TextInsertedEvent, ObjectEvents, - ObjectEvents::TextChanged + ObjectEvents::TextInserted ); -impl_from_user_facing_type_for_event_enum!(TextChangedEvent, Event::Object); +impl_from_user_facing_type_for_event_enum!(TextInsertedEvent, Event::Object); impl_try_from_event_for_user_facing_type!( - TextChangedEvent, - ObjectEvents::TextChanged, + TextInsertedEvent, + ObjectEvents::TextInserted, Event::Object ); -event_test_cases!(TextChangedEvent); -impl_to_dbus_message!(TextChangedEvent); -impl_from_dbus_message!(TextChangedEvent); -impl_event_properties!(TextChangedEvent); -impl From for EventBodyOwned { - fn from(event: TextChangedEvent) -> Self { +event_test_cases!(TextInsertedEvent); +impl_to_dbus_message!(TextInsertedEvent); +impl_from_dbus_message!(TextInsertedEvent); +impl_event_properties!(TextInsertedEvent); + +impl_from_user_facing_event_for_interface_event_enum!( + TextDeletedEvent, + ObjectEvents, + ObjectEvents::TextDeleted +); +impl_from_user_facing_type_for_event_enum!(TextDeletedEvent, Event::Object); +impl_try_from_event_for_user_facing_type!( + TextDeletedEvent, + ObjectEvents::TextDeleted, + Event::Object +); +event_test_cases!(TextDeletedEvent); +impl_to_dbus_message!(TextDeletedEvent); +impl_from_dbus_message!(TextDeletedEvent); +impl_event_properties!(TextDeletedEvent); +impl From for EventBodyOwned { + fn from(event: TextInsertedEvent) -> Self { + EventBodyOwned { + properties: std::collections::HashMap::new(), + kind: "insert".to_string(), + detail1: event.start_pos, + detail2: event.length, + + // `OwnedValue` is constructed from a `String` + // Therefore, this is safe. + any_data: Value::from(event.text) + .try_to_owned() + .expect("Failed to convert child to OwnedValue"), + } + } +} + +impl From for EventBodyOwned { + fn from(event: TextDeletedEvent) -> Self { EventBodyOwned { properties: std::collections::HashMap::new(), - kind: event.operation, + kind: "delete".to_string(), detail1: event.start_pos, detail2: event.length, diff --git a/atspi/benches/event_parsing.rs b/atspi/benches/event_parsing.rs index 3f255b88..9832b79b 100644 --- a/atspi/benches/event_parsing.rs +++ b/atspi/benches/event_parsing.rs @@ -6,10 +6,11 @@ use atspi::events::focus::FocusEvent; use atspi::events::mouse::{AbsEvent, ButtonEvent, RelEvent}; use atspi::events::object::{ ActiveDescendantChangedEvent, AnnouncementEvent, AttributesChangedEvent, BoundsChangedEvent, - ChildrenChangedEvent, ColumnDeletedEvent, ColumnInsertedEvent, ColumnReorderedEvent, - LinkSelectedEvent, ModelChangedEvent, PropertyChangeEvent, RowDeletedEvent, RowInsertedEvent, - RowReorderedEvent, SelectionChangedEvent, TextAttributesChangedEvent, TextBoundsChangedEvent, - TextCaretMovedEvent, TextChangedEvent, TextSelectionChangedEvent, VisibleDataChangedEvent, + ChildrenDeletedEvent, ChildrenInsertedEvent, ColumnDeletedEvent, ColumnInsertedEvent, + ColumnReorderedEvent, LinkSelectedEvent, ModelChangedEvent, PropertyChangeEvent, + RowDeletedEvent, RowInsertedEvent, RowReorderedEvent, SelectionChangedEvent, + TextAttributesChangedEvent, TextBoundsChangedEvent, TextCaretMovedEvent, TextDeletedEvent, + TextInsertedEvent, TextSelectionChangedEvent, VisibleDataChangedEvent, }; use atspi::events::terminal::{ ApplicationChangedEvent, CharWidthChangedEvent, ColumnCountChangedEvent, LineChangedEvent, @@ -45,7 +46,8 @@ fn vec_of_all_atspi_messages() -> Vec { AnnouncementEvent::default().try_into().unwrap(), AttributesChangedEvent::default().try_into().unwrap(), BoundsChangedEvent::default().try_into().unwrap(), - ChildrenChangedEvent::default().try_into().unwrap(), + ChildrenInsertedEvent::default().try_into().unwrap(), + ChildrenDeletedEvent::default().try_into().unwrap(), ColumnDeletedEvent::default().try_into().unwrap(), ColumnInsertedEvent::default().try_into().unwrap(), ColumnReorderedEvent::default().try_into().unwrap(), @@ -59,7 +61,8 @@ fn vec_of_all_atspi_messages() -> Vec { TextAttributesChangedEvent::default().try_into().unwrap(), TextBoundsChangedEvent::default().try_into().unwrap(), TextCaretMovedEvent::default().try_into().unwrap(), - TextChangedEvent::default().try_into().unwrap(), + TextInsertedEvent::default().try_into().unwrap(), + TextDeletedEvent::default().try_into().unwrap(), TextSelectionChangedEvent::default().try_into().unwrap(), VisibleDataChangedEvent::default().try_into().unwrap(), // terminal events diff --git a/atspi/benches/event_parsing_100k.rs b/atspi/benches/event_parsing_100k.rs index 702212d5..b2191c08 100644 --- a/atspi/benches/event_parsing_100k.rs +++ b/atspi/benches/event_parsing_100k.rs @@ -6,10 +6,11 @@ use atspi::events::focus::FocusEvent; use atspi::events::mouse::{AbsEvent, ButtonEvent, RelEvent}; use atspi::events::object::{ ActiveDescendantChangedEvent, AnnouncementEvent, AttributesChangedEvent, BoundsChangedEvent, - ChildrenChangedEvent, ColumnDeletedEvent, ColumnInsertedEvent, ColumnReorderedEvent, - LinkSelectedEvent, ModelChangedEvent, PropertyChangeEvent, RowDeletedEvent, RowInsertedEvent, - RowReorderedEvent, SelectionChangedEvent, TextAttributesChangedEvent, TextBoundsChangedEvent, - TextCaretMovedEvent, TextChangedEvent, TextSelectionChangedEvent, VisibleDataChangedEvent, + ChildrenDeletedEvent, ChildrenInsertedEvent, ColumnDeletedEvent, ColumnInsertedEvent, + ColumnReorderedEvent, LinkSelectedEvent, ModelChangedEvent, PropertyChangeEvent, + RowDeletedEvent, RowInsertedEvent, RowReorderedEvent, SelectionChangedEvent, + TextAttributesChangedEvent, TextBoundsChangedEvent, TextCaretMovedEvent, TextDeletedEvent, + TextInsertedEvent, TextSelectionChangedEvent, VisibleDataChangedEvent, }; use atspi::events::terminal::{ ApplicationChangedEvent, CharWidthChangedEvent, ColumnCountChangedEvent, LineChangedEvent, @@ -45,7 +46,8 @@ fn vec_of_all_atspi_messages() -> Vec { AnnouncementEvent::default().try_into().unwrap(), AttributesChangedEvent::default().try_into().unwrap(), BoundsChangedEvent::default().try_into().unwrap(), - ChildrenChangedEvent::default().try_into().unwrap(), + ChildrenInsertedEvent::default().try_into().unwrap(), + ChildrenDeletedEvent::default().try_into().unwrap(), ColumnDeletedEvent::default().try_into().unwrap(), ColumnInsertedEvent::default().try_into().unwrap(), ColumnReorderedEvent::default().try_into().unwrap(), @@ -59,7 +61,8 @@ fn vec_of_all_atspi_messages() -> Vec { TextAttributesChangedEvent::default().try_into().unwrap(), TextBoundsChangedEvent::default().try_into().unwrap(), TextCaretMovedEvent::default().try_into().unwrap(), - TextChangedEvent::default().try_into().unwrap(), + TextInsertedEvent::default().try_into().unwrap(), + TextDeletedEvent::default().try_into().unwrap(), TextSelectionChangedEvent::default().try_into().unwrap(), VisibleDataChangedEvent::default().try_into().unwrap(), // terminal events