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