1use crate::{
2 error::AtspiError,
3 events::{Accessible, EventBodyOwned, GenericEvent, HasMatchRule, HasRegistryEventString},
4 Event,
5};
6use zvariant::ObjectPath;
7
8/// All events on the `org.a11y.atspi.Event.Window` interface.
9#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
10pub enum WindowEvents {
11 /// See: [`PropertyChangeEvent`].
12 PropertyChange(PropertyChangeEvent),
13 /// See: [`MinimizeEvent`].
14 Minimize(MinimizeEvent),
15 /// See: [`MaximizeEvent`].
16 Maximize(MaximizeEvent),
17 /// See: [`RestoreEvent`].
18 Restore(RestoreEvent),
19 /// See: [`CloseEvent`].
20 Close(CloseEvent),
21 /// See: [`CreateEvent`].
22 Create(CreateEvent),
23 /// See: [`ReparentEvent`].
24 Reparent(ReparentEvent),
25 /// See: [`DesktopCreateEvent`].
26 DesktopCreate(DesktopCreateEvent),
27 /// See: [`DesktopDestroyEvent`].
28 DesktopDestroy(DesktopDestroyEvent),
29 /// See: [`DestroyEvent`].
30 Destroy(DestroyEvent),
31 /// See: [`ActivateEvent`].
32 Activate(ActivateEvent),
33 /// See: [`DeactivateEvent`].
34 Deactivate(DeactivateEvent),
35 /// See: [`RaiseEvent`].
36 Raise(RaiseEvent),
37 /// See: [`LowerEvent`].
38 Lower(LowerEvent),
39 /// See: [`MoveEvent`].
40 Move(MoveEvent),
41 /// See: [`ResizeEvent`].
42 Resize(ResizeEvent),
43 /// See: [`ShadeEvent`].
44 Shade(ShadeEvent),
45 /// See: [`UUshadeEvent`].
46 UUshade(UUshadeEvent),
47 /// See: [`RestyleEvent`].
48 Restyle(RestyleEvent),
49}
50
51impl_from_interface_event_enum_for_event!(WindowEvents, Event::Window);
52impl_try_from_event_for_user_facing_event_type!(WindowEvents, Event::Window);
53
54event_wrapper_test_cases!(WindowEvents, MoveEvent);
55
56impl HasMatchRule for WindowEvents {
57 const MATCH_RULE_STRING: &'static str = "type='signal',interface='org.a11y.atspi.Event.Window'";
58}
59
60#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
61pub struct PropertyChangeEvent {
62 /// The [`Accessible`] which the event applies to.
63 pub item: crate::events::Accessible,
64 pub property: String,
65}
66
67/// The window has been minimized.
68#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
69pub struct MinimizeEvent {
70 /// The application which has been minimized.
71 pub item: crate::events::Accessible,
72}
73
74/// The window has been maximized.
75#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
76pub struct MaximizeEvent {
77 /// The application which has been maximized.
78 pub item: crate::events::Accessible,
79}
80
81#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
82pub struct RestoreEvent {
83 /// The [`Accessible`] which the event applies to.
84 pub item: crate::events::Accessible,
85}
86
87/// A window has been closed.
88#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
89pub struct CloseEvent {
90 /// The application which has been closed.
91 pub item: crate::events::Accessible,
92}
93
94/// A new window has been created.
95#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
96pub struct CreateEvent {
97 /// An application to query for additional events from.
98 pub item: crate::events::Accessible,
99}
100
101#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
102pub struct ReparentEvent {
103 /// The [`Accessible`] which the event applies to.
104 pub item: crate::events::Accessible,
105}
106
107/// A new virtual desktop has been created.
108#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
109pub struct DesktopCreateEvent {
110 /// A reference to a new desktop
111 pub item: crate::events::Accessible,
112}
113
114/// A virtual desktop has been deleted.
115#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
116pub struct DesktopDestroyEvent {
117 /// A reference to the destroyed desktop.
118 pub item: crate::events::Accessible,
119}
120
121#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
122pub struct DestroyEvent {
123 /// The [`Accessible`] which the event applies to.
124 pub item: crate::events::Accessible,
125}
126
127#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
128pub struct ActivateEvent {
129 /// The [`Accessible`] which the event applies to.
130 pub item: crate::events::Accessible,
131}
132
133#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
134pub struct DeactivateEvent {
135 /// The [`Accessible`] which the event applies to.
136 pub item: crate::events::Accessible,
137}
138
139#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
140pub struct RaiseEvent {
141 /// The [`Accessible`] which the event applies to.
142 pub item: crate::events::Accessible,
143}
144
145#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
146pub struct LowerEvent {
147 /// The [`Accessible`] which the event applies to.
148 pub item: crate::events::Accessible,
149}
150
151#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
152pub struct MoveEvent {
153 /// The [`Accessible`] which the event applies to.
154 pub item: crate::events::Accessible,
155}
156
157/// A window has been resized.
158#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
159pub struct ResizeEvent {
160 /// The application which has been resized.
161 pub item: crate::events::Accessible,
162}
163
164#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
165pub struct ShadeEvent {
166 /// The [`Accessible`] which the event applies to.
167 pub item: crate::events::Accessible,
168}
169
170#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
171pub struct UUshadeEvent {
172 /// The [`Accessible`] which the event applies to.
173 pub item: crate::events::Accessible,
174}
175
176#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize, Eq, Hash, Default)]
177pub struct RestyleEvent {
178 /// The [`Accessible`] which the event applies to.
179 pub item: crate::events::Accessible,
180}
181
182impl GenericEvent<'_> for PropertyChangeEvent {
183 const DBUS_MEMBER: &'static str = "PropertyChange";
184 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
185 const MATCH_RULE_STRING: &'static str =
186 "type='signal',interface='org.a11y.atspi.Event.Window',member='PropertyChange'";
187 const REGISTRY_EVENT_STRING: &'static str = "Window:";
188
189 type Body = EventBodyOwned;
190
191 fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError> {
192 Ok(Self { item, property: body.kind })
193 }
194 fn sender(&self) -> String {
195 self.item.name.clone()
196 }
197 fn path<'a>(&self) -> ObjectPath<'_> {
198 self.item.path.clone().into()
199 }
200 fn body(&self) -> Self::Body {
201 let copy: PropertyChangeEvent = self.clone();
202 copy.into()
203 }
204}
205
206impl GenericEvent<'_> for MinimizeEvent {
207 const DBUS_MEMBER: &'static str = "Minimize";
208 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
209 const MATCH_RULE_STRING: &'static str =
210 "type='signal',interface='org.a11y.atspi.Event.Window',member='Minimize'";
211 const REGISTRY_EVENT_STRING: &'static str = "Window:";
212
213 type Body = EventBodyOwned;
214
215 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
216 Ok(Self { item })
217 }
218 fn sender(&self) -> String {
219 self.item.name.clone()
220 }
221 fn path<'a>(&self) -> ObjectPath<'_> {
222 self.item.path.clone().into()
223 }
224 fn body(&self) -> Self::Body {
225 let copy: MinimizeEvent = self.clone();
226 copy.into()
227 }
228}
229
230impl GenericEvent<'_> for MaximizeEvent {
231 const DBUS_MEMBER: &'static str = "Maximize";
232 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
233 const MATCH_RULE_STRING: &'static str =
234 "type='signal',interface='org.a11y.atspi.Event.Window',member='Maximize'";
235 const REGISTRY_EVENT_STRING: &'static str = "Window:";
236
237 type Body = EventBodyOwned;
238
239 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
240 Ok(Self { item })
241 }
242 fn sender(&self) -> String {
243 self.item.name.clone()
244 }
245 fn path<'a>(&self) -> ObjectPath<'_> {
246 self.item.path.clone().into()
247 }
248 fn body(&self) -> Self::Body {
249 let copy: MaximizeEvent = self.clone();
250 copy.into()
251 }
252}
253
254impl GenericEvent<'_> for RestoreEvent {
255 const DBUS_MEMBER: &'static str = "Restore";
256 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
257 const MATCH_RULE_STRING: &'static str =
258 "type='signal',interface='org.a11y.atspi.Event.Window',member='Restore'";
259 const REGISTRY_EVENT_STRING: &'static str = "Window:";
260
261 type Body = EventBodyOwned;
262
263 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
264 Ok(Self { item })
265 }
266 fn sender(&self) -> String {
267 self.item.name.clone()
268 }
269 fn path<'a>(&self) -> ObjectPath<'_> {
270 self.item.path.clone().into()
271 }
272 fn body(&self) -> Self::Body {
273 let copy: RestoreEvent = self.clone();
274 copy.into()
275 }
276}
277
278impl GenericEvent<'_> for CloseEvent {
279 const DBUS_MEMBER: &'static str = "Close";
280 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
281 const MATCH_RULE_STRING: &'static str =
282 "type='signal',interface='org.a11y.atspi.Event.Window',member='Close'";
283 const REGISTRY_EVENT_STRING: &'static str = "Window:";
284
285 type Body = EventBodyOwned;
286
287 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
288 Ok(Self { item })
289 }
290 fn sender(&self) -> String {
291 self.item.name.clone()
292 }
293 fn path<'a>(&self) -> ObjectPath<'_> {
294 self.item.path.clone().into()
295 }
296 fn body(&self) -> Self::Body {
297 let copy: CloseEvent = self.clone();
298 copy.into()
299 }
300}
301
302impl GenericEvent<'_> for CreateEvent {
303 const DBUS_MEMBER: &'static str = "Create";
304 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
305 const MATCH_RULE_STRING: &'static str =
306 "type='signal',interface='org.a11y.atspi.Event.Window',member='Create'";
307 const REGISTRY_EVENT_STRING: &'static str = "Window:";
308
309 type Body = EventBodyOwned;
310
311 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
312 Ok(Self { item })
313 }
314 fn sender(&self) -> String {
315 self.item.name.clone()
316 }
317 fn path<'a>(&self) -> ObjectPath<'_> {
318 self.item.path.clone().into()
319 }
320 fn body(&self) -> Self::Body {
321 let copy: CreateEvent = self.clone();
322 copy.into()
323 }
324}
325
326impl GenericEvent<'_> for ReparentEvent {
327 const DBUS_MEMBER: &'static str = "Reparent";
328 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
329 const MATCH_RULE_STRING: &'static str =
330 "type='signal',interface='org.a11y.atspi.Event.Window',member='Reparent'";
331 const REGISTRY_EVENT_STRING: &'static str = "Window:";
332
333 type Body = EventBodyOwned;
334
335 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
336 Ok(Self { item })
337 }
338 fn sender(&self) -> String {
339 self.item.name.clone()
340 }
341 fn path<'a>(&self) -> ObjectPath<'_> {
342 self.item.path.clone().into()
343 }
344 fn body(&self) -> Self::Body {
345 let copy: ReparentEvent = self.clone();
346 copy.into()
347 }
348}
349
350impl GenericEvent<'_> for DesktopCreateEvent {
351 const DBUS_MEMBER: &'static str = "DesktopCreate";
352 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
353 const MATCH_RULE_STRING: &'static str =
354 "type='signal',interface='org.a11y.atspi.Event.Window',member='DesktopCreate'";
355 const REGISTRY_EVENT_STRING: &'static str = "Window:";
356
357 type Body = EventBodyOwned;
358
359 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
360 Ok(Self { item })
361 }
362 fn sender(&self) -> String {
363 self.item.name.clone()
364 }
365 fn path<'a>(&self) -> ObjectPath<'_> {
366 self.item.path.clone().into()
367 }
368 fn body(&self) -> Self::Body {
369 let copy: DesktopCreateEvent = self.clone();
370 copy.into()
371 }
372}
373
374impl GenericEvent<'_> for DesktopDestroyEvent {
375 const DBUS_MEMBER: &'static str = "DesktopDestroy";
376 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
377 const MATCH_RULE_STRING: &'static str =
378 "type='signal',interface='org.a11y.atspi.Event.Window',member='DesktopDestroy'";
379 const REGISTRY_EVENT_STRING: &'static str = "Window:";
380
381 type Body = EventBodyOwned;
382
383 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
384 Ok(Self { item })
385 }
386 fn sender(&self) -> String {
387 self.item.name.clone()
388 }
389 fn path<'a>(&self) -> ObjectPath<'_> {
390 self.item.path.clone().into()
391 }
392 fn body(&self) -> Self::Body {
393 let copy: DesktopDestroyEvent = self.clone();
394 copy.into()
395 }
396}
397
398impl GenericEvent<'_> for DestroyEvent {
399 const DBUS_MEMBER: &'static str = "Destroy";
400 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
401 const MATCH_RULE_STRING: &'static str =
402 "type='signal',interface='org.a11y.atspi.Event.Window',member='Destroy'";
403 const REGISTRY_EVENT_STRING: &'static str = "Window:";
404
405 type Body = EventBodyOwned;
406
407 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
408 Ok(Self { item })
409 }
410 fn sender(&self) -> String {
411 self.item.name.clone()
412 }
413 fn path<'a>(&self) -> ObjectPath<'_> {
414 self.item.path.clone().into()
415 }
416 fn body(&self) -> Self::Body {
417 let copy: DestroyEvent = self.clone();
418 copy.into()
419 }
420}
421
422impl GenericEvent<'_> for ActivateEvent {
423 const DBUS_MEMBER: &'static str = "Activate";
424 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
425 const MATCH_RULE_STRING: &'static str =
426 "type='signal',interface='org.a11y.atspi.Event.Window',member='Activate'";
427 const REGISTRY_EVENT_STRING: &'static str = "Window:";
428
429 type Body = EventBodyOwned;
430
431 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
432 Ok(Self { item })
433 }
434 fn sender(&self) -> String {
435 self.item.name.clone()
436 }
437 fn path<'a>(&self) -> ObjectPath<'_> {
438 self.item.path.clone().into()
439 }
440 fn body(&self) -> Self::Body {
441 let copy: ActivateEvent = self.clone();
442 copy.into()
443 }
444}
445
446impl GenericEvent<'_> for DeactivateEvent {
447 const DBUS_MEMBER: &'static str = "Deactivate";
448 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
449 const MATCH_RULE_STRING: &'static str =
450 "type='signal',interface='org.a11y.atspi.Event.Window',member='Deactivate'";
451 const REGISTRY_EVENT_STRING: &'static str = "Window:";
452
453 type Body = EventBodyOwned;
454
455 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
456 Ok(Self { item })
457 }
458 fn sender(&self) -> String {
459 self.item.name.clone()
460 }
461 fn path<'a>(&self) -> ObjectPath<'_> {
462 self.item.path.clone().into()
463 }
464 fn body(&self) -> Self::Body {
465 let copy: DeactivateEvent = self.clone();
466 copy.into()
467 }
468}
469
470impl GenericEvent<'_> for RaiseEvent {
471 const DBUS_MEMBER: &'static str = "Raise";
472 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
473 const MATCH_RULE_STRING: &'static str =
474 "type='signal',interface='org.a11y.atspi.Event.Window',member='Raise'";
475 const REGISTRY_EVENT_STRING: &'static str = "Window:";
476
477 type Body = EventBodyOwned;
478
479 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
480 Ok(Self { item })
481 }
482 fn sender(&self) -> String {
483 self.item.name.clone()
484 }
485 fn path<'a>(&self) -> ObjectPath<'_> {
486 self.item.path.clone().into()
487 }
488 fn body(&self) -> Self::Body {
489 let copy: RaiseEvent = self.clone();
490 copy.into()
491 }
492}
493
494impl GenericEvent<'_> for LowerEvent {
495 const DBUS_MEMBER: &'static str = "Lower";
496 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
497 const MATCH_RULE_STRING: &'static str =
498 "type='signal',interface='org.a11y.atspi.Event.Window',member='Lower'";
499 const REGISTRY_EVENT_STRING: &'static str = "Window:";
500
501 type Body = EventBodyOwned;
502
503 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
504 Ok(Self { item })
505 }
506 fn sender(&self) -> String {
507 self.item.name.clone()
508 }
509 fn path<'a>(&self) -> ObjectPath<'_> {
510 self.item.path.clone().into()
511 }
512 fn body(&self) -> Self::Body {
513 let copy: LowerEvent = self.clone();
514 copy.into()
515 }
516}
517
518impl GenericEvent<'_> for MoveEvent {
519 const DBUS_MEMBER: &'static str = "Move";
520 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
521 const MATCH_RULE_STRING: &'static str =
522 "type='signal',interface='org.a11y.atspi.Event.Window',member='Move'";
523 const REGISTRY_EVENT_STRING: &'static str = "Window:";
524
525 type Body = EventBodyOwned;
526
527 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
528 Ok(Self { item })
529 }
530 fn sender(&self) -> String {
531 self.item.name.clone()
532 }
533 fn path<'a>(&self) -> ObjectPath<'_> {
534 self.item.path.clone().into()
535 }
536 fn body(&self) -> Self::Body {
537 let copy: MoveEvent = self.clone();
538 copy.into()
539 }
540}
541
542impl GenericEvent<'_> for ResizeEvent {
543 const DBUS_MEMBER: &'static str = "Resize";
544 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
545 const MATCH_RULE_STRING: &'static str =
546 "type='signal',interface='org.a11y.atspi.Event.Window',member='Resize'";
547 const REGISTRY_EVENT_STRING: &'static str = "Window:";
548
549 type Body = EventBodyOwned;
550
551 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
552 Ok(Self { item })
553 }
554 fn sender(&self) -> String {
555 self.item.name.clone()
556 }
557 fn path<'a>(&self) -> ObjectPath<'_> {
558 self.item.path.clone().into()
559 }
560 fn body(&self) -> Self::Body {
561 let copy: ResizeEvent = self.clone();
562 copy.into()
563 }
564}
565
566impl GenericEvent<'_> for ShadeEvent {
567 const DBUS_MEMBER: &'static str = "Shade";
568 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
569 const MATCH_RULE_STRING: &'static str =
570 "type='signal',interface='org.a11y.atspi.Event.Window',member='Shade'";
571 const REGISTRY_EVENT_STRING: &'static str = "Window:";
572
573 type Body = EventBodyOwned;
574
575 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
576 Ok(Self { item })
577 }
578 fn sender(&self) -> String {
579 self.item.name.clone()
580 }
581 fn path<'a>(&self) -> ObjectPath<'_> {
582 self.item.path.clone().into()
583 }
584 fn body(&self) -> Self::Body {
585 let copy: ShadeEvent = self.clone();
586 copy.into()
587 }
588}
589
590impl GenericEvent<'_> for UUshadeEvent {
591 const DBUS_MEMBER: &'static str = "uUshade";
592 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
593 const MATCH_RULE_STRING: &'static str =
594 "type='signal',interface='org.a11y.atspi.Event.Window',member='uUshade'";
595 const REGISTRY_EVENT_STRING: &'static str = "Window:";
596
597 type Body = EventBodyOwned;
598
599 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
600 Ok(Self { item })
601 }
602 fn sender(&self) -> String {
603 self.item.name.clone()
604 }
605 fn path<'a>(&self) -> ObjectPath<'_> {
606 self.item.path.clone().into()
607 }
608 fn body(&self) -> Self::Body {
609 let copy: UUshadeEvent = self.clone();
610 copy.into()
611 }
612}
613
614impl GenericEvent<'_> for RestyleEvent {
615 const DBUS_MEMBER: &'static str = "Restyle";
616 const DBUS_INTERFACE: &'static str = "org.a11y.atspi.Event.Window";
617 const MATCH_RULE_STRING: &'static str =
618 "type='signal',interface='org.a11y.atspi.Event.Window',member='Restyle'";
619 const REGISTRY_EVENT_STRING: &'static str = "Window:";
620
621 type Body = EventBodyOwned;
622
623 fn build(item: Accessible, _body: Self::Body) -> Result<Self, AtspiError> {
624 Ok(Self { item })
625 }
626 fn sender(&self) -> String {
627 self.item.name.clone()
628 }
629 fn path<'a>(&self) -> ObjectPath<'_> {
630 self.item.path.clone().into()
631 }
632 fn body(&self) -> Self::Body {
633 let copy: RestyleEvent = self.clone();
634 copy.into()
635 }
636}
637
638#[cfg(feature = "zbus")]
639impl TryFrom<&zbus::Message> for WindowEvents {
640 type Error = AtspiError;
641 fn try_from(ev: &zbus::Message) -> Result<Self, Self::Error> {
642 let member = ev
643 .member()
644 .ok_or(AtspiError::MemberMatch("Event without member".into()))?;
645 match member.as_str() {
646 "PropertyChange" => Ok(WindowEvents::PropertyChange(ev.try_into()?)),
647 "Minimize" => Ok(WindowEvents::Minimize(ev.try_into()?)),
648 "Maximize" => Ok(WindowEvents::Maximize(ev.try_into()?)),
649 "Restore" => Ok(WindowEvents::Restore(ev.try_into()?)),
650 "Close" => Ok(WindowEvents::Close(ev.try_into()?)),
651 "Create" => Ok(WindowEvents::Create(ev.try_into()?)),
652 "Reparent" => Ok(WindowEvents::Reparent(ev.try_into()?)),
653 "DesktopCreate" => Ok(WindowEvents::DesktopCreate(ev.try_into()?)),
654 "DesktopDestroy" => Ok(WindowEvents::DesktopDestroy(ev.try_into()?)),
655 "Destroy" => Ok(WindowEvents::Destroy(ev.try_into()?)),
656 "Activate" => Ok(WindowEvents::Activate(ev.try_into()?)),
657 "Deactivate" => Ok(WindowEvents::Deactivate(ev.try_into()?)),
658 "Raise" => Ok(WindowEvents::Raise(ev.try_into()?)),
659 "Lower" => Ok(WindowEvents::Lower(ev.try_into()?)),
660 "Move" => Ok(WindowEvents::Move(ev.try_into()?)),
661 "Resize" => Ok(WindowEvents::Resize(ev.try_into()?)),
662 "Shade" => Ok(WindowEvents::Shade(ev.try_into()?)),
663 "uUshade" => Ok(WindowEvents::UUshade(ev.try_into()?)),
664 "Restyle" => Ok(WindowEvents::Restyle(ev.try_into()?)),
665 _ => Err(AtspiError::MemberMatch("No matching member for Window".into())),
666 }
667 }
668}
669
670impl_from_user_facing_event_for_interface_event_enum!(
671 PropertyChangeEvent,
672 WindowEvents,
673 WindowEvents::PropertyChange
674);
675impl_from_user_facing_type_for_event_enum!(PropertyChangeEvent, Event::Window);
676impl_try_from_event_for_user_facing_type!(
677 PropertyChangeEvent,
678 WindowEvents::PropertyChange,
679 Event::Window
680);
681event_test_cases!(PropertyChangeEvent);
682impl_to_dbus_message!(PropertyChangeEvent);
683impl_from_dbus_message!(PropertyChangeEvent);
684impl From<PropertyChangeEvent> for EventBodyOwned {
685 fn from(event: PropertyChangeEvent) -> Self {
686 EventBodyOwned {
687 properties: std::collections::HashMap::new(),
688 kind: event.property,
689 detail1: i32::default(),
690 detail2: i32::default(),
691 any_data: zvariant::Value::U8(0).into(),
692 }
693 }
694}
695
696impl_from_user_facing_event_for_interface_event_enum!(
697 MinimizeEvent,
698 WindowEvents,
699 WindowEvents::Minimize
700);
701impl_from_user_facing_type_for_event_enum!(MinimizeEvent, Event::Window);
702impl_try_from_event_for_user_facing_type!(MinimizeEvent, WindowEvents::Minimize, Event::Window);
703event_test_cases!(MinimizeEvent);
704impl_to_dbus_message!(MinimizeEvent);
705impl_from_dbus_message!(MinimizeEvent);
706impl From<MinimizeEvent> for EventBodyOwned {
707 fn from(_event: MinimizeEvent) -> Self {
708 EventBodyOwned {
709 properties: std::collections::HashMap::new(),
710 kind: String::default(),
711 detail1: i32::default(),
712 detail2: i32::default(),
713 any_data: zvariant::Value::U8(0).into(),
714 }
715 }
716}
717
718impl_from_user_facing_event_for_interface_event_enum!(
719 MaximizeEvent,
720 WindowEvents,
721 WindowEvents::Maximize
722);
723impl_from_user_facing_type_for_event_enum!(MaximizeEvent, Event::Window);
724impl_try_from_event_for_user_facing_type!(MaximizeEvent, WindowEvents::Maximize, Event::Window);
725event_test_cases!(MaximizeEvent);
726impl_to_dbus_message!(MaximizeEvent);
727impl_from_dbus_message!(MaximizeEvent);
728impl From<MaximizeEvent> for EventBodyOwned {
729 fn from(_event: MaximizeEvent) -> Self {
730 EventBodyOwned {
731 properties: std::collections::HashMap::new(),
732 kind: String::default(),
733 detail1: i32::default(),
734 detail2: i32::default(),
735 any_data: zvariant::Value::U8(0).into(),
736 }
737 }
738}
739
740impl_from_user_facing_event_for_interface_event_enum!(
741 RestoreEvent,
742 WindowEvents,
743 WindowEvents::Restore
744);
745impl_from_user_facing_type_for_event_enum!(RestoreEvent, Event::Window);
746impl_try_from_event_for_user_facing_type!(RestoreEvent, WindowEvents::Restore, Event::Window);
747event_test_cases!(RestoreEvent);
748impl_to_dbus_message!(RestoreEvent);
749impl_from_dbus_message!(RestoreEvent);
750impl From<RestoreEvent> for EventBodyOwned {
751 fn from(_event: RestoreEvent) -> Self {
752 EventBodyOwned {
753 properties: std::collections::HashMap::new(),
754 kind: String::default(),
755 detail1: i32::default(),
756 detail2: i32::default(),
757 any_data: zvariant::Value::U8(0).into(),
758 }
759 }
760}
761
762impl_from_user_facing_event_for_interface_event_enum!(
763 CloseEvent,
764 WindowEvents,
765 WindowEvents::Close
766);
767impl_from_user_facing_type_for_event_enum!(CloseEvent, Event::Window);
768impl_try_from_event_for_user_facing_type!(CloseEvent, WindowEvents::Close, Event::Window);
769event_test_cases!(CloseEvent);
770impl_to_dbus_message!(CloseEvent);
771impl_from_dbus_message!(CloseEvent);
772impl From<CloseEvent> for EventBodyOwned {
773 fn from(_event: CloseEvent) -> Self {
774 EventBodyOwned {
775 properties: std::collections::HashMap::new(),
776 kind: String::default(),
777 detail1: i32::default(),
778 detail2: i32::default(),
779 any_data: zvariant::Value::U8(0).into(),
780 }
781 }
782}
783
784impl_from_user_facing_event_for_interface_event_enum!(
785 CreateEvent,
786 WindowEvents,
787 WindowEvents::Create
788);
789impl_from_user_facing_type_for_event_enum!(CreateEvent, Event::Window);
790impl_try_from_event_for_user_facing_type!(CreateEvent, WindowEvents::Create, Event::Window);
791event_test_cases!(CreateEvent);
792impl_to_dbus_message!(CreateEvent);
793impl_from_dbus_message!(CreateEvent);
794impl From<CreateEvent> for EventBodyOwned {
795 fn from(_event: CreateEvent) -> Self {
796 EventBodyOwned {
797 properties: std::collections::HashMap::new(),
798 kind: String::default(),
799 detail1: i32::default(),
800 detail2: i32::default(),
801 any_data: zvariant::Value::U8(0).into(),
802 }
803 }
804}
805
806impl_from_user_facing_event_for_interface_event_enum!(
807 ReparentEvent,
808 WindowEvents,
809 WindowEvents::Reparent
810);
811impl_from_user_facing_type_for_event_enum!(ReparentEvent, Event::Window);
812impl_try_from_event_for_user_facing_type!(ReparentEvent, WindowEvents::Reparent, Event::Window);
813event_test_cases!(ReparentEvent);
814impl_to_dbus_message!(ReparentEvent);
815impl_from_dbus_message!(ReparentEvent);
816impl From<ReparentEvent> for EventBodyOwned {
817 fn from(_event: ReparentEvent) -> Self {
818 EventBodyOwned {
819 properties: std::collections::HashMap::new(),
820 kind: String::default(),
821 detail1: i32::default(),
822 detail2: i32::default(),
823 any_data: zvariant::Value::U8(0).into(),
824 }
825 }
826}
827
828impl_from_user_facing_event_for_interface_event_enum!(
829 DesktopCreateEvent,
830 WindowEvents,
831 WindowEvents::DesktopCreate
832);
833impl_from_user_facing_type_for_event_enum!(DesktopCreateEvent, Event::Window);
834impl_try_from_event_for_user_facing_type!(
835 DesktopCreateEvent,
836 WindowEvents::DesktopCreate,
837 Event::Window
838);
839event_test_cases!(DesktopCreateEvent);
840impl_to_dbus_message!(DesktopCreateEvent);
841impl_from_dbus_message!(DesktopCreateEvent);
842impl From<DesktopCreateEvent> for EventBodyOwned {
843 fn from(_event: DesktopCreateEvent) -> Self {
844 EventBodyOwned {
845 properties: std::collections::HashMap::new(),
846 kind: String::default(),
847 detail1: i32::default(),
848 detail2: i32::default(),
849 any_data: zvariant::Value::U8(0).into(),
850 }
851 }
852}
853
854impl_from_user_facing_event_for_interface_event_enum!(
855 DesktopDestroyEvent,
856 WindowEvents,
857 WindowEvents::DesktopDestroy
858);
859impl_from_user_facing_type_for_event_enum!(DesktopDestroyEvent, Event::Window);
860impl_try_from_event_for_user_facing_type!(
861 DesktopDestroyEvent,
862 WindowEvents::DesktopDestroy,
863 Event::Window
864);
865event_test_cases!(DesktopDestroyEvent);
866impl_to_dbus_message!(DesktopDestroyEvent);
867impl_from_dbus_message!(DesktopDestroyEvent);
868impl From<DesktopDestroyEvent> for EventBodyOwned {
869 fn from(_event: DesktopDestroyEvent) -> Self {
870 EventBodyOwned {
871 properties: std::collections::HashMap::new(),
872 kind: String::default(),
873 detail1: i32::default(),
874 detail2: i32::default(),
875 any_data: zvariant::Value::U8(0).into(),
876 }
877 }
878}
879
880impl_from_user_facing_event_for_interface_event_enum!(
881 DestroyEvent,
882 WindowEvents,
883 WindowEvents::Destroy
884);
885impl_from_user_facing_type_for_event_enum!(DestroyEvent, Event::Window);
886impl_try_from_event_for_user_facing_type!(DestroyEvent, WindowEvents::Destroy, Event::Window);
887event_test_cases!(DestroyEvent);
888impl_to_dbus_message!(DestroyEvent);
889impl_from_dbus_message!(DestroyEvent);
890impl From<DestroyEvent> for EventBodyOwned {
891 fn from(_event: DestroyEvent) -> Self {
892 EventBodyOwned {
893 properties: std::collections::HashMap::new(),
894 kind: String::default(),
895 detail1: i32::default(),
896 detail2: i32::default(),
897 any_data: zvariant::Value::U8(0).into(),
898 }
899 }
900}
901
902impl_from_user_facing_event_for_interface_event_enum!(
903 ActivateEvent,
904 WindowEvents,
905 WindowEvents::Activate
906);
907impl_from_user_facing_type_for_event_enum!(ActivateEvent, Event::Window);
908impl_try_from_event_for_user_facing_type!(ActivateEvent, WindowEvents::Activate, Event::Window);
909event_test_cases!(ActivateEvent);
910impl_to_dbus_message!(ActivateEvent);
911impl_from_dbus_message!(ActivateEvent);
912impl From<ActivateEvent> for EventBodyOwned {
913 fn from(_event: ActivateEvent) -> Self {
914 EventBodyOwned {
915 properties: std::collections::HashMap::new(),
916 kind: String::default(),
917 detail1: i32::default(),
918 detail2: i32::default(),
919 any_data: zvariant::Value::U8(0).into(),
920 }
921 }
922}
923
924impl_from_user_facing_event_for_interface_event_enum!(
925 DeactivateEvent,
926 WindowEvents,
927 WindowEvents::Deactivate
928);
929impl_from_user_facing_type_for_event_enum!(DeactivateEvent, Event::Window);
930impl_try_from_event_for_user_facing_type!(DeactivateEvent, WindowEvents::Deactivate, Event::Window);
931event_test_cases!(DeactivateEvent);
932impl_to_dbus_message!(DeactivateEvent);
933impl_from_dbus_message!(DeactivateEvent);
934impl From<DeactivateEvent> for EventBodyOwned {
935 fn from(_event: DeactivateEvent) -> Self {
936 EventBodyOwned {
937 properties: std::collections::HashMap::new(),
938 kind: String::default(),
939 detail1: i32::default(),
940 detail2: i32::default(),
941 any_data: zvariant::Value::U8(0).into(),
942 }
943 }
944}
945
946impl_from_user_facing_event_for_interface_event_enum!(
947 RaiseEvent,
948 WindowEvents,
949 WindowEvents::Raise
950);
951impl_from_user_facing_type_for_event_enum!(RaiseEvent, Event::Window);
952impl_try_from_event_for_user_facing_type!(RaiseEvent, WindowEvents::Raise, Event::Window);
953event_test_cases!(RaiseEvent);
954impl_to_dbus_message!(RaiseEvent);
955impl_from_dbus_message!(RaiseEvent);
956impl From<RaiseEvent> for EventBodyOwned {
957 fn from(_event: RaiseEvent) -> Self {
958 EventBodyOwned {
959 properties: std::collections::HashMap::new(),
960 kind: String::default(),
961 detail1: i32::default(),
962 detail2: i32::default(),
963 any_data: zvariant::Value::U8(0).into(),
964 }
965 }
966}
967
968impl_from_user_facing_event_for_interface_event_enum!(
969 LowerEvent,
970 WindowEvents,
971 WindowEvents::Lower
972);
973impl_from_user_facing_type_for_event_enum!(LowerEvent, Event::Window);
974impl_try_from_event_for_user_facing_type!(LowerEvent, WindowEvents::Lower, Event::Window);
975event_test_cases!(LowerEvent);
976impl_to_dbus_message!(LowerEvent);
977impl_from_dbus_message!(LowerEvent);
978impl From<LowerEvent> for EventBodyOwned {
979 fn from(_event: LowerEvent) -> Self {
980 EventBodyOwned {
981 properties: std::collections::HashMap::new(),
982 kind: String::default(),
983 detail1: i32::default(),
984 detail2: i32::default(),
985 any_data: zvariant::Value::U8(0).into(),
986 }
987 }
988}
989
990impl_from_user_facing_event_for_interface_event_enum!(MoveEvent, WindowEvents, WindowEvents::Move);
991impl_from_user_facing_type_for_event_enum!(MoveEvent, Event::Window);
992impl_try_from_event_for_user_facing_type!(MoveEvent, WindowEvents::Move, Event::Window);
993event_test_cases!(MoveEvent);
994impl_to_dbus_message!(MoveEvent);
995impl_from_dbus_message!(MoveEvent);
996impl From<MoveEvent> for EventBodyOwned {
997 fn from(_event: MoveEvent) -> Self {
998 EventBodyOwned {
999 properties: std::collections::HashMap::new(),
1000 kind: String::default(),
1001 detail1: i32::default(),
1002 detail2: i32::default(),
1003 any_data: zvariant::Value::U8(0).into(),
1004 }
1005 }
1006}
1007
1008impl_from_user_facing_event_for_interface_event_enum!(
1009 ResizeEvent,
1010 WindowEvents,
1011 WindowEvents::Resize
1012);
1013impl_from_user_facing_type_for_event_enum!(ResizeEvent, Event::Window);
1014impl_try_from_event_for_user_facing_type!(ResizeEvent, WindowEvents::Resize, Event::Window);
1015event_test_cases!(ResizeEvent);
1016impl_to_dbus_message!(ResizeEvent);
1017impl_from_dbus_message!(ResizeEvent);
1018impl From<ResizeEvent> for EventBodyOwned {
1019 fn from(_event: ResizeEvent) -> Self {
1020 EventBodyOwned {
1021 properties: std::collections::HashMap::new(),
1022 kind: String::default(),
1023 detail1: i32::default(),
1024 detail2: i32::default(),
1025 any_data: zvariant::Value::U8(0).into(),
1026 }
1027 }
1028}
1029
1030impl_from_user_facing_event_for_interface_event_enum!(
1031 ShadeEvent,
1032 WindowEvents,
1033 WindowEvents::Shade
1034);
1035impl_from_user_facing_type_for_event_enum!(ShadeEvent, Event::Window);
1036impl_try_from_event_for_user_facing_type!(ShadeEvent, WindowEvents::Shade, Event::Window);
1037event_test_cases!(ShadeEvent);
1038impl_to_dbus_message!(ShadeEvent);
1039impl_from_dbus_message!(ShadeEvent);
1040impl From<ShadeEvent> for EventBodyOwned {
1041 fn from(_event: ShadeEvent) -> 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 UUshadeEvent,
1054 WindowEvents,
1055 WindowEvents::UUshade
1056);
1057impl_from_user_facing_type_for_event_enum!(UUshadeEvent, Event::Window);
1058impl_try_from_event_for_user_facing_type!(UUshadeEvent, WindowEvents::UUshade, Event::Window);
1059event_test_cases!(UUshadeEvent);
1060impl_to_dbus_message!(UUshadeEvent);
1061impl_from_dbus_message!(UUshadeEvent);
1062impl From<UUshadeEvent> for EventBodyOwned {
1063 fn from(_event: UUshadeEvent) -> Self {
1064 EventBodyOwned {
1065 properties: std::collections::HashMap::new(),
1066 kind: String::default(),
1067 detail1: i32::default(),
1068 detail2: i32::default(),
1069 any_data: zvariant::Value::U8(0).into(),
1070 }
1071 }
1072}
1073
1074impl_from_user_facing_event_for_interface_event_enum!(
1075 RestyleEvent,
1076 WindowEvents,
1077 WindowEvents::Restyle
1078);
1079impl_from_user_facing_type_for_event_enum!(RestyleEvent, Event::Window);
1080impl_try_from_event_for_user_facing_type!(RestyleEvent, WindowEvents::Restyle, Event::Window);
1081event_test_cases!(RestyleEvent);
1082impl_to_dbus_message!(RestyleEvent);
1083impl_from_dbus_message!(RestyleEvent);
1084impl From<RestyleEvent> for EventBodyOwned {
1085 fn from(_event: RestyleEvent) -> Self {
1086 EventBodyOwned {
1087 properties: std::collections::HashMap::new(),
1088 kind: String::default(),
1089 detail1: i32::default(),
1090 detail2: i32::default(),
1091 any_data: zvariant::Value::U8(0).into(),
1092 }
1093 }
1094}
1095
1096impl HasRegistryEventString for WindowEvents {
1097 const REGISTRY_EVENT_STRING: &'static str = "Window:";
1098}
1099