1use std::hash::Hash;
2
3use crate::{
4 error::AtspiError,
5 events::{Accessible, EventBodyOwned, GenericEvent, HasMatchRule, HasRegistryEventString},
6 Event, State,
7};
8use zvariant::{ObjectPath, OwnedValue, Value};
9
10#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
11pub enum ObjectEvents {
12 /// See: [`PropertyChangeEvent`].
13 PropertyChange(PropertyChangeEvent),
14 /// See: [`BoundsChangedEvent`].
15 BoundsChanged(BoundsChangedEvent),
16 /// See: [`LinkSelectedEvent`].
17 LinkSelected(LinkSelectedEvent),
18 /// See: [`StateChangedEvent`].
19 StateChanged(StateChangedEvent),
20 /// See: [`ChildrenChangedEvent`].
21 ChildrenChanged(ChildrenChangedEvent),
22 /// See: [`VisibleDataChangedEvent`].
23 VisibleDataChanged(VisibleDataChangedEvent),
24 /// See: [`SelectionChangedEvent`].
25 SelectionChanged(SelectionChangedEvent),
26 /// See: [`ModelChangedEvent`].
27 ModelChanged(ModelChangedEvent),
28 /// See: [`ActiveDescendantChangedEvent`].
29 ActiveDescendantChanged(ActiveDescendantChangedEvent),
30 /// See: [`AnnouncementEvent`].
31 Announcement(AnnouncementEvent),
32 /// See: [`AttributesChangedEvent`].
33 AttributesChanged(AttributesChangedEvent),
34 /// See: [`RowInsertedEvent`].
35 RowInserted(RowInsertedEvent),
36 /// See: [`RowReorderedEvent`].
37 RowReordered(RowReorderedEvent),
38 /// See: [`RowDeletedEvent`].
39 RowDeleted(RowDeletedEvent),
40 /// See: [`ColumnInsertedEvent`].
41 ColumnInserted(ColumnInsertedEvent),
42 /// See: [`ColumnReorderedEvent`].
43 ColumnReordered(ColumnReorderedEvent),
44 /// See: [`ColumnDeletedEvent`].
45 ColumnDeleted(ColumnDeletedEvent),
46 /// See: [`TextBoundsChangedEvent`].
47 TextBoundsChanged(TextBoundsChangedEvent),
48 /// See: [`TextSelectionChangedEvent`].
49 TextSelectionChanged(TextSelectionChangedEvent),
50 /// See: [`TextChangedEvent`].
51 TextChanged(TextChangedEvent),
52 /// See: [`TextAttributesChangedEvent`].
53 TextAttributesChanged(TextAttributesChangedEvent),
54 /// See: [`TextCaretMovedEvent`].
55 TextCaretMoved(TextCaretMovedEvent),
56}
57
58impl_from_interface_event_enum_for_event!(ObjectEvents, Event::Object);
59impl_try_from_event_for_user_facing_event_type!(ObjectEvents, Event::Object);
60
61event_wrapper_test_cases!(ObjectEvents, PropertyChangeEvent);
62
63impl HasMatchRule for ObjectEvents {
64 const MATCH_RULE_STRING: &'static str = "type='signal',interface='org.a11y.atspi.Event.Object'";
65}
66
67/// The `org.a11y.atspi.Event.Object:PropertyChange` event.
68#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
69pub struct PropertyChangeEvent {
70 /// The [`Accessible`] which the event applies to.
71 pub item: crate::events::Accessible,
72 pub property: String,
73 pub value: Property,
74}
75
76impl Hash for PropertyChangeEvent {
77 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
78 self.item.hash(state);
79 self.property.hash(state);
80 }
81}
82
83// Do not derive Eq if not all fields implement Eq
84impl Eq for PropertyChangeEvent {}
85
86// Looks like a false positive Clippy lint
87#[allow(clippy::derivable_impls)]
88impl Default for PropertyChangeEvent {
89 fn default() -> Self {
90 Self {
91 item: Accessible::default(),
92 property: String::default(),
93 value: Property::default(),
94 }
95 }
96}
97
98#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
99#[non_exhaustive]
100pub enum Property {
101 Name(String),
102 Description(String),
103 Role(crate::Role),
104 Parent(Accessible),
105 TableCaption(String),
106 TableColumnDescription(String),
107 TableColumnHeader(String),
108 TableRowDescription(String),
109 TableRowHeader(String),
110 TableSummary(String),
111 Other((String, OwnedValue)),
112}
113
114impl Default for Property {
115 fn default() -> Self {
116 Self::Other((String::default(), zvariant::Value::U64(0).into()))
117 }
118}
119
120impl TryFrom<EventBodyOwned> for Property {
121 type Error = AtspiError;
122
123 fn try_from(body: EventBodyOwned) -> Result<Self, Self::Error> {
124 let property = body.kind;
125
126 match property.as_str() {
127 "accessible-name" => Ok(Self::Name(
128 body.any_data
129 .try_into()
130 .map_err(|_| AtspiError::ParseError("accessible-name"))?,
131 )),
132 "accessible-description" => Ok(Self::Description(
133 body.any_data
134 .try_into()
135 .map_err(|_| AtspiError::ParseError("accessible-description"))?,
136 )),
137 "accessible-role" => Ok(Self::Role({
138 let role_int: u32 = body
139 .any_data
140 .try_into()
141 .map_err(|_| AtspiError::ParseError("accessible-role"))?;
142 let role: crate::Role = crate::Role::try_from(role_int)
143 .map_err(|_| AtspiError::ParseError("accessible-role"))?;
144 role
145 })),
146 "accessible-parent" => Ok(Self::Parent(
147 body.any_data
148 .try_into()
149 .map_err(|_| AtspiError::ParseError("accessible-parent"))?,
150 )),
151 "accessible-table-caption" => Ok(Self::TableCaption(
152 body.any_data
153 .try_into()
154 .map_err(|_| AtspiError::ParseError("accessible-table-caption"))?,
155 )),
156 "table-column-description" => Ok(Self::TableColumnDescription(
157 body.any_data
158 .try_into()
159 .map_err(|_| AtspiError::ParseError("table-column-description"))?,
160 )),
161 "table-column-header" => Ok(Self::TableColumnHeader(
162 body.any_data
163 .try_into()
164 .map_err(|_| AtspiError::ParseError("table-column-header"))?,
165 )),
166 "table-row-description" => Ok(Self::TableRowDescription(
167 body.any_data
168 .try_into()
169 .map_err(|_| AtspiError::ParseError("table-row-description"))?,
170 )),
171 "table-row-header" => Ok(Self::TableRowHeader(
172 body.any_data
173 .try_into()
174 .map_err(|_| AtspiError::ParseError("table-row-header"))?,
175 )),
176 "table-summary" => Ok(Self::TableSummary(
177 body.any_data
178 .try_into()
179 .map_err(|_| AtspiError::ParseError("table-summary"))?,
180 )),
181 _ => Ok(Self::Other((property, body.any_data))),
182 }
183 }
184}
185
186impl From<Property> for OwnedValue {
187 fn from(property: Property) -> Self {
188 match property {
189 Property::Name(name: String) => Value::from(name).into(),
190 Property::Description(description: String) => Value::from(description).into(),
191 Property::Role(role: Role) => Value::from(role as u32).into(),
192 Property::Parent(parent: Accessible) => Value::from(parent).into(),
193 Property::TableCaption(table_caption: String) => Value::from(table_caption).into(),
194 Property::TableColumnDescription(table_column_description: String) => {
195 Value::from(table_column_description).into()
196 }
197 Property::TableColumnHeader(table_column_header: String) => {
198 Value::from(table_column_header).into()
199 }
200 Property::TableRowDescription(table_row_description: String) => {
201 Value::from(table_row_description).into()
202 }
203 Property::TableRowHeader(table_row_header: String) => Value::from(table_row_header).into(),
204 Property::TableSummary(table_summary: String) => Value::from(table_summary).into(),
205 Property::Other((_, value: OwnedValue)) => value,
206 }
207 }
208}
209
210#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
211pub struct BoundsChangedEvent {
212 /// The [`Accessible`] which the event applies to.
213 pub item: crate::events::Accessible,
214}
215
216#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
217pub struct LinkSelectedEvent {
218 /// The [`Accessible`] which the event applies to.
219 pub item: crate::events::Accessible,
220}
221
222/// A state of an object has been modified.
223/// A [`State`] can be added or removed from any [`Accessible`].
224#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
225pub struct StateChangedEvent {
226 /// The [`Accessible`] which the event applies to.
227 pub item: crate::events::Accessible,
228 /// The state to be enabled/disabled.
229 pub state: State,
230 /// Enabled or disabled the state.
231 ///
232 /// 1 == enabled
233 ///
234 /// 0 == disabled
235 pub enabled: i32,
236}
237
238/// A child of an [`Accessible`] has been added or removed.
239#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
240pub struct ChildrenChangedEvent {
241 /// The [`Accessible`] which the event applies to.
242 pub item: crate::events::Accessible,
243 /// Operation, which may be one of:
244 ///
245 /// * "insert/system"
246 /// * "insert"
247 /// * "delete/system"
248 /// * "delete"
249 ///
250 /// The operation is the same whether it contains the "/system" suffix or not.
251 /// TODO: This should be an enum.
252 pub operation: String,
253 /// Index to remove from/add to.
254 pub index_in_parent: i32,
255 /// A reference to the new child.
256 pub child: Accessible,
257}
258
259#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
260pub struct VisibleDataChangedEvent {
261 /// The [`Accessible`] which the event applies to.
262 pub item: crate::events::Accessible,
263}
264
265#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
266pub struct SelectionChangedEvent {
267 /// The [`Accessible`] which the event applies to.
268 pub item: crate::events::Accessible,
269}
270
271#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
272pub struct ModelChangedEvent {
273 /// The [`Accessible`] which the event applies to.
274 pub item: crate::events::Accessible,
275}
276
277#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
278pub struct ActiveDescendantChangedEvent {
279 /// The [`Accessible`] which the event applies to.
280 pub item: crate::events::Accessible,
281 pub child: Accessible,
282}
283
284#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
285pub struct AnnouncementEvent {
286 /// The [`Accessible`] which the event applies to.
287 pub item: crate::events::Accessible,
288 /// Text of the announcement.
289 pub text: String,
290 /// Politeness level.
291 pub live: crate::Live,
292}
293
294#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
295pub struct AttributesChangedEvent {
296 /// The [`Accessible`] which the event applies to.
297 pub item: crate::events::Accessible,
298}
299
300/// A row has been added to a table.
301#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
302pub struct RowInsertedEvent {
303 /// The table which has had a row inserted.
304 pub item: crate::events::Accessible,
305}
306
307/// A row has been moved within a table.
308#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
309pub struct RowReorderedEvent {
310 /// The table which has had a row re-ordered.
311 pub item: crate::events::Accessible,
312}
313
314/// A row has been deleted from a table.
315#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
316pub struct RowDeletedEvent {
317 /// The table which has had a row removed.
318 pub item: crate::events::Accessible,
319}
320
321/// A column has been added to a table.
322#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
323pub struct ColumnInsertedEvent {
324 /// The table which has had a column inserted.
325 pub item: crate::events::Accessible,
326}
327
328/// A column has been re-ordered within a table.
329#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
330pub struct ColumnReorderedEvent {
331 /// The table which has had a column re-ordered.
332 pub item: crate::events::Accessible,
333}
334
335/// A column has been removed from a table.
336#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
337pub struct ColumnDeletedEvent {
338 /// The table which has had a column removed.
339 pub item: crate::events::Accessible,
340}
341
342#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
343pub struct TextBoundsChangedEvent {
344 /// The [`Accessible`] which the event applies to.
345 pub item: crate::events::Accessible,
346}
347
348#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
349pub struct TextSelectionChangedEvent {
350 /// The [`Accessible`] which the event applies to.
351 pub item: crate::events::Accessible,
352}
353
354/// Text has changed within an [`Accessible`].
355#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
356pub struct TextChangedEvent {
357 /// The [`Accessible`] which the event applies to.
358 pub item: crate::events::Accessible,
359 /// Operation, which may be one of:
360 ///
361 /// * "insert/system"
362 /// * "insert"
363 /// * "delete/system"
364 /// * "delete"
365 ///
366 /// The operation is the same whether it contains the "/system" suffix or not.
367 /// TODO: This should be an enum.
368 pub operation: String,
369 /// starting index of the insertion/deletion
370 pub start_pos: i32,
371 /// length of the insertion/deletion
372 pub length: i32,
373 /// the text being inserted/deleted
374 pub text: String,
375}
376
377#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
378pub struct TextAttributesChangedEvent {
379 /// The [`Accessible`] which the event applies to.
380 pub item: crate::events::Accessible,
381}
382
383/// The caret of the user also known as a cursor (not to be confused with mouse pointer) has changed position.
384#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
385pub struct TextCaretMovedEvent {
386 /// The object on which the caret has been moved on.
387 pub item: crate::events::Accessible,
388 /// New position of the caret.
389 pub position: i32,
390}
391
392impl GenericEvent<'_> for PropertyChangeEvent {
393 const DBUS_MEMBER: &'static str = "PropertyChange";
394 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
395 const MATCH_RULE_STRING: &'static str =
396 "type='signal',interface='org.a11y.atspi.Event.Object',member='PropertyChange'";
397 const REGISTRY_EVENT_STRING: &'static str = "Object:";
398
399 type Body = EventBodyOwned;
400
401 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
402 let property = body.kind.clone();
403 let value: Property = body.try_into()?;
404 Ok(Self { item, property, value })
405 }
406 fn sender(&self) -> String {
407 self.item.name.clone()
408 }
409 fn path<'a>(&self) -> ObjectPath<'_> {
410 self.item.path.clone().into()
411 }
412 fn body(&self) -> Self::Body {
413 let copy = self.clone();
414 copy.into()
415 }
416}
417
418impl GenericEvent<'_> for BoundsChangedEvent {
419 const DBUS_MEMBER: &'static str = "BoundsChanged";
420 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
421 const MATCH_RULE_STRING: &'static str =
422 "type='signal',interface='org.a11y.atspi.Event.Object',member='BoundsChanged'";
423 const REGISTRY_EVENT_STRING: &'static str = "Object:";
424
425 type Body = EventBodyOwned;
426
427 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
428 Ok(Self { item })
429 }
430 fn sender(&self) -> String {
431 self.item.name.clone()
432 }
433 fn path<'a>(&self) -> ObjectPath<'_> {
434 self.item.path.clone().into()
435 }
436 fn body(&self) -> Self::Body {
437 let copy: BoundsChangedEvent = self.clone();
438 copy.into()
439 }
440}
441
442impl GenericEvent<'_> for LinkSelectedEvent {
443 const DBUS_MEMBER: &'static str = "LinkSelected";
444 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
445 const MATCH_RULE_STRING: &'static str =
446 "type='signal',interface='org.a11y.atspi.Event.Object',member='LinkSelected'";
447 const REGISTRY_EVENT_STRING: &'static str = "Object:";
448
449 type Body = EventBodyOwned;
450
451 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
452 Ok(Self { item })
453 }
454 fn sender(&self) -> String {
455 self.item.name.clone()
456 }
457 fn path<'a>(&self) -> ObjectPath<'_> {
458 self.item.path.clone().into()
459 }
460 fn body(&self) -> Self::Body {
461 let copy: LinkSelectedEvent = self.clone();
462 copy.into()
463 }
464}
465
466impl GenericEvent<'_> for StateChangedEvent {
467 const DBUS_MEMBER: &'static str = "StateChanged";
468 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
469 const MATCH_RULE_STRING: &'static str =
470 "type='signal',interface='org.a11y.atspi.Event.Object',member='StateChanged'";
471 const REGISTRY_EVENT_STRING: &'static str = "Object:";
472
473 type Body = EventBodyOwned;
474
475 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
476 Ok(Self { item, state: body.kind.into(), enabled: body.detail1 })
477 }
478 fn sender(&self) -> String {
479 self.item.name.clone()
480 }
481 fn path<'a>(&self) -> ObjectPath<'_> {
482 self.item.path.clone().into()
483 }
484 fn body(&self) -> Self::Body {
485 let copy: StateChangedEvent = self.clone();
486 copy.into()
487 }
488}
489
490impl GenericEvent<'_> for ChildrenChangedEvent {
491 const DBUS_MEMBER: &'static str = "ChildrenChanged";
492 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
493 const MATCH_RULE_STRING: &'static str =
494 "type='signal',interface='org.a11y.atspi.Event.Object',member='ChildrenChanged'";
495 const REGISTRY_EVENT_STRING: &'static str = "Object:";
496
497 type Body = EventBodyOwned;
498
499 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
500 Ok(Self {
501 item,
502 operation: body.kind,
503 index_in_parent: body.detail1,
504 child: body.any_data.try_into()?,
505 })
506 }
507 fn sender(&self) -> String {
508 self.item.name.clone()
509 }
510 fn path<'a>(&self) -> ObjectPath<'_> {
511 self.item.path.clone().into()
512 }
513 fn body(&self) -> Self::Body {
514 let copy = self.clone();
515 copy.into()
516 }
517}
518
519impl GenericEvent<'_> for VisibleDataChangedEvent {
520 const DBUS_MEMBER: &'static str = "VisibleDataChanged";
521 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
522 const MATCH_RULE_STRING: &'static str =
523 "type='signal',interface='org.a11y.atspi.Event.Object',member='VisibleDataChanged'";
524 const REGISTRY_EVENT_STRING: &'static str = "Object:";
525
526 type Body = EventBodyOwned;
527
528 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
529 Ok(Self { item })
530 }
531 fn sender(&self) -> String {
532 self.item.name.clone()
533 }
534 fn path<'a>(&self) -> ObjectPath<'_> {
535 self.item.path.clone().into()
536 }
537 fn body(&self) -> Self::Body {
538 let copy: VisibleDataChangedEvent = self.clone();
539 copy.into()
540 }
541}
542
543impl GenericEvent<'_> for SelectionChangedEvent {
544 const DBUS_MEMBER: &'static str = "SelectionChanged";
545 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
546 const MATCH_RULE_STRING: &'static str =
547 "type='signal',interface='org.a11y.atspi.Event.Object',member='SelectionChanged'";
548 const REGISTRY_EVENT_STRING: &'static str = "Object:";
549
550 type Body = EventBodyOwned;
551
552 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
553 Ok(Self { item })
554 }
555 fn sender(&self) -> String {
556 self.item.name.clone()
557 }
558 fn path<'a>(&self) -> ObjectPath<'_> {
559 self.item.path.clone().into()
560 }
561 fn body(&self) -> Self::Body {
562 let copy: SelectionChangedEvent = self.clone();
563 copy.into()
564 }
565}
566
567impl GenericEvent<'_> for ModelChangedEvent {
568 const DBUS_MEMBER: &'static str = "ModelChanged";
569 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
570 const MATCH_RULE_STRING: &'static str =
571 "type='signal',interface='org.a11y.atspi.Event.Object',member='ModelChanged'";
572 const REGISTRY_EVENT_STRING: &'static str = "Object:";
573
574 type Body = EventBodyOwned;
575
576 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
577 Ok(Self { item })
578 }
579 fn sender(&self) -> String {
580 self.item.name.clone()
581 }
582 fn path<'a>(&self) -> ObjectPath<'_> {
583 self.item.path.clone().into()
584 }
585 fn body(&self) -> Self::Body {
586 let copy: ModelChangedEvent = self.clone();
587 copy.into()
588 }
589}
590
591impl GenericEvent<'_> for ActiveDescendantChangedEvent {
592 const DBUS_MEMBER: &'static str = "ActiveDescendantChanged";
593 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
594 const MATCH_RULE_STRING: &'static str =
595 "type='signal',interface='org.a11y.atspi.Event.Object',member='ActiveDescendantChanged'";
596 const REGISTRY_EVENT_STRING: &'static str = "Object:";
597
598 type Body = EventBodyOwned;
599
600 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
601 Ok(Self { item, child: body.any_data.try_into()? })
602 }
603 fn sender(&self) -> String {
604 self.item.name.clone()
605 }
606 fn path<'a>(&self) -> ObjectPath<'_> {
607 self.item.path.clone().into()
608 }
609 fn body(&self) -> Self::Body {
610 let copy: ActiveDescendantChangedEvent = self.clone();
611 copy.into()
612 }
613}
614
615impl GenericEvent<'_> for AnnouncementEvent {
616 const DBUS_MEMBER: &'static str = "Announcement";
617 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
618 const MATCH_RULE_STRING: &'static str =
619 "type='signal',interface='org.a11y.atspi.Event.Object',member='Announcement'";
620 const REGISTRY_EVENT_STRING: &'static str = "Object:";
621
622 type Body = EventBodyOwned;
623
624 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
625 Ok(Self {
626 item,
627 text: body.any_data.try_into().map_err(|_| AtspiError::Conversion("text"))?,
628 live: body.detail1.try_into()?,
629 })
630 }
631 fn sender(&self) -> String {
632 self.item.name.clone()
633 }
634 fn path<'a>(&self) -> ObjectPath<'_> {
635 self.item.path.clone().into()
636 }
637 fn body(&self) -> Self::Body {
638 let copy = self.clone();
639 copy.into()
640 }
641}
642
643impl GenericEvent<'_> for AttributesChangedEvent {
644 const DBUS_MEMBER: &'static str = "AttributesChanged";
645 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
646 const MATCH_RULE_STRING: &'static str =
647 "type='signal',interface='org.a11y.atspi.Event.Object',member='AttributesChanged'";
648 const REGISTRY_EVENT_STRING: &'static str = "Object:";
649
650 type Body = EventBodyOwned;
651
652 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
653 Ok(Self { item })
654 }
655 fn sender(&self) -> String {
656 self.item.name.clone()
657 }
658 fn path<'a>(&self) -> ObjectPath<'_> {
659 self.item.path.clone().into()
660 }
661 fn body(&self) -> Self::Body {
662 let copy: AttributesChangedEvent = self.clone();
663 copy.into()
664 }
665}
666
667impl GenericEvent<'_> for RowInsertedEvent {
668 const DBUS_MEMBER: &'static str = "RowInserted";
669 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
670 const MATCH_RULE_STRING: &'static str =
671 "type='signal',interface='org.a11y.atspi.Event.Object',member='RowInserted'";
672 const REGISTRY_EVENT_STRING: &'static str = "Object:";
673
674 type Body = EventBodyOwned;
675
676 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
677 Ok(Self { item })
678 }
679 fn sender(&self) -> String {
680 self.item.name.clone()
681 }
682 fn path<'a>(&self) -> ObjectPath<'_> {
683 self.item.path.clone().into()
684 }
685 fn body(&self) -> Self::Body {
686 let copy: RowInsertedEvent = self.clone();
687 copy.into()
688 }
689}
690
691impl GenericEvent<'_> for RowReorderedEvent {
692 const DBUS_MEMBER: &'static str = "RowReordered";
693 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
694 const MATCH_RULE_STRING: &'static str =
695 "type='signal',interface='org.a11y.atspi.Event.Object',member='RowReordered'";
696 const REGISTRY_EVENT_STRING: &'static str = "Object:";
697
698 type Body = EventBodyOwned;
699
700 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
701 Ok(Self { item })
702 }
703 fn sender(&self) -> String {
704 self.item.name.clone()
705 }
706 fn path<'a>(&self) -> ObjectPath<'_> {
707 self.item.path.clone().into()
708 }
709 fn body(&self) -> Self::Body {
710 let copy: RowReorderedEvent = self.clone();
711 copy.into()
712 }
713}
714
715impl GenericEvent<'_> for RowDeletedEvent {
716 const DBUS_MEMBER: &'static str = "RowDeleted";
717 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
718 const MATCH_RULE_STRING: &'static str =
719 "type='signal',interface='org.a11y.atspi.Event.Object',member='RowDeleted'";
720 const REGISTRY_EVENT_STRING: &'static str = "Object:";
721
722 type Body = EventBodyOwned;
723
724 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
725 Ok(Self { item })
726 }
727 fn sender(&self) -> String {
728 self.item.name.clone()
729 }
730 fn path<'a>(&self) -> ObjectPath<'_> {
731 self.item.path.clone().into()
732 }
733 fn body(&self) -> Self::Body {
734 let copy: RowDeletedEvent = self.clone();
735 copy.into()
736 }
737}
738
739impl GenericEvent<'_> for ColumnInsertedEvent {
740 const DBUS_MEMBER: &'static str = "ColumnInserted";
741 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
742 const MATCH_RULE_STRING: &'static str =
743 "type='signal',interface='org.a11y.atspi.Event.Object',member='ColumnInserted'";
744 const REGISTRY_EVENT_STRING: &'static str = "Object:";
745
746 type Body = EventBodyOwned;
747
748 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
749 Ok(Self { item })
750 }
751 fn sender(&self) -> String {
752 self.item.name.clone()
753 }
754 fn path<'a>(&self) -> ObjectPath<'_> {
755 self.item.path.clone().into()
756 }
757 fn body(&self) -> Self::Body {
758 let copy: ColumnInsertedEvent = self.clone();
759 copy.into()
760 }
761}
762
763impl GenericEvent<'_> for ColumnReorderedEvent {
764 const DBUS_MEMBER: &'static str = "ColumnReordered";
765 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
766 const MATCH_RULE_STRING: &'static str =
767 "type='signal',interface='org.a11y.atspi.Event.Object',member='ColumnReordered'";
768 const REGISTRY_EVENT_STRING: &'static str = "Object:";
769
770 type Body = EventBodyOwned;
771
772 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
773 Ok(Self { item })
774 }
775 fn sender(&self) -> String {
776 self.item.name.clone()
777 }
778 fn path<'a>(&self) -> ObjectPath<'_> {
779 self.item.path.clone().into()
780 }
781 fn body(&self) -> Self::Body {
782 let copy: ColumnReorderedEvent = self.clone();
783 copy.into()
784 }
785}
786
787impl GenericEvent<'_> for ColumnDeletedEvent {
788 const DBUS_MEMBER: &'static str = "ColumnDeleted";
789 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
790 const MATCH_RULE_STRING: &'static str =
791 "type='signal',interface='org.a11y.atspi.Event.Object',member='ColumnDeleted'";
792 const REGISTRY_EVENT_STRING: &'static str = "Object:";
793
794 type Body = EventBodyOwned;
795
796 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
797 Ok(Self { item })
798 }
799 fn sender(&self) -> String {
800 self.item.name.clone()
801 }
802 fn path<'a>(&self) -> ObjectPath<'_> {
803 self.item.path.clone().into()
804 }
805 fn body(&self) -> Self::Body {
806 let copy: ColumnDeletedEvent = self.clone();
807 copy.into()
808 }
809}
810
811impl GenericEvent<'_> for TextBoundsChangedEvent {
812 const DBUS_MEMBER: &'static str = "TextBoundsChanged";
813 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
814 const MATCH_RULE_STRING: &'static str =
815 "type='signal',interface='org.a11y.atspi.Event.Object',member='TextBoundsChanged'";
816 const REGISTRY_EVENT_STRING: &'static str = "Object:";
817
818 type Body = EventBodyOwned;
819
820 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
821 Ok(Self { item })
822 }
823 fn sender(&self) -> String {
824 self.item.name.clone()
825 }
826 fn path<'a>(&self) -> ObjectPath<'_> {
827 self.item.path.clone().into()
828 }
829 fn body(&self) -> Self::Body {
830 let copy: TextBoundsChangedEvent = self.clone();
831 copy.into()
832 }
833}
834
835impl GenericEvent<'_> for TextSelectionChangedEvent {
836 const DBUS_MEMBER: &'static str = "TextSelectionChanged";
837 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
838 const MATCH_RULE_STRING: &'static str =
839 "type='signal',interface='org.a11y.atspi.Event.Object',member='TextSelectionChanged'";
840 const REGISTRY_EVENT_STRING: &'static str = "Object:";
841
842 type Body = EventBodyOwned;
843
844 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
845 Ok(Self { item })
846 }
847 fn sender(&self) -> String {
848 self.item.name.clone()
849 }
850 fn path<'a>(&self) -> ObjectPath<'_> {
851 self.item.path.clone().into()
852 }
853 fn body(&self) -> Self::Body {
854 let copy: TextSelectionChangedEvent = self.clone();
855 copy.into()
856 }
857}
858
859impl GenericEvent<'_> for TextChangedEvent {
860 const DBUS_MEMBER: &'static str = "TextChanged";
861 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
862 const MATCH_RULE_STRING: &'static str =
863 "type='signal',interface='org.a11y.atspi.Event.Object',member='TextChanged'";
864 const REGISTRY_EVENT_STRING: &'static str = "Object:";
865
866 type Body = EventBodyOwned;
867
868 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
869 Ok(Self {
870 item,
871 operation: body.kind,
872 start_pos: body.detail1,
873 length: body.detail2,
874 text: body.any_data.try_into()?,
875 })
876 }
877 fn sender(&self) -> String {
878 self.item.name.clone()
879 }
880 fn path<'a>(&self) -> ObjectPath<'_> {
881 self.item.path.clone().into()
882 }
883 fn body(&self) -> Self::Body {
884 let copy = self.clone();
885 copy.into()
886 }
887}
888
889impl GenericEvent<'_> for TextAttributesChangedEvent {
890 const DBUS_MEMBER: &'static str = "TextAttributesChanged";
891 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
892 const MATCH_RULE_STRING: &'static str =
893 "type='signal',interface='org.a11y.atspi.Event.Object',member='TextAttributesChanged'";
894 const REGISTRY_EVENT_STRING: &'static str = "Object:";
895
896 type Body = EventBodyOwned;
897
898 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
899 Ok(Self { item })
900 }
901 fn sender(&self) -> String {
902 self.item.name.clone()
903 }
904 fn path<'a>(&self) -> ObjectPath<'_> {
905 self.item.path.clone().into()
906 }
907 fn body(&self) -> Self::Body {
908 let copy: TextAttributesChangedEvent = self.clone();
909 copy.into()
910 }
911}
912
913impl GenericEvent<'_> for TextCaretMovedEvent {
914 const DBUS_MEMBER: &'static str = "TextCaretMoved";
915 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Object";
916 const MATCH_RULE_STRING: &'static str =
917 "type='signal',interface='org.a11y.atspi.Event.Object',member='TextCaretMoved'";
918 const REGISTRY_EVENT_STRING: &'static str = "Object:";
919
920 type Body = EventBodyOwned;
921
922 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
923 Ok(Self { item, position: body.detail1 })
924 }
925 fn sender(&self) -> String {
926 self.item.name.clone()
927 }
928 fn path<'a>(&self) -> ObjectPath<'_> {
929 self.item.path.clone().into()
930 }
931 fn body(&self) -> Self::Body {
932 let copy: TextCaretMovedEvent = self.clone();
933 copy.into()
934 }
935}
936
937#[cfg(feature = "zbus")]
938impl TryFrom<&zbus::Message> for ObjectEvents {
939 type Error = AtspiError;
940 fn try_from(ev: &zbus::Message) -> Result<Self, Self::Error> {
941 let member = ev
942 .member()
943 .ok_or(AtspiError::MemberMatch("Event without member".into()))?;
944 match member.as_str() {
945 "PropertyChange" => Ok(ObjectEvents::PropertyChange(ev.try_into()?)),
946 "BoundsChanged" => Ok(ObjectEvents::BoundsChanged(ev.try_into()?)),
947 "LinkSelected" => Ok(ObjectEvents::LinkSelected(ev.try_into()?)),
948 "StateChanged" => Ok(ObjectEvents::StateChanged(ev.try_into()?)),
949 "ChildrenChanged" => Ok(ObjectEvents::ChildrenChanged(ev.try_into()?)),
950 "VisibleDataChanged" => Ok(ObjectEvents::VisibleDataChanged(ev.try_into()?)),
951 "SelectionChanged" => Ok(ObjectEvents::SelectionChanged(ev.try_into()?)),
952 "ModelChanged" => Ok(ObjectEvents::ModelChanged(ev.try_into()?)),
953 "ActiveDescendantChanged" => Ok(ObjectEvents::ActiveDescendantChanged(ev.try_into()?)),
954 "Announcement" => Ok(ObjectEvents::Announcement(ev.try_into()?)),
955 "AttributesChanged" => Ok(ObjectEvents::AttributesChanged(ev.try_into()?)),
956 "RowInserted" => Ok(ObjectEvents::RowInserted(ev.try_into()?)),
957 "RowReordered" => Ok(ObjectEvents::RowReordered(ev.try_into()?)),
958 "RowDeleted" => Ok(ObjectEvents::RowDeleted(ev.try_into()?)),
959 "ColumnInserted" => Ok(ObjectEvents::ColumnInserted(ev.try_into()?)),
960 "ColumnReordered" => Ok(ObjectEvents::ColumnReordered(ev.try_into()?)),
961 "ColumnDeleted" => Ok(ObjectEvents::ColumnDeleted(ev.try_into()?)),
962 "TextBoundsChanged" => Ok(ObjectEvents::TextBoundsChanged(ev.try_into()?)),
963 "TextSelectionChanged" => Ok(ObjectEvents::TextSelectionChanged(ev.try_into()?)),
964 "TextChanged" => Ok(ObjectEvents::TextChanged(ev.try_into()?)),
965 "TextAttributesChanged" => Ok(ObjectEvents::TextAttributesChanged(ev.try_into()?)),
966 "TextCaretMoved" => Ok(ObjectEvents::TextCaretMoved(ev.try_into()?)),
967 _ => Err(AtspiError::MemberMatch("No matching member for Object".into())),
968 }
969 }
970}
971
972impl_from_user_facing_event_for_interface_event_enum!(
973 PropertyChangeEvent,
974 ObjectEvents,
975 ObjectEvents::PropertyChange
976);
977impl_from_user_facing_type_for_event_enum!(PropertyChangeEvent, Event::Object);
978impl_try_from_event_for_user_facing_type!(
979 PropertyChangeEvent,
980 ObjectEvents::PropertyChange,
981 Event::Object
982);
983
984event_test_cases!(PropertyChangeEvent);
985impl_to_dbus_message!(PropertyChangeEvent);
986impl_from_dbus_message!(PropertyChangeEvent);
987
988impl From<PropertyChangeEvent> for EventBodyOwned {
989 fn from(event: PropertyChangeEvent) -> Self {
990 EventBodyOwned {
991 properties: std::collections::HashMap::new(),
992 kind: event.property,
993 detail1: i32::default(),
994 detail2: i32::default(),
995 any_data: event.value.into(),
996 }
997 }
998}
999
1000impl_from_user_facing_event_for_interface_event_enum!(
1001 BoundsChangedEvent,
1002 ObjectEvents,
1003 ObjectEvents::BoundsChanged
1004);
1005impl_from_user_facing_type_for_event_enum!(BoundsChangedEvent, Event::Object);
1006impl_try_from_event_for_user_facing_type!(
1007 BoundsChangedEvent,
1008 ObjectEvents::BoundsChanged,
1009 Event::Object
1010);
1011event_test_cases!(BoundsChangedEvent);
1012impl_to_dbus_message!(BoundsChangedEvent);
1013impl_from_dbus_message!(BoundsChangedEvent);
1014impl From<BoundsChangedEvent> for EventBodyOwned {
1015 fn from(_event: BoundsChangedEvent) -> Self {
1016 EventBodyOwned {
1017 properties: std::collections::HashMap::new(),
1018 kind: String::default(),
1019 detail1: i32::default(),
1020 detail2: i32::default(),
1021 any_data: zvariant::Value::U8(0).into(),
1022 }
1023 }
1024}
1025
1026impl_from_user_facing_event_for_interface_event_enum!(
1027 LinkSelectedEvent,
1028 ObjectEvents,
1029 ObjectEvents::LinkSelected
1030);
1031impl_from_user_facing_type_for_event_enum!(LinkSelectedEvent, Event::Object);
1032impl_try_from_event_for_user_facing_type!(
1033 LinkSelectedEvent,
1034 ObjectEvents::LinkSelected,
1035 Event::Object
1036);
1037event_test_cases!(LinkSelectedEvent);
1038impl_to_dbus_message!(LinkSelectedEvent);
1039impl_from_dbus_message!(LinkSelectedEvent);
1040impl From<LinkSelectedEvent> for EventBodyOwned {
1041 fn from(_event: LinkSelectedEvent) -> Self {
1042 EventBodyOwned {
1043 properties: std::collections::HashMap::new(),
1044 kind: String::default(),
1045 detail1: i32::default(),
1046 detail2: i32::default(),
1047 any_data: zvariant::Value::U8(0).into(),
1048 }
1049 }
1050}
1051
1052impl_from_user_facing_event_for_interface_event_enum!(
1053 StateChangedEvent,
1054 ObjectEvents,
1055 ObjectEvents::StateChanged
1056);
1057impl_from_user_facing_type_for_event_enum!(StateChangedEvent, Event::Object);
1058impl_try_from_event_for_user_facing_type!(
1059 StateChangedEvent,
1060 ObjectEvents::StateChanged,
1061 Event::Object
1062);
1063event_test_cases!(StateChangedEvent);
1064impl_to_dbus_message!(StateChangedEvent);
1065impl_from_dbus_message!(StateChangedEvent);
1066impl From<StateChangedEvent> for EventBodyOwned {
1067 fn from(event: StateChangedEvent) -> Self {
1068 EventBodyOwned {
1069 properties: std::collections::HashMap::new(),
1070 kind: event.state.into(),
1071 detail1: event.enabled,
1072 detail2: i32::default(),
1073 any_data: zvariant::Value::U8(0).into(),
1074 }
1075 }
1076}
1077
1078impl_from_user_facing_event_for_interface_event_enum!(
1079 ChildrenChangedEvent,
1080 ObjectEvents,
1081 ObjectEvents::ChildrenChanged
1082);
1083impl_from_user_facing_type_for_event_enum!(ChildrenChangedEvent, Event::Object);
1084impl_try_from_event_for_user_facing_type!(
1085 ChildrenChangedEvent,
1086 ObjectEvents::ChildrenChanged,
1087 Event::Object
1088);
1089event_test_cases!(ChildrenChangedEvent);
1090impl_to_dbus_message!(ChildrenChangedEvent);
1091impl_from_dbus_message!(ChildrenChangedEvent);
1092impl From<ChildrenChangedEvent> for EventBodyOwned {
1093 fn from(event: ChildrenChangedEvent) -> Self {
1094 EventBodyOwned {
1095 properties: std::collections::HashMap::new(),
1096 kind: event.operation,
1097 detail1: event.index_in_parent,
1098 detail2: i32::default(),
1099 any_data: zvariant::Value::from(event.child).into(),
1100 }
1101 }
1102}
1103
1104impl_from_user_facing_event_for_interface_event_enum!(
1105 VisibleDataChangedEvent,
1106 ObjectEvents,
1107 ObjectEvents::VisibleDataChanged
1108);
1109impl_from_user_facing_type_for_event_enum!(VisibleDataChangedEvent, Event::Object);
1110impl_try_from_event_for_user_facing_type!(
1111 VisibleDataChangedEvent,
1112 ObjectEvents::VisibleDataChanged,
1113 Event::Object
1114);
1115event_test_cases!(VisibleDataChangedEvent);
1116impl_to_dbus_message!(VisibleDataChangedEvent);
1117impl_from_dbus_message!(VisibleDataChangedEvent);
1118impl From<VisibleDataChangedEvent> for EventBodyOwned {
1119 fn from(_event: VisibleDataChangedEvent) -> Self {
1120 EventBodyOwned {
1121 properties: std::collections::HashMap::new(),
1122 kind: String::default(),
1123 detail1: i32::default(),
1124 detail2: i32::default(),
1125 any_data: zvariant::Value::U8(0).into(),
1126 }
1127 }
1128}
1129
1130impl_from_user_facing_event_for_interface_event_enum!(
1131 SelectionChangedEvent,
1132 ObjectEvents,
1133 ObjectEvents::SelectionChanged
1134);
1135impl_from_user_facing_type_for_event_enum!(SelectionChangedEvent, Event::Object);
1136impl_try_from_event_for_user_facing_type!(
1137 SelectionChangedEvent,
1138 ObjectEvents::SelectionChanged,
1139 Event::Object
1140);
1141event_test_cases!(SelectionChangedEvent);
1142impl_to_dbus_message!(SelectionChangedEvent);
1143impl_from_dbus_message!(SelectionChangedEvent);
1144impl From<SelectionChangedEvent> for EventBodyOwned {
1145 fn from(_event: SelectionChangedEvent) -> Self {
1146 EventBodyOwned {
1147 properties: std::collections::HashMap::new(),
1148 kind: String::default(),
1149 detail1: i32::default(),
1150 detail2: i32::default(),
1151 any_data: zvariant::Value::U8(0).into(),
1152 }
1153 }
1154}
1155
1156impl_from_user_facing_event_for_interface_event_enum!(
1157 ModelChangedEvent,
1158 ObjectEvents,
1159 ObjectEvents::ModelChanged
1160);
1161impl_from_user_facing_type_for_event_enum!(ModelChangedEvent, Event::Object);
1162impl_try_from_event_for_user_facing_type!(
1163 ModelChangedEvent,
1164 ObjectEvents::ModelChanged,
1165 Event::Object
1166);
1167event_test_cases!(ModelChangedEvent);
1168impl_to_dbus_message!(ModelChangedEvent);
1169impl_from_dbus_message!(ModelChangedEvent);
1170impl From<ModelChangedEvent> for EventBodyOwned {
1171 fn from(_event: ModelChangedEvent) -> Self {
1172 EventBodyOwned {
1173 properties: std::collections::HashMap::new(),
1174 kind: String::default(),
1175 detail1: i32::default(),
1176 detail2: i32::default(),
1177 any_data: zvariant::Value::U8(0).into(),
1178 }
1179 }
1180}
1181
1182impl_from_user_facing_event_for_interface_event_enum!(
1183 ActiveDescendantChangedEvent,
1184 ObjectEvents,
1185 ObjectEvents::ActiveDescendantChanged
1186);
1187impl_from_user_facing_type_for_event_enum!(ActiveDescendantChangedEvent, Event::Object);
1188impl_try_from_event_for_user_facing_type!(
1189 ActiveDescendantChangedEvent,
1190 ObjectEvents::ActiveDescendantChanged,
1191 Event::Object
1192);
1193event_test_cases!(ActiveDescendantChangedEvent);
1194impl_to_dbus_message!(ActiveDescendantChangedEvent);
1195impl_from_dbus_message!(ActiveDescendantChangedEvent);
1196impl From<ActiveDescendantChangedEvent> for EventBodyOwned {
1197 fn from(event: ActiveDescendantChangedEvent) -> Self {
1198 EventBodyOwned {
1199 properties: std::collections::HashMap::new(),
1200 kind: String::default(),
1201 detail1: i32::default(),
1202 detail2: i32::default(),
1203 any_data: zvariant::Value::from(event.child).into(),
1204 }
1205 }
1206}
1207
1208impl_from_user_facing_event_for_interface_event_enum!(
1209 AnnouncementEvent,
1210 ObjectEvents,
1211 ObjectEvents::Announcement
1212);
1213impl_from_user_facing_type_for_event_enum!(AnnouncementEvent, Event::Object);
1214impl_try_from_event_for_user_facing_type!(
1215 AnnouncementEvent,
1216 ObjectEvents::Announcement,
1217 Event::Object
1218);
1219event_test_cases!(AnnouncementEvent);
1220impl_to_dbus_message!(AnnouncementEvent);
1221impl_from_dbus_message!(AnnouncementEvent);
1222impl From<AnnouncementEvent> for EventBodyOwned {
1223 fn from(event: AnnouncementEvent) -> Self {
1224 EventBodyOwned {
1225 detail1: event.live as i32,
1226 any_data: zvariant::Value::from(event.text).into(),
1227 ..Default::default()
1228 }
1229 }
1230}
1231
1232impl_from_user_facing_event_for_interface_event_enum!(
1233 AttributesChangedEvent,
1234 ObjectEvents,
1235 ObjectEvents::AttributesChanged
1236);
1237impl_from_user_facing_type_for_event_enum!(AttributesChangedEvent, Event::Object);
1238impl_try_from_event_for_user_facing_type!(
1239 AttributesChangedEvent,
1240 ObjectEvents::AttributesChanged,
1241 Event::Object
1242);
1243event_test_cases!(AttributesChangedEvent);
1244impl_to_dbus_message!(AttributesChangedEvent);
1245impl_from_dbus_message!(AttributesChangedEvent);
1246impl From<AttributesChangedEvent> for EventBodyOwned {
1247 fn from(_event: AttributesChangedEvent) -> Self {
1248 EventBodyOwned {
1249 properties: std::collections::HashMap::new(),
1250 kind: String::default(),
1251 detail1: i32::default(),
1252 detail2: i32::default(),
1253 any_data: zvariant::Value::U8(0).into(),
1254 }
1255 }
1256}
1257
1258impl_from_user_facing_event_for_interface_event_enum!(
1259 RowInsertedEvent,
1260 ObjectEvents,
1261 ObjectEvents::RowInserted
1262);
1263impl_from_user_facing_type_for_event_enum!(RowInsertedEvent, Event::Object);
1264impl_try_from_event_for_user_facing_type!(
1265 RowInsertedEvent,
1266 ObjectEvents::RowInserted,
1267 Event::Object
1268);
1269event_test_cases!(RowInsertedEvent);
1270impl_to_dbus_message!(RowInsertedEvent);
1271impl_from_dbus_message!(RowInsertedEvent);
1272impl From<RowInsertedEvent> for EventBodyOwned {
1273 fn from(_event: RowInsertedEvent) -> Self {
1274 EventBodyOwned {
1275 properties: std::collections::HashMap::new(),
1276 kind: String::default(),
1277 detail1: i32::default(),
1278 detail2: i32::default(),
1279 any_data: zvariant::Value::U8(0).into(),
1280 }
1281 }
1282}
1283
1284impl_from_user_facing_event_for_interface_event_enum!(
1285 RowReorderedEvent,
1286 ObjectEvents,
1287 ObjectEvents::RowReordered
1288);
1289impl_from_user_facing_type_for_event_enum!(RowReorderedEvent, Event::Object);
1290impl_try_from_event_for_user_facing_type!(
1291 RowReorderedEvent,
1292 ObjectEvents::RowReordered,
1293 Event::Object
1294);
1295event_test_cases!(RowReorderedEvent);
1296impl_to_dbus_message!(RowReorderedEvent);
1297impl_from_dbus_message!(RowReorderedEvent);
1298impl From<RowReorderedEvent> for EventBodyOwned {
1299 fn from(_event: RowReorderedEvent) -> Self {
1300 EventBodyOwned {
1301 properties: std::collections::HashMap::new(),
1302 kind: String::default(),
1303 detail1: i32::default(),
1304 detail2: i32::default(),
1305 any_data: zvariant::Value::U8(0).into(),
1306 }
1307 }
1308}
1309
1310impl_from_user_facing_event_for_interface_event_enum!(
1311 RowDeletedEvent,
1312 ObjectEvents,
1313 ObjectEvents::RowDeleted
1314);
1315impl_from_user_facing_type_for_event_enum!(RowDeletedEvent, Event::Object);
1316impl_try_from_event_for_user_facing_type!(RowDeletedEvent, ObjectEvents::RowDeleted, Event::Object);
1317event_test_cases!(RowDeletedEvent);
1318impl_to_dbus_message!(RowDeletedEvent);
1319impl_from_dbus_message!(RowDeletedEvent);
1320impl From<RowDeletedEvent> for EventBodyOwned {
1321 fn from(_event: RowDeletedEvent) -> Self {
1322 EventBodyOwned {
1323 properties: std::collections::HashMap::new(),
1324 kind: String::default(),
1325 detail1: i32::default(),
1326 detail2: i32::default(),
1327 any_data: zvariant::Value::U8(0).into(),
1328 }
1329 }
1330}
1331
1332impl_from_user_facing_event_for_interface_event_enum!(
1333 ColumnInsertedEvent,
1334 ObjectEvents,
1335 ObjectEvents::ColumnInserted
1336);
1337impl_from_user_facing_type_for_event_enum!(ColumnInsertedEvent, Event::Object);
1338impl_try_from_event_for_user_facing_type!(
1339 ColumnInsertedEvent,
1340 ObjectEvents::ColumnInserted,
1341 Event::Object
1342);
1343event_test_cases!(ColumnInsertedEvent);
1344impl_to_dbus_message!(ColumnInsertedEvent);
1345impl_from_dbus_message!(ColumnInsertedEvent);
1346impl From<ColumnInsertedEvent> for EventBodyOwned {
1347 fn from(_event: ColumnInsertedEvent) -> Self {
1348 EventBodyOwned {
1349 properties: std::collections::HashMap::new(),
1350 kind: String::default(),
1351 detail1: i32::default(),
1352 detail2: i32::default(),
1353 any_data: zvariant::Value::U8(0).into(),
1354 }
1355 }
1356}
1357
1358impl_from_user_facing_event_for_interface_event_enum!(
1359 ColumnReorderedEvent,
1360 ObjectEvents,
1361 ObjectEvents::ColumnReordered
1362);
1363impl_from_user_facing_type_for_event_enum!(ColumnReorderedEvent, Event::Object);
1364impl_try_from_event_for_user_facing_type!(
1365 ColumnReorderedEvent,
1366 ObjectEvents::ColumnReordered,
1367 Event::Object
1368);
1369event_test_cases!(ColumnReorderedEvent);
1370impl_to_dbus_message!(ColumnReorderedEvent);
1371impl_from_dbus_message!(ColumnReorderedEvent);
1372impl From<ColumnReorderedEvent> for EventBodyOwned {
1373 fn from(_event: ColumnReorderedEvent) -> Self {
1374 EventBodyOwned {
1375 properties: std::collections::HashMap::new(),
1376 kind: String::default(),
1377 detail1: i32::default(),
1378 detail2: i32::default(),
1379 any_data: zvariant::Value::U8(0).into(),
1380 }
1381 }
1382}
1383
1384impl_from_user_facing_event_for_interface_event_enum!(
1385 ColumnDeletedEvent,
1386 ObjectEvents,
1387 ObjectEvents::ColumnDeleted
1388);
1389impl_from_user_facing_type_for_event_enum!(ColumnDeletedEvent, Event::Object);
1390impl_try_from_event_for_user_facing_type!(
1391 ColumnDeletedEvent,
1392 ObjectEvents::ColumnDeleted,
1393 Event::Object
1394);
1395event_test_cases!(ColumnDeletedEvent);
1396impl_to_dbus_message!(ColumnDeletedEvent);
1397impl_from_dbus_message!(ColumnDeletedEvent);
1398impl From<ColumnDeletedEvent> for EventBodyOwned {
1399 fn from(_event: ColumnDeletedEvent) -> Self {
1400 EventBodyOwned {
1401 properties: std::collections::HashMap::new(),
1402 kind: String::default(),
1403 detail1: i32::default(),
1404 detail2: i32::default(),
1405 any_data: zvariant::Value::U8(0).into(),
1406 }
1407 }
1408}
1409
1410impl_from_user_facing_event_for_interface_event_enum!(
1411 TextBoundsChangedEvent,
1412 ObjectEvents,
1413 ObjectEvents::TextBoundsChanged
1414);
1415impl_from_user_facing_type_for_event_enum!(TextBoundsChangedEvent, Event::Object);
1416impl_try_from_event_for_user_facing_type!(
1417 TextBoundsChangedEvent,
1418 ObjectEvents::TextBoundsChanged,
1419 Event::Object
1420);
1421event_test_cases!(TextBoundsChangedEvent);
1422impl_to_dbus_message!(TextBoundsChangedEvent);
1423impl_from_dbus_message!(TextBoundsChangedEvent);
1424impl From<TextBoundsChangedEvent> for EventBodyOwned {
1425 fn from(_event: TextBoundsChangedEvent) -> Self {
1426 EventBodyOwned {
1427 properties: std::collections::HashMap::new(),
1428 kind: String::default(),
1429 detail1: i32::default(),
1430 detail2: i32::default(),
1431 any_data: zvariant::Value::U8(0).into(),
1432 }
1433 }
1434}
1435
1436impl_from_user_facing_event_for_interface_event_enum!(
1437 TextSelectionChangedEvent,
1438 ObjectEvents,
1439 ObjectEvents::TextSelectionChanged
1440);
1441impl_from_user_facing_type_for_event_enum!(TextSelectionChangedEvent, Event::Object);
1442impl_try_from_event_for_user_facing_type!(
1443 TextSelectionChangedEvent,
1444 ObjectEvents::TextSelectionChanged,
1445 Event::Object
1446);
1447event_test_cases!(TextSelectionChangedEvent);
1448impl_to_dbus_message!(TextSelectionChangedEvent);
1449impl_from_dbus_message!(TextSelectionChangedEvent);
1450impl From<TextSelectionChangedEvent> for EventBodyOwned {
1451 fn from(_event: TextSelectionChangedEvent) -> Self {
1452 EventBodyOwned {
1453 properties: std::collections::HashMap::new(),
1454 kind: String::default(),
1455 detail1: i32::default(),
1456 detail2: i32::default(),
1457 any_data: zvariant::Value::U8(0).into(),
1458 }
1459 }
1460}
1461
1462impl_from_user_facing_event_for_interface_event_enum!(
1463 TextChangedEvent,
1464 ObjectEvents,
1465 ObjectEvents::TextChanged
1466);
1467impl_from_user_facing_type_for_event_enum!(TextChangedEvent, Event::Object);
1468impl_try_from_event_for_user_facing_type!(
1469 TextChangedEvent,
1470 ObjectEvents::TextChanged,
1471 Event::Object
1472);
1473event_test_cases!(TextChangedEvent);
1474impl_to_dbus_message!(TextChangedEvent);
1475impl_from_dbus_message!(TextChangedEvent);
1476impl From<TextChangedEvent> for EventBodyOwned {
1477 fn from(event: TextChangedEvent) -> Self {
1478 EventBodyOwned {
1479 properties: std::collections::HashMap::new(),
1480 kind: event.operation,
1481 detail1: event.start_pos,
1482 detail2: event.length,
1483 any_data: zvariant::Value::from(event.text).into(),
1484 }
1485 }
1486}
1487
1488impl_from_user_facing_event_for_interface_event_enum!(
1489 TextAttributesChangedEvent,
1490 ObjectEvents,
1491 ObjectEvents::TextAttributesChanged
1492);
1493impl_from_user_facing_type_for_event_enum!(TextAttributesChangedEvent, Event::Object);
1494impl_try_from_event_for_user_facing_type!(
1495 TextAttributesChangedEvent,
1496 ObjectEvents::TextAttributesChanged,
1497 Event::Object
1498);
1499event_test_cases!(TextAttributesChangedEvent);
1500impl_to_dbus_message!(TextAttributesChangedEvent);
1501impl_from_dbus_message!(TextAttributesChangedEvent);
1502impl From<TextAttributesChangedEvent> for EventBodyOwned {
1503 fn from(_event: TextAttributesChangedEvent) -> Self {
1504 EventBodyOwned {
1505 properties: std::collections::HashMap::new(),
1506 kind: String::default(),
1507 detail1: i32::default(),
1508 detail2: i32::default(),
1509 any_data: zvariant::Value::U8(0).into(),
1510 }
1511 }
1512}
1513
1514impl_from_user_facing_event_for_interface_event_enum!(
1515 TextCaretMovedEvent,
1516 ObjectEvents,
1517 ObjectEvents::TextCaretMoved
1518);
1519impl_from_user_facing_type_for_event_enum!(TextCaretMovedEvent, Event::Object);
1520impl_try_from_event_for_user_facing_type!(
1521 TextCaretMovedEvent,
1522 ObjectEvents::TextCaretMoved,
1523 Event::Object
1524);
1525event_test_cases!(TextCaretMovedEvent);
1526impl_to_dbus_message!(TextCaretMovedEvent);
1527impl_from_dbus_message!(TextCaretMovedEvent);
1528impl From<TextCaretMovedEvent> for EventBodyOwned {
1529 fn from(event: TextCaretMovedEvent) -> Self {
1530 EventBodyOwned {
1531 properties: std::collections::HashMap::new(),
1532 kind: String::default(),
1533 detail1: event.position,
1534 detail2: i32::default(),
1535 any_data: zvariant::Value::U8(0).into(),
1536 }
1537 }
1538}
1539
1540impl HasRegistryEventString for ObjectEvents {
1541 const REGISTRY_EVENT_STRING: &'static str = "Object:";
1542}
1543