reis/
eiproto_ei.rs

1#![allow(
2    unknown_lints,
3    unused_imports,
4    unused_parens,
5    clippy::useless_conversion,
6    clippy::double_parens,
7    clippy::match_single_binding,
8    clippy::unused_unit,
9    clippy::empty_docs,
10    clippy::doc_lazy_continuation
11)]
12
13// GENERATED FILE
14
15use crate::wire;
16
17/**
18This is a special interface to setup the client as seen by the EIS
19implementation. The object for this interface has the fixed object
20id 0 and only exists until the connection has been set up, see the
21`ei_handshake.connection` event.
22
23The `ei_handshake` version is 1 until:
24- the EIS implementation sends the handshake_version event with
25  a version other than 1, and, in response,
26- the client sends the handshake_version request with a
27  version equal or lower to the EIS implementation version.
28
29The EIS implementation must send the handshake_version event immediately
30once the physical connection has been established.
31
32Once the `ei_connection.connection` event has been sent the handshake
33is destroyed by the EIS implementation.
34 */
35pub mod handshake {
36    use crate::wire;
37
38    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
39    pub struct Handshake(pub(crate) crate::Object);
40
41    impl Handshake {
42        pub fn version(&self) -> u32 {
43            self.0.version()
44        }
45
46        pub fn is_alive(&self) -> bool {
47            self.0.is_alive()
48        }
49    }
50
51    impl crate::private::Sealed for Handshake {}
52
53    impl wire::Interface for Handshake {
54        const NAME: &'static str = "ei_handshake";
55        const VERSION: u32 = 1;
56        const CLIENT_SIDE: bool = true;
57
58        fn new_unchecked(object: crate::Object) -> Self {
59            Self(object)
60        }
61
62        fn as_object(&self) -> &crate::Object {
63            &self.0
64        }
65
66        fn as_arg(&self) -> wire::Arg<'_> {
67            self.0.as_arg()
68        }
69    }
70
71    impl crate::ei::Interface for Handshake {}
72
73    impl Handshake {
74        /**
75        Notifies the EIS implementation that this client supports the
76        given version of the `ei_handshake` interface. The version number
77        must be less than or equal to the version in the
78        handshake_version event sent by the EIS implementation when
79        the connection was established.
80
81        Immediately after sending this request, the client must assume the negotiated
82        version number for the `ei_handshake` interface and the EIS implementation
83        may send events and process requests matching that version.
84
85        This request must be sent exactly once and it must be the first request
86        the client sends.
87         */
88        pub fn handshake_version(&self, version: u32) -> () {
89            let args = &[wire::Arg::Uint32(version.into())];
90
91            self.0.request(0, args);
92
93            ()
94        }
95
96        /**
97        Notify the EIS implementation that configuration is complete.
98
99        In the future (and possibly after requiring user interaction),
100        the EIS implementation responds by sending the `ei_handshake.connection` event.
101         */
102        pub fn finish(&self) -> () {
103            let args = &[];
104
105            self.0.request(1, args);
106
107            ()
108        }
109
110        /**
111        Notify the EIS implementation of the type of this context. The context types
112        defines whether the client will send events to or receive events from the
113        EIS implementation.
114
115        Depending on the context type, certain requests must not be used and some
116        events must not be sent by the EIS implementation.
117
118        This request is optional, the default client type is context_type.receiver.
119        This request must not be sent more than once and must be sent before
120        `ei_handshake.finish.`
121         */
122        pub fn context_type(&self, context_type: ContextType) -> () {
123            let args = &[wire::Arg::Uint32(context_type.into())];
124
125            self.0.request(2, args);
126
127            ()
128        }
129
130        /**
131        Notify the EIS implementation of the client name. The name is a
132        human-presentable UTF-8 string and should represent the client name
133        as accurately as possible. This name may be presented to the user
134        for identification of this client (e.g. to confirm the client has
135        permissions to connect).
136
137        There is no requirement for the EIS implementation to use this name. For
138        example, where the client is managed through an XDG Desktop Portal an EIS
139        implementation would typically use client identification information sent
140        by the portal instead.
141
142        This request is optional, the default client name is implementation-defined.
143        This request must not be sent more than once and must be sent before
144        `ei_handshake.finish.`
145         */
146        pub fn name(&self, name: &str) -> () {
147            let args = &[wire::Arg::String(name.into())];
148
149            self.0.request(3, args);
150
151            ()
152        }
153
154        /**
155        Notify the EIS implementation that the client supports the
156        given named interface with the given maximum version number.
157
158        Future objects created by the EIS implementation will
159        use the respective interface version (or any lesser version)
160        as announced by the `ei_connection.interface_version` event.
161
162        This request must be sent for the "`ei_connection`" interface,
163        failing to do so will result in the EIS implementation disconnecting
164        the client on `ei_handshake.finish.`
165
166        This request must not be sent for the "`ei_handshake`" interface, use
167        the `ei_handshake.handshake_version` request instead.
168
169        Note that an EIS implementation may consider some interfaces to
170        be required and immediately `ei_connection.disconnect` a client
171        not supporting those interfaces.
172
173        This request must not be sent more than once per interface and must be
174        sent before `ei_handshake.finish.`
175         */
176        pub fn interface_version(&self, name: &str, version: u32) -> () {
177            let args = &[
178                wire::Arg::String(name.into()),
179                wire::Arg::Uint32(version.into()),
180            ];
181
182            self.0.request(4, args);
183
184            ()
185        }
186    }
187
188    pub use crate::eiproto_enum::handshake::ContextType;
189
190    #[non_exhaustive]
191    #[derive(Debug)]
192    pub enum Event {
193        /**
194        This event is sent exactly once and immediately after connection
195        to the EIS implementation.
196
197        In response, the client must send the `ei_handshake.handshake_version` request
198        with any version up to including the version provided in this event.
199        See the `ei_handshake.handshake_version` request for details on what happens next.
200         */
201        HandshakeVersion {
202            /** the interface version */
203            version: u32,
204        },
205        /**
206        Notifies the client that the EIS implementation supports
207        the given named interface with the given maximum version number.
208
209        The client must not assume those interfaces are supported unless
210        and until those versions have been received.
211
212        This request must not be sent for the "`ei_handshake`" interface, use
213        the handshake_version event instead.
214
215        This event may be sent by the EIS implementation for any
216        other supported interface (but not necessarily all supported
217        interfaces) before the `ei_handshake.connection` event.
218         */
219        InterfaceVersion {
220            /** the interface name */
221            name: String,
222            /** the interface version */
223            version: u32,
224        },
225        /**
226        Provides the client with the connection object that is the top-level
227        object for all future requests and events.
228
229        This event is sent exactly once at some unspecified time after the client
230        sends the `ei_handshake.finish` request to the EIS implementation.
231
232        The `ei_handshake` object will be destroyed by the
233        EIS implementation immediately after this event has been sent, a
234        client must not attempt to use it after that point.
235
236        The version sent by the EIS implementation is the version of the "`ei_connection`"
237        interface as announced by `ei_handshake.interface_version`, or any
238        lower version.
239
240        The serial number is the start value of the EIS implementation's serial
241        number sequence. Clients must not assume any specific value for this
242        serial number. Any future serial number in any event is monotonically
243        increasing by an unspecified amount.
244         */
245        Connection {
246            /** this event's serial number */
247            serial: u32,
248            /** the connection object */
249            connection: super::connection::Connection,
250        },
251    }
252
253    impl Event {
254        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
255            match operand {
256                0 => Some("handshake_version"),
257                1 => Some("interface_version"),
258                2 => Some("connection"),
259                _ => None,
260            }
261        }
262
263        pub(super) fn parse(
264            operand: u32,
265            _bytes: &mut wire::ByteStream,
266        ) -> Result<Self, wire::ParseError> {
267            match operand {
268                0 => {
269                    let version = _bytes.read_arg()?;
270
271                    Ok(Self::HandshakeVersion { version })
272                }
273                1 => {
274                    let name = _bytes.read_arg()?;
275                    let version = _bytes.read_arg()?;
276
277                    Ok(Self::InterfaceVersion { name, version })
278                }
279                2 => {
280                    let serial = _bytes.read_arg()?;
281                    let connection = _bytes.read_arg()?;
282                    let version = _bytes.read_arg()?;
283
284                    Ok(Self::Connection {
285                        serial,
286                        connection: _bytes.backend().new_peer_interface(connection, version)?,
287                    })
288                }
289                opcode => Err(wire::ParseError::InvalidOpcode("handshake", opcode)),
290            }
291        }
292
293        #[allow(
294            unused_imports,
295            unused_mut,
296            unused_variables,
297            unreachable_code,
298            unreachable_patterns
299        )]
300        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
301            use crate::{wire::OwnedArg, Interface};
302            let mut args = Vec::new();
303            match self {
304                Self::HandshakeVersion { version } => {
305                    args.push(version.as_arg());
306                }
307                Self::InterfaceVersion { name, version } => {
308                    args.push(name.as_arg());
309                    args.push(version.as_arg());
310                }
311                Self::Connection { serial, connection } => {
312                    args.push(serial.as_arg());
313                    args.push(connection.as_arg());
314                }
315                _ => unreachable!(),
316            }
317            args
318        }
319    }
320}
321
322pub use handshake::Handshake;
323
324/**
325The core connection object. This is the top-level object for any communication
326with the EIS implementation.
327
328Note that for a client to receive this object, it must announce
329support for this interface in `ei_handshake.interface_version.`
330 */
331pub mod connection {
332    use crate::wire;
333
334    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
335    pub struct Connection(pub(crate) crate::Object);
336
337    impl Connection {
338        pub fn version(&self) -> u32 {
339            self.0.version()
340        }
341
342        pub fn is_alive(&self) -> bool {
343            self.0.is_alive()
344        }
345    }
346
347    impl crate::private::Sealed for Connection {}
348
349    impl wire::Interface for Connection {
350        const NAME: &'static str = "ei_connection";
351        const VERSION: u32 = 1;
352        const CLIENT_SIDE: bool = true;
353
354        fn new_unchecked(object: crate::Object) -> Self {
355            Self(object)
356        }
357
358        fn as_object(&self) -> &crate::Object {
359            &self.0
360        }
361
362        fn as_arg(&self) -> wire::Arg<'_> {
363            self.0.as_arg()
364        }
365    }
366
367    impl crate::ei::Interface for Connection {}
368
369    impl Connection {
370        /**
371        The sync request asks the EIS implementation to emit the 'done' event
372        on the returned `ei_callback` object. Since requests are
373        handled in-order and events are delivered in-order, this can
374        be used as a synchronization point to ensure all previous requests and the
375        resulting events have been handled.
376
377        The object returned by this request will be destroyed by the
378        EIS implementation after the callback is fired and as such the client must not
379        attempt to use it after that point.
380
381        The callback_data in the `ei_callback.done` event is always zero.
382
383        Note that for a client to use this request it must announce
384        support for the "`ei_callback`" interface in `ei_handshake.interface_version.`
385        It is a protocol violation to request sync without having announced the
386        "`ei_callback`" interface and the EIS implementation must disconnect
387        the client.
388         */
389        pub fn sync(&self, version: u32) -> (super::callback::Callback) {
390            let callback = self
391                .0
392                .backend_weak()
393                .new_object("ei_callback".to_string(), version);
394            let args = &[
395                wire::Arg::NewId(callback.id().into()),
396                wire::Arg::Uint32(version.into()),
397            ];
398
399            self.0.request(0, args);
400
401            (super::callback::Callback(callback))
402        }
403
404        /**
405        A request to the EIS implementation that this client should be disconnected.
406        This is a courtesy request to allow the EIS implementation to distinquish
407        between a client disconnecting on purpose and one disconnecting through the
408        socket becoming invalid.
409
410        Immediately after sending this request, the client may destroy the
411        `ei_connection` object and it should close the socket. The EIS implementation
412        will treat the connection as already disconnected on receipt and does not
413        send the `ei_connection.disconnect` event in response to this request.
414         */
415        pub fn disconnect(&self) -> () {
416            let args = &[];
417
418            self.0.request(1, args);
419            self.0.backend_weak().remove_id(self.0.id());
420
421            ()
422        }
423    }
424
425    pub use crate::eiproto_enum::connection::DisconnectReason;
426
427    #[non_exhaustive]
428    #[derive(Debug)]
429    pub enum Event {
430        /**
431        This event may be sent by the EIS implementation immediately before
432        the client is disconnected. The last_serial argument is set to the last
433        serial number used in a request by the client or zero if the client has not
434        yet issued a request.
435
436        Where a client is disconnected by EIS on purpose, for example after
437        a user interaction, the reason is disconnect_reason.disconnected (i.e. zero)
438        and the explanation is NULL.
439
440        Where a client is disconnected due to some invalid request or other
441        protocol error, the reason is one of disconnect_reason (i.e. nonzero) and
442        explanation may contain a string explaining why. This string is
443        intended to help debugging only and is not guaranteed to stay constant.
444
445        The `ei_connection` object will be destroyed by the
446        EIS implementation immediately after this event has been sent, a
447        client must not attempt to use it after that point.
448
449        There is no guarantee this event is sent - the connection may be closed
450        without a disconnection event.
451         */
452        Disconnected {
453            /** the last serial sent by the EIS implementation */
454            last_serial: u32,
455            /** the reason for being disconnected */
456            reason: DisconnectReason,
457            /** an explanation for debugging purposes */
458            explanation: String,
459        },
460        /**
461        Notification that a new seat has been added.
462
463        A seat is a set of input devices that logically belong together.
464
465        This event is only sent if the client announced support for the
466        "`ei_seat`" interface in `ei_handshake.interface_version.`
467        The interface version is equal or less to the client-supported
468        version in `ei_handshake.interface_version` for the "`ei_seat`"
469        interface.
470         */
471        Seat {
472            /**  */
473            seat: super::seat::Seat,
474        },
475        /**
476        Notification that an object ID used in an earlier request was
477        invalid and does not exist.
478
479        This event is sent by the EIS implementation when an object that
480        does not exist as seen by the EIS implementation. The protocol is
481        asynchronous and this may occur e.g. when the EIS implementation
482        destroys an object at the same time as the client requests functionality
483        from that object. For example, an EIS implementation may send
484        `ei_device.destroyed` and destroy the device's resources (and protocol object)
485        at the same time as the client attempts to `ei_device.start_emulating`
486        on that object.
487
488        It is the client's responsibilty to unwind any state changes done
489        to the object since the last successful message.
490         */
491        InvalidObject {
492            /** the last serial sent by the EIS implementation */
493            last_serial: u32,
494            /**  */
495            invalid_id: u64,
496        },
497        /**
498        The ping event asks the client to emit the 'done' event
499        on the provided `ei_pingpong` object. Since requests are
500        handled in-order and events are delivered in-order, this can
501        be used as a synchronization point to ensure all previous requests
502        and the resulting events have been handled.
503
504        The object returned by this request must be destroyed by the
505        ei client implementation after the callback is fired and as
506        such the client must not attempt to use it after that point.
507
508        The callback_data in the resulting `ei_pingpong.done` request is
509        ignored by the EIS implementation.
510
511        Note that for a EIS implementation to use this request the client must
512        announce support for this interface in `ei_handshake.interface_version.` It is
513        a protocol violation to send this event to a client without the
514        "`ei_pingpong`" interface.
515         */
516        Ping {
517            /** callback object for the ping request */
518            ping: super::pingpong::Pingpong,
519        },
520    }
521
522    impl Event {
523        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
524            match operand {
525                0 => Some("disconnected"),
526                1 => Some("seat"),
527                2 => Some("invalid_object"),
528                3 => Some("ping"),
529                _ => None,
530            }
531        }
532
533        pub(super) fn parse(
534            operand: u32,
535            _bytes: &mut wire::ByteStream,
536        ) -> Result<Self, wire::ParseError> {
537            match operand {
538                0 => {
539                    let last_serial = _bytes.read_arg()?;
540                    let reason = _bytes.read_arg()?;
541                    let explanation = _bytes.read_arg()?;
542
543                    Ok(Self::Disconnected {
544                        last_serial,
545                        reason,
546                        explanation,
547                    })
548                }
549                1 => {
550                    let seat = _bytes.read_arg()?;
551                    let version = _bytes.read_arg()?;
552
553                    Ok(Self::Seat {
554                        seat: _bytes.backend().new_peer_interface(seat, version)?,
555                    })
556                }
557                2 => {
558                    let last_serial = _bytes.read_arg()?;
559                    let invalid_id = _bytes.read_arg()?;
560
561                    Ok(Self::InvalidObject {
562                        last_serial,
563                        invalid_id,
564                    })
565                }
566                3 => {
567                    let ping = _bytes.read_arg()?;
568                    let version = _bytes.read_arg()?;
569
570                    Ok(Self::Ping {
571                        ping: _bytes.backend().new_peer_interface(ping, version)?,
572                    })
573                }
574                opcode => Err(wire::ParseError::InvalidOpcode("connection", opcode)),
575            }
576        }
577
578        #[allow(
579            unused_imports,
580            unused_mut,
581            unused_variables,
582            unreachable_code,
583            unreachable_patterns
584        )]
585        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
586            use crate::{wire::OwnedArg, Interface};
587            let mut args = Vec::new();
588            match self {
589                Self::Disconnected {
590                    last_serial,
591                    reason,
592                    explanation,
593                } => {
594                    args.push(last_serial.as_arg());
595                    args.push(reason.as_arg());
596                    args.push(explanation.as_arg());
597                }
598                Self::Seat { seat } => {
599                    args.push(seat.as_arg());
600                }
601                Self::InvalidObject {
602                    last_serial,
603                    invalid_id,
604                } => {
605                    args.push(last_serial.as_arg());
606                    args.push(invalid_id.as_arg());
607                }
608                Self::Ping { ping } => {
609                    args.push(ping.as_arg());
610                }
611                _ => unreachable!(),
612            }
613            args
614        }
615    }
616}
617
618pub use connection::Connection;
619
620/**
621Interface for ensuring a roundtrip to the EIS implementation.
622Clients can handle the 'done' event to get notified when
623the related request that created the `ei_callback` object is done.
624
625Note that for a client to receive objects of this type, it must announce
626support for this interface in `ei_handshake.interface_version.`
627 */
628pub mod callback {
629    use crate::wire;
630
631    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
632    pub struct Callback(pub(crate) crate::Object);
633
634    impl Callback {
635        pub fn version(&self) -> u32 {
636            self.0.version()
637        }
638
639        pub fn is_alive(&self) -> bool {
640            self.0.is_alive()
641        }
642    }
643
644    impl crate::private::Sealed for Callback {}
645
646    impl wire::Interface for Callback {
647        const NAME: &'static str = "ei_callback";
648        const VERSION: u32 = 1;
649        const CLIENT_SIDE: bool = true;
650
651        fn new_unchecked(object: crate::Object) -> Self {
652            Self(object)
653        }
654
655        fn as_object(&self) -> &crate::Object {
656            &self.0
657        }
658
659        fn as_arg(&self) -> wire::Arg<'_> {
660            self.0.as_arg()
661        }
662    }
663
664    impl crate::ei::Interface for Callback {}
665
666    impl Callback {}
667
668    #[non_exhaustive]
669    #[derive(Debug)]
670    pub enum Event {
671        /**
672        Notify the client when the related request is done. Immediately after this event
673        the `ei_callback` object is destroyed by the EIS implementation and as such the
674        client must not attempt to use it after that point.
675         */
676        Done {
677            /** request-specific data for the callback */
678            callback_data: u64,
679        },
680    }
681
682    impl Event {
683        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
684            match operand {
685                0 => Some("done"),
686                _ => None,
687            }
688        }
689
690        pub(super) fn parse(
691            operand: u32,
692            _bytes: &mut wire::ByteStream,
693        ) -> Result<Self, wire::ParseError> {
694            match operand {
695                0 => {
696                    let callback_data = _bytes.read_arg()?;
697
698                    Ok(Self::Done { callback_data })
699                }
700                opcode => Err(wire::ParseError::InvalidOpcode("callback", opcode)),
701            }
702        }
703
704        #[allow(
705            unused_imports,
706            unused_mut,
707            unused_variables,
708            unreachable_code,
709            unreachable_patterns
710        )]
711        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
712            use crate::{wire::OwnedArg, Interface};
713            let mut args = Vec::new();
714            match self {
715                Self::Done { callback_data } => {
716                    args.push(callback_data.as_arg());
717                }
718                _ => unreachable!(),
719            }
720            args
721        }
722    }
723}
724
725pub use callback::Callback;
726
727/**
728Interface for ensuring a roundtrip to the client implementation.
729This interface is identical to `ei_callback` but is intended for
730the EIS implementation to enforce a roundtrip to the client.
731
732Note that for a client to receive objects of this type, it must announce
733support for this interface in `ei_handshake.interface_version.`
734 */
735pub mod pingpong {
736    use crate::wire;
737
738    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
739    pub struct Pingpong(pub(crate) crate::Object);
740
741    impl Pingpong {
742        pub fn version(&self) -> u32 {
743            self.0.version()
744        }
745
746        pub fn is_alive(&self) -> bool {
747            self.0.is_alive()
748        }
749    }
750
751    impl crate::private::Sealed for Pingpong {}
752
753    impl wire::Interface for Pingpong {
754        const NAME: &'static str = "ei_pingpong";
755        const VERSION: u32 = 1;
756        const CLIENT_SIDE: bool = true;
757
758        fn new_unchecked(object: crate::Object) -> Self {
759            Self(object)
760        }
761
762        fn as_object(&self) -> &crate::Object {
763            &self.0
764        }
765
766        fn as_arg(&self) -> wire::Arg<'_> {
767            self.0.as_arg()
768        }
769    }
770
771    impl crate::ei::Interface for Pingpong {}
772
773    impl Pingpong {
774        /**
775        Notify the EIS implementation when the related event is done. Immediately after this request
776        the `ei_pingpong` object is destroyed by the client and as such must not be used
777        any further.
778         */
779        pub fn done(&self, callback_data: u64) -> () {
780            let args = &[wire::Arg::Uint64(callback_data.into())];
781
782            self.0.request(0, args);
783            self.0.backend_weak().remove_id(self.0.id());
784
785            ()
786        }
787    }
788
789    #[non_exhaustive]
790    #[derive(Debug)]
791    pub enum Event {}
792
793    impl Event {
794        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
795            match operand {
796                _ => None,
797            }
798        }
799
800        pub(super) fn parse(
801            operand: u32,
802            _bytes: &mut wire::ByteStream,
803        ) -> Result<Self, wire::ParseError> {
804            match operand {
805                opcode => Err(wire::ParseError::InvalidOpcode("pingpong", opcode)),
806            }
807        }
808
809        #[allow(
810            unused_imports,
811            unused_mut,
812            unused_variables,
813            unreachable_code,
814            unreachable_patterns
815        )]
816        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
817            use crate::{wire::OwnedArg, Interface};
818            let mut args = Vec::new();
819            match self {
820                _ => unreachable!(),
821            }
822            args
823        }
824    }
825}
826
827pub use pingpong::Pingpong;
828
829/**
830An `ei_seat` represents a set of input devices that logically belong together. In most
831cases only one seat is present and all input devices on that seat share the same
832pointer and keyboard focus.
833
834A seat has potential capabilities, a client is expected to bind to those capabilities.
835The EIS implementation then creates logical input devices based on the capabilities the
836client is interested in.
837
838Immediately after creation of the `ei_seat` object, the EIS implementation sends a burst
839of events with information about this seat. This burst of events is terminated by the
840`ei_seat.done` event.
841
842Note that for a client to receive objects of this type, it must announce
843support for this interface in `ei_handshake.interface_version.`
844 */
845pub mod seat {
846    use crate::wire;
847
848    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
849    pub struct Seat(pub(crate) crate::Object);
850
851    impl Seat {
852        pub fn version(&self) -> u32 {
853            self.0.version()
854        }
855
856        pub fn is_alive(&self) -> bool {
857            self.0.is_alive()
858        }
859    }
860
861    impl crate::private::Sealed for Seat {}
862
863    impl wire::Interface for Seat {
864        const NAME: &'static str = "ei_seat";
865        const VERSION: u32 = 1;
866        const CLIENT_SIDE: bool = true;
867
868        fn new_unchecked(object: crate::Object) -> Self {
869            Self(object)
870        }
871
872        fn as_object(&self) -> &crate::Object {
873            &self.0
874        }
875
876        fn as_arg(&self) -> wire::Arg<'_> {
877            self.0.as_arg()
878        }
879    }
880
881    impl crate::ei::Interface for Seat {}
882
883    impl Seat {
884        /**
885        Notification that the client is no longer interested in this seat.
886        The EIS implementation will release any resources related to this seat and
887        send the `ei_seat.destroyed` event once complete.
888
889        Note that releasing a seat does not guarantee another seat becomes available.
890        In other words, in most single-seat cases, releasing the seat means the
891        connection becomes effectively inert.
892         */
893        pub fn release(&self) -> () {
894            let args = &[];
895
896            self.0.request(0, args);
897
898            ()
899        }
900
901        /**
902        Bind to the bitmask of capabilities given. The bitmask is zero or more of the
903        masks representing an interface as provided in the `ei_seat.capability` event.
904        See the `ei_seat.capability` event documentation for examples.
905
906        Binding masks that are not supported in the `ei_device`'s interface version
907        is a client bug and may result in disconnection.
908
909        A client may send this request multiple times to adjust the capabilities it
910        is interested in. If previously-bound capabilities are dropped by the client,
911        the EIS implementation may `ei_device.remove` devices that have these capabilities.
912         */
913        pub fn bind(&self, capabilities: u64) -> () {
914            let args = &[wire::Arg::Uint64(capabilities.into())];
915
916            self.0.request(1, args);
917
918            ()
919        }
920    }
921
922    #[non_exhaustive]
923    #[derive(Debug)]
924    pub enum Event {
925        /**
926        This seat has been removed and a client should release all
927        associated resources.
928
929        This `ei_seat` object will be destroyed by the EIS implementation immmediately after
930        after this event is sent and as such the client must not attempt to use
931        it after that point.
932         */
933        Destroyed {
934            /** this event's serial number */
935            serial: u32,
936        },
937        /**
938        The name of this seat, if any. This event is optional and sent once immediately
939        after object creation.
940
941        It is a protocol violation to send this event after the `ei_seat.done` event.
942         */
943        Name {
944            /** the seat name */
945            name: String,
946        },
947        /**
948        A notification that this seat supports devices with the given interface.
949        The interface is mapped to a bitmask by the EIS implementation.
950        A client may then binary OR these bitmasks in `ei_seat.bind.`
951        In response, the EIS implementation may then create device based on those
952        bound capabilities.
953
954        For example, an EIS implementation may map "`ei_pointer`" to 0x1,
955        "`ei_keyboard`" to 0x4 and "`ei_touchscreen`" to 0x8. A client may then
956        `ei_seat.bind`(0xc) to bind to keyboard and touchscreen but not pointer.
957        Note that as shown in this example the set of masks may be sparse.
958        The value of the mask is contant for the lifetime of the seat but may differ
959        between seats.
960
961        Note that seat capabilities only represent a mask of possible capabilities on
962        devices in this seat. A capability that is not available on the seat cannot
963        ever be available on any device in this seat. For example, a seat that only has the
964        pointer and keyboard capabilities can never have a device with the touchscreen
965        capability. It is up to the EIS implementation to decide how many (if any) devices
966        with any given capability exist in this seat.
967
968        Only interfaces that the client announced during `ei_handshake.interface_version`
969        can be a seat capability.
970
971        This event is sent multiple times - once per supported interface.
972        The set of capabilities is constant for the lifetime of the seat.
973
974        It is a protocol violation to send this event after the `ei_seat.done` event.
975         */
976        Capability {
977            /** the mask representing this capability */
978            mask: u64,
979            /** the interface name for this capability */
980            interface: String,
981        },
982        /**
983        Notification that the initial burst of events is complete and
984        the client can set up this seat now.
985
986        It is a protocol violation to send this event more than once.
987         */
988        Done,
989        /**
990        Notification that a new device has been added.
991
992        This event is only sent if the client announced support for the
993        "`ei_device`" interface in `ei_handshake.interface_version.`
994        The interface version is equal or less to the client-supported
995        version in `ei_handshake.interface_version` for the "`ei_device`"
996        interface.
997         */
998        Device {
999            /** the new device */
1000            device: super::device::Device,
1001        },
1002    }
1003
1004    impl Event {
1005        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
1006            match operand {
1007                0 => Some("destroyed"),
1008                1 => Some("name"),
1009                2 => Some("capability"),
1010                3 => Some("done"),
1011                4 => Some("device"),
1012                _ => None,
1013            }
1014        }
1015
1016        pub(super) fn parse(
1017            operand: u32,
1018            _bytes: &mut wire::ByteStream,
1019        ) -> Result<Self, wire::ParseError> {
1020            match operand {
1021                0 => {
1022                    let serial = _bytes.read_arg()?;
1023
1024                    Ok(Self::Destroyed { serial })
1025                }
1026                1 => {
1027                    let name = _bytes.read_arg()?;
1028
1029                    Ok(Self::Name { name })
1030                }
1031                2 => {
1032                    let mask = _bytes.read_arg()?;
1033                    let interface = _bytes.read_arg()?;
1034
1035                    Ok(Self::Capability { mask, interface })
1036                }
1037                3 => Ok(Self::Done),
1038                4 => {
1039                    let device = _bytes.read_arg()?;
1040                    let version = _bytes.read_arg()?;
1041
1042                    Ok(Self::Device {
1043                        device: _bytes.backend().new_peer_interface(device, version)?,
1044                    })
1045                }
1046                opcode => Err(wire::ParseError::InvalidOpcode("seat", opcode)),
1047            }
1048        }
1049
1050        #[allow(
1051            unused_imports,
1052            unused_mut,
1053            unused_variables,
1054            unreachable_code,
1055            unreachable_patterns
1056        )]
1057        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
1058            use crate::{wire::OwnedArg, Interface};
1059            let mut args = Vec::new();
1060            match self {
1061                Self::Destroyed { serial } => {
1062                    args.push(serial.as_arg());
1063                }
1064                Self::Name { name } => {
1065                    args.push(name.as_arg());
1066                }
1067                Self::Capability { mask, interface } => {
1068                    args.push(mask.as_arg());
1069                    args.push(interface.as_arg());
1070                }
1071                Self::Done => {}
1072                Self::Device { device } => {
1073                    args.push(device.as_arg());
1074                }
1075                _ => unreachable!(),
1076            }
1077            args
1078        }
1079    }
1080}
1081
1082pub use seat::Seat;
1083
1084/**
1085An `ei_device` represents a single logical input devices. Like physical input devices
1086an `ei_device` may have multiple capabilities and may e.g. function as pointer
1087and keyboard.
1088
1089Depending on the `ei_handshake.context_type`, an `ei_device` can
1090emulate events via client requests or receive events. It is a protocol violation
1091to emulate certain events on a receiver device, or for the EIS implementation
1092to send certain events to the device. See the individual request/event documentation
1093for details.
1094
1095Note that for a client to receive objects of this type, it must announce
1096support for this interface in `ei_handshake.interface_version.`
1097 */
1098pub mod device {
1099    use crate::wire;
1100
1101    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
1102    pub struct Device(pub(crate) crate::Object);
1103
1104    impl Device {
1105        pub fn version(&self) -> u32 {
1106            self.0.version()
1107        }
1108
1109        pub fn is_alive(&self) -> bool {
1110            self.0.is_alive()
1111        }
1112    }
1113
1114    impl crate::private::Sealed for Device {}
1115
1116    impl wire::Interface for Device {
1117        const NAME: &'static str = "ei_device";
1118        const VERSION: u32 = 2;
1119        const CLIENT_SIDE: bool = true;
1120
1121        fn new_unchecked(object: crate::Object) -> Self {
1122            Self(object)
1123        }
1124
1125        fn as_object(&self) -> &crate::Object {
1126            &self.0
1127        }
1128
1129        fn as_arg(&self) -> wire::Arg<'_> {
1130            self.0.as_arg()
1131        }
1132    }
1133
1134    impl crate::ei::Interface for Device {}
1135
1136    impl Device {
1137        /**
1138        Notification that the client is no longer interested in this device.
1139
1140        Note that releasing a device does not guarantee another device becomes available.
1141
1142        The EIS implementation will release any resources related to this device and
1143        send the `ei_device.destroyed` event once complete.
1144         */
1145        pub fn release(&self) -> () {
1146            let args = &[];
1147
1148            self.0.request(0, args);
1149
1150            ()
1151        }
1152
1153        /**
1154        Notify the EIS implementation that the given device is about to start
1155        sending events. This should be seen more as a transactional boundary than a
1156        time-based boundary. The primary use-cases for this are to allow for setup on
1157        the EIS implementation side and/or UI updates to indicate that a device is
1158        sending events now and for out-of-band information to sync with a given event
1159        sequence.
1160
1161        There is no actual requirement that events start immediately once emulation
1162        starts and there is no requirement that a client calls `ei_device.stop_emulating`
1163        after the most recent events.
1164        For example, in a remote desktop use-case the client would call
1165        `ei_device.start_emulating` once the remote desktop session starts (rather than when
1166        the device sends events) and `ei_device.stop_emulating` once the remote desktop
1167        session stops.
1168
1169        The sequence number identifies this transaction between start/stop emulating.
1170        It must go up by at least 1 on each call to `ei_device.start_emulating.`
1171        Wraparound must be handled by the EIS implementation but callers must ensure
1172        that detection of wraparound is possible.
1173
1174        It is a protocol violation to request `ei_device.start_emulating` after
1175        `ei_device.start_emulating` without an intermediate stop_emulating.
1176
1177        It is a protocol violation to send this request for a client
1178        of an `ei_handshake.context_type` other than sender.
1179         */
1180        pub fn start_emulating(&self, last_serial: u32, sequence: u32) -> () {
1181            let args = &[
1182                wire::Arg::Uint32(last_serial.into()),
1183                wire::Arg::Uint32(sequence.into()),
1184            ];
1185
1186            self.0.request(1, args);
1187
1188            ()
1189        }
1190
1191        /**
1192        Notify the EIS implementation that the given device is no longer sending
1193        events. See `ei_device.start_emulating` for details.
1194
1195        It is a protocol violation to send this request for a client
1196        of an `ei_handshake.context_type` other than sender.
1197         */
1198        pub fn stop_emulating(&self, last_serial: u32) -> () {
1199            let args = &[wire::Arg::Uint32(last_serial.into())];
1200
1201            self.0.request(2, args);
1202
1203            ()
1204        }
1205
1206        /**
1207        Generate a frame event to group the current set of events
1208        into a logical hardware event. This function must be called after one
1209        or more events on any of `ei_pointer`, `ei_pointer_absolute`,
1210        `ei_scroll`, `ei_button`, `ei_keyboard` or `ei_touchscreen` has
1211        been requested by the EIS implementation.
1212
1213        The EIS implementation should not process changes to the device state
1214        until the `ei_device.frame` event. For example, pressing and releasing
1215        a key within the same frame is a logical noop.
1216
1217        The given timestamp applies to all events in the current frame.
1218        The timestamp must be in microseconds of CLOCK_MONOTONIC.
1219
1220        It is a protocol violation to send this request for a client
1221        of an `ei_handshake.context_type` other than sender.
1222         */
1223        pub fn frame(&self, last_serial: u32, timestamp: u64) -> () {
1224            let args = &[
1225                wire::Arg::Uint32(last_serial.into()),
1226                wire::Arg::Uint64(timestamp.into()),
1227            ];
1228
1229            self.0.request(3, args);
1230
1231            ()
1232        }
1233    }
1234
1235    pub use crate::eiproto_enum::device::DeviceType;
1236
1237    #[non_exhaustive]
1238    #[derive(Debug)]
1239    pub enum Event {
1240        /**
1241        This device has been removed and a client should release all
1242        associated resources.
1243
1244        This `ei_device` object will be destroyed by the EIS implementation immmediately after
1245        after this event is sent and as such the client must not attempt to use
1246        it after that point.
1247         */
1248        Destroyed {
1249            /** this event's serial number */
1250            serial: u32,
1251        },
1252        /**
1253        The name of this device, if any. This event is optional and sent once immediately
1254        after object creation.
1255
1256        It is a protocol violation to send this event after the `ei_device.done` event.
1257         */
1258        Name {
1259            /** the device name */
1260            name: String,
1261        },
1262        /**
1263        The device type, one of virtual or physical.
1264
1265        Devices of type `ei_device.device_type.physical` are supported only clients of
1266        type `ei_handshake.context_type.receiver.`
1267
1268        This event is sent once immediately after object creation.
1269        It is a protocol violation to send this event after the `ei_device.done` event.
1270         */
1271        DeviceType {
1272            /** the device type */
1273            device_type: DeviceType,
1274        },
1275        /**
1276        The device dimensions in mm. This event is optional and sent once immediately
1277        after object creation.
1278
1279        This event is only sent for devices of `ei_device.device_type.physical.`
1280
1281        It is a protocol violation to send this event after the `ei_device.done` event.
1282         */
1283        Dimensions {
1284            /** the device physical width in mm */
1285            width: u32,
1286            /** the device physical height in mm */
1287            height: u32,
1288        },
1289        /**
1290        Notifies the client of one region. The number of regions is constant for a device
1291        and all regions are announced immediately after object creation.
1292
1293        A region is rectangular and defined by an x/y offset and a width and a height.
1294        A region defines the area on an EIS desktop layout that is accessible by
1295        this device - this region may not be the full area of the desktop.
1296        Input events may only be sent for points within the regions.
1297
1298        The use of regions is private to the EIS compositor and coordinates may not
1299        match the size of the actual desktop. For example, a compositor may set a
1300        1920x1080 region to represent a 4K monitor and transparently map input
1301        events into the respective true pixels.
1302
1303        Absolute devices may have different regions, it is up to the libei client
1304        to send events through the correct device to target the right pixel. For
1305        example, a dual-head setup my have two absolute devices, the first with a
1306        zero offset region spanning the left screen, the second with a nonzero
1307        offset spanning the right screen.
1308
1309        The physical scale denotes a constant multiplication factor that needs to be applied to
1310        any relative movement on this region for that movement to match the same
1311        *physical* movement on another region.
1312
1313        It is an EIS implementation bug to advertise the touch and/or absolute pointer capability
1314        on a device_type.virtual device without advertising an `ei_region` for this device.
1315
1316        This event is optional and sent immediately after object creation. Where a device
1317        has multiple regions, this event is sent once for each region.
1318        It is a protocol violation to send this event after the `ei_device.done` event.
1319
1320        Note: the fourth argument ('hight') was misspelled when the protocol was declared
1321        stable but changing the name is an API breaking change.
1322         */
1323        Region {
1324            /** region x offset in logical pixels */
1325            offset_x: u32,
1326            /** region y offset in logical pixels */
1327            offset_y: u32,
1328            /** region width in logical pixels */
1329            width: u32,
1330            /** region height in logical pixels */
1331            hight: u32,
1332            /** the physical scale for this region */
1333            scale: f32,
1334        },
1335        /**
1336        Notification that a new device has a sub-interface.
1337
1338        This event may be sent for the following interfaces:
1339        - "`ei_pointer`"
1340        - "`ei_pointer_absolute`"
1341        - "`ei_scroll`"
1342        - "`ei_button`"
1343        - "`ei_keyboard`"
1344        - "`ei_touchscreen`"
1345        The interface version is equal or less to the client-supported
1346        version in `ei_handshake.interface_version` for the respective interface.
1347
1348        It is a protocol violation to send a notification for an interface that
1349        the client has not bound to with `ei_seat.bind.`
1350
1351        This event is optional and sent immediately after object creation
1352        and at most once per interface.
1353        It is a protocol violation to send this event after the `ei_device.done` event.
1354         */
1355        Interface {
1356            /**  */
1357            object: crate::Object,
1358        },
1359        /**
1360        Notification that the initial burst of events is complete and
1361        the client can set up this device now.
1362
1363        It is a protocol violation to send this event more than once per device.
1364         */
1365        Done,
1366        /**
1367        Notification that the device has been resumed by the EIS implementation
1368        and (depending on the `ei_handshake.context_type`) the client may request
1369        `ei_device.start_emulating` or the EIS implementation may
1370        `ei_device.start_emulating` events.
1371
1372        It is a client bug to request emulation of events on a device that is
1373        not resumed. The EIS implementation may silently discard such events.
1374
1375        A newly advertised device is in the `ei_device.paused` state.
1376         */
1377        Resumed {
1378            /** this event's serial number */
1379            serial: u32,
1380        },
1381        /**
1382        Notification that the device has been paused by the EIS implementation
1383        and no futher events will be accepted on this device until
1384        it is resumed again.
1385
1386        For devices of `ei_device_setup.context_type` sender, the client thus does
1387        not need to request `ei_device.stop_emulating` and may request
1388        `ei_device.start_emulating` after a subsequent `ei_device.resumed.`
1389
1390        For devices of `ei_device_setup.context_type` receiver and where
1391        the EIS implementation did not send a `ei_device.stop_emulating`
1392        prior to this event, the device may send a `ei_device.start_emulating`
1393        event after a subsequent `ei_device.resumed` event.
1394
1395        Pausing a device resets the logical state of the device to neutral.
1396        This includes:
1397        - any buttons or keys logically down are released
1398        - any modifiers logically down are released
1399        - any touches logically down are released
1400
1401        It is a client bug to request emulation of events on a device that is
1402        not resumed. The EIS implementation may silently discard such events.
1403
1404        A newly advertised device is in the `ei_device.paused` state.
1405         */
1406        Paused {
1407            /** this event's serial number */
1408            serial: u32,
1409        },
1410        /**
1411        See the `ei_device.start_emulating` request for details.
1412
1413        It is a protocol violation to send this event for a client
1414        of an `ei_handshake.context_type` other than receiver.
1415         */
1416        StartEmulating {
1417            /** this event's serial number */
1418            serial: u32,
1419            /**  */
1420            sequence: u32,
1421        },
1422        /**
1423        See the `ei_device.stop_emulating` request for details.
1424
1425        It is a protocol violation to send this event for a client
1426        of an `ei_handshake.context_type` other than receiver.
1427         */
1428        StopEmulating {
1429            /** this event's serial number */
1430            serial: u32,
1431        },
1432        /**
1433        See the `ei_device.frame` request for details.
1434
1435        It is a protocol violation to send this event for a client
1436        of an `ei_handshake.context_type` other than receiver.
1437         */
1438        Frame {
1439            /** this event's serial number */
1440            serial: u32,
1441            /** timestamp in microseconds */
1442            timestamp: u64,
1443        },
1444        /**
1445        Notifies the client that the region specified in the next `ei_device.region`
1446        event is to be assigned the given mapping_id.
1447
1448        This ID can be used by the client to identify an external resource that has a
1449        relationship with this region.
1450        For example the client may receive a data stream with the video
1451        data that this region represents. By attaching the same identifier to the data
1452        stream and this region the EIS implementation can inform the client
1453        that the video data stream and the region represent paired data.
1454
1455        This event is optional and sent immediately after object creation but before
1456        the corresponding `ei_device.region` event. Where a device has multiple regions,
1457        this event may be sent zero or one time for each region.
1458        It is a protocol violation to send this event after the `ei_device.done` event or
1459        to send this event without a corresponding following `ei_device.region` event.
1460         */
1461        RegionMappingId {
1462            /** region mapping id */
1463            mapping_id: String,
1464        },
1465    }
1466
1467    impl Event {
1468        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
1469            match operand {
1470                0 => Some("destroyed"),
1471                1 => Some("name"),
1472                2 => Some("device_type"),
1473                3 => Some("dimensions"),
1474                4 => Some("region"),
1475                5 => Some("interface"),
1476                6 => Some("done"),
1477                7 => Some("resumed"),
1478                8 => Some("paused"),
1479                9 => Some("start_emulating"),
1480                10 => Some("stop_emulating"),
1481                11 => Some("frame"),
1482                12 => Some("region_mapping_id"),
1483                _ => None,
1484            }
1485        }
1486
1487        pub(super) fn parse(
1488            operand: u32,
1489            _bytes: &mut wire::ByteStream,
1490        ) -> Result<Self, wire::ParseError> {
1491            match operand {
1492                0 => {
1493                    let serial = _bytes.read_arg()?;
1494
1495                    Ok(Self::Destroyed { serial })
1496                }
1497                1 => {
1498                    let name = _bytes.read_arg()?;
1499
1500                    Ok(Self::Name { name })
1501                }
1502                2 => {
1503                    let device_type = _bytes.read_arg()?;
1504
1505                    Ok(Self::DeviceType { device_type })
1506                }
1507                3 => {
1508                    let width = _bytes.read_arg()?;
1509                    let height = _bytes.read_arg()?;
1510
1511                    Ok(Self::Dimensions { width, height })
1512                }
1513                4 => {
1514                    let offset_x = _bytes.read_arg()?;
1515                    let offset_y = _bytes.read_arg()?;
1516                    let width = _bytes.read_arg()?;
1517                    let hight = _bytes.read_arg()?;
1518                    let scale = _bytes.read_arg()?;
1519
1520                    Ok(Self::Region {
1521                        offset_x,
1522                        offset_y,
1523                        width,
1524                        hight,
1525                        scale,
1526                    })
1527                }
1528                5 => {
1529                    let object = _bytes.read_arg()?;
1530                    let interface_name = _bytes.read_arg()?;
1531                    let version = _bytes.read_arg()?;
1532
1533                    Ok(Self::Interface {
1534                        object: _bytes.backend().new_peer_object(
1535                            object,
1536                            interface_name,
1537                            version,
1538                        )?,
1539                    })
1540                }
1541                6 => Ok(Self::Done),
1542                7 => {
1543                    let serial = _bytes.read_arg()?;
1544
1545                    Ok(Self::Resumed { serial })
1546                }
1547                8 => {
1548                    let serial = _bytes.read_arg()?;
1549
1550                    Ok(Self::Paused { serial })
1551                }
1552                9 => {
1553                    let serial = _bytes.read_arg()?;
1554                    let sequence = _bytes.read_arg()?;
1555
1556                    Ok(Self::StartEmulating { serial, sequence })
1557                }
1558                10 => {
1559                    let serial = _bytes.read_arg()?;
1560
1561                    Ok(Self::StopEmulating { serial })
1562                }
1563                11 => {
1564                    let serial = _bytes.read_arg()?;
1565                    let timestamp = _bytes.read_arg()?;
1566
1567                    Ok(Self::Frame { serial, timestamp })
1568                }
1569                12 => {
1570                    let mapping_id = _bytes.read_arg()?;
1571
1572                    Ok(Self::RegionMappingId { mapping_id })
1573                }
1574                opcode => Err(wire::ParseError::InvalidOpcode("device", opcode)),
1575            }
1576        }
1577
1578        #[allow(
1579            unused_imports,
1580            unused_mut,
1581            unused_variables,
1582            unreachable_code,
1583            unreachable_patterns
1584        )]
1585        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
1586            use crate::{wire::OwnedArg, Interface};
1587            let mut args = Vec::new();
1588            match self {
1589                Self::Destroyed { serial } => {
1590                    args.push(serial.as_arg());
1591                }
1592                Self::Name { name } => {
1593                    args.push(name.as_arg());
1594                }
1595                Self::DeviceType { device_type } => {
1596                    args.push(device_type.as_arg());
1597                }
1598                Self::Dimensions { width, height } => {
1599                    args.push(width.as_arg());
1600                    args.push(height.as_arg());
1601                }
1602                Self::Region {
1603                    offset_x,
1604                    offset_y,
1605                    width,
1606                    hight,
1607                    scale,
1608                } => {
1609                    args.push(offset_x.as_arg());
1610                    args.push(offset_y.as_arg());
1611                    args.push(width.as_arg());
1612                    args.push(hight.as_arg());
1613                    args.push(scale.as_arg());
1614                }
1615                Self::Interface { object } => {
1616                    args.push(object.as_arg());
1617                }
1618                Self::Done => {}
1619                Self::Resumed { serial } => {
1620                    args.push(serial.as_arg());
1621                }
1622                Self::Paused { serial } => {
1623                    args.push(serial.as_arg());
1624                }
1625                Self::StartEmulating { serial, sequence } => {
1626                    args.push(serial.as_arg());
1627                    args.push(sequence.as_arg());
1628                }
1629                Self::StopEmulating { serial } => {
1630                    args.push(serial.as_arg());
1631                }
1632                Self::Frame { serial, timestamp } => {
1633                    args.push(serial.as_arg());
1634                    args.push(timestamp.as_arg());
1635                }
1636                Self::RegionMappingId { mapping_id } => {
1637                    args.push(mapping_id.as_arg());
1638                }
1639                _ => unreachable!(),
1640            }
1641            args
1642        }
1643    }
1644}
1645
1646pub use device::Device;
1647
1648/**
1649Interface for pointer motion requests and events.
1650
1651This interface is only provided once per device and where a client
1652requests `ei_pointer.release` the interface does not get re-initialized. An
1653EIS implementation may adjust the behavior of the device (including removing
1654the device) if the interface is releasd.
1655
1656Note that for a client to receive objects of this type, it must announce
1657support for this interface in `ei_handshake.interface_version.`
1658 */
1659pub mod pointer {
1660    use crate::wire;
1661
1662    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
1663    pub struct Pointer(pub(crate) crate::Object);
1664
1665    impl Pointer {
1666        pub fn version(&self) -> u32 {
1667            self.0.version()
1668        }
1669
1670        pub fn is_alive(&self) -> bool {
1671            self.0.is_alive()
1672        }
1673    }
1674
1675    impl crate::private::Sealed for Pointer {}
1676
1677    impl wire::Interface for Pointer {
1678        const NAME: &'static str = "ei_pointer";
1679        const VERSION: u32 = 1;
1680        const CLIENT_SIDE: bool = true;
1681
1682        fn new_unchecked(object: crate::Object) -> Self {
1683            Self(object)
1684        }
1685
1686        fn as_object(&self) -> &crate::Object {
1687            &self.0
1688        }
1689
1690        fn as_arg(&self) -> wire::Arg<'_> {
1691            self.0.as_arg()
1692        }
1693    }
1694
1695    impl crate::ei::Interface for Pointer {}
1696
1697    impl Pointer {
1698        /**
1699        Notification that the client is no longer interested in this pointer.
1700        The EIS implementation will release any resources related to this pointer and
1701        send the `ei_pointer.destroyed` event once complete.
1702         */
1703        pub fn release(&self) -> () {
1704            let args = &[];
1705
1706            self.0.request(0, args);
1707
1708            ()
1709        }
1710
1711        /**
1712        Generate a relative motion event on this pointer.
1713
1714        It is a client bug to send this request more than once
1715        within the same `ei_device.frame` and the EIS implementation
1716        may ignore either or all such requests and/or disconnect the client.
1717
1718        It is a protocol violation to send this request for a client
1719        of an `ei_handshake.context_type` other than sender.
1720         */
1721        pub fn motion_relative(&self, x: f32, y: f32) -> () {
1722            let args = &[wire::Arg::Float(x.into()), wire::Arg::Float(y.into())];
1723
1724            self.0.request(1, args);
1725
1726            ()
1727        }
1728    }
1729
1730    #[non_exhaustive]
1731    #[derive(Debug)]
1732    pub enum Event {
1733        /**
1734        This object has been removed and a client should release all
1735        associated resources.
1736
1737        This object will be destroyed by the EIS implementation immmediately after
1738        after this event is sent and as such the client must not attempt to use
1739        it after that point.
1740         */
1741        Destroyed {
1742            /** this event's serial number */
1743            serial: u32,
1744        },
1745        /**
1746        See the `ei_pointer.motion_relative` request for details.
1747
1748        It is a protocol violation to send this request for a client
1749        of an `ei_handshake.context_type` other than receiver.
1750         */
1751        MotionRelative {
1752            /**  */
1753            x: f32,
1754            /**  */
1755            y: f32,
1756        },
1757    }
1758
1759    impl Event {
1760        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
1761            match operand {
1762                0 => Some("destroyed"),
1763                1 => Some("motion_relative"),
1764                _ => None,
1765            }
1766        }
1767
1768        pub(super) fn parse(
1769            operand: u32,
1770            _bytes: &mut wire::ByteStream,
1771        ) -> Result<Self, wire::ParseError> {
1772            match operand {
1773                0 => {
1774                    let serial = _bytes.read_arg()?;
1775
1776                    Ok(Self::Destroyed { serial })
1777                }
1778                1 => {
1779                    let x = _bytes.read_arg()?;
1780                    let y = _bytes.read_arg()?;
1781
1782                    Ok(Self::MotionRelative { x, y })
1783                }
1784                opcode => Err(wire::ParseError::InvalidOpcode("pointer", opcode)),
1785            }
1786        }
1787
1788        #[allow(
1789            unused_imports,
1790            unused_mut,
1791            unused_variables,
1792            unreachable_code,
1793            unreachable_patterns
1794        )]
1795        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
1796            use crate::{wire::OwnedArg, Interface};
1797            let mut args = Vec::new();
1798            match self {
1799                Self::Destroyed { serial } => {
1800                    args.push(serial.as_arg());
1801                }
1802                Self::MotionRelative { x, y } => {
1803                    args.push(x.as_arg());
1804                    args.push(y.as_arg());
1805                }
1806                _ => unreachable!(),
1807            }
1808            args
1809        }
1810    }
1811}
1812
1813pub use pointer::Pointer;
1814
1815/**
1816Interface for absolute pointer requests and events.
1817
1818This interface is only provided once per device and where a client
1819requests `ei_pointer_absolute.release` the interface does not get
1820re-initialized. An EIS implementation may adjust the behavior of the
1821device (including removing the device) if the interface is releasd.
1822
1823Note that for a client to receive objects of this type, it must announce
1824support for this interface in `ei_handshake.interface_version.`
1825 */
1826pub mod pointer_absolute {
1827    use crate::wire;
1828
1829    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
1830    pub struct PointerAbsolute(pub(crate) crate::Object);
1831
1832    impl PointerAbsolute {
1833        pub fn version(&self) -> u32 {
1834            self.0.version()
1835        }
1836
1837        pub fn is_alive(&self) -> bool {
1838            self.0.is_alive()
1839        }
1840    }
1841
1842    impl crate::private::Sealed for PointerAbsolute {}
1843
1844    impl wire::Interface for PointerAbsolute {
1845        const NAME: &'static str = "ei_pointer_absolute";
1846        const VERSION: u32 = 1;
1847        const CLIENT_SIDE: bool = true;
1848
1849        fn new_unchecked(object: crate::Object) -> Self {
1850            Self(object)
1851        }
1852
1853        fn as_object(&self) -> &crate::Object {
1854            &self.0
1855        }
1856
1857        fn as_arg(&self) -> wire::Arg<'_> {
1858            self.0.as_arg()
1859        }
1860    }
1861
1862    impl crate::ei::Interface for PointerAbsolute {}
1863
1864    impl PointerAbsolute {
1865        /**
1866        Notification that the client is no longer interested in this object.
1867        The EIS implementation will release any resources related to this object and
1868        send the `ei_pointer_absolute.destroyed` event once complete.
1869         */
1870        pub fn release(&self) -> () {
1871            let args = &[];
1872
1873            self.0.request(0, args);
1874
1875            ()
1876        }
1877
1878        /**
1879        Generate an absolute motion event on this pointer. The x/y
1880        coordinates must be within the device's regions or the event
1881        is silently discarded.
1882
1883        It is a client bug to send this request more than once
1884        within the same `ei_device.frame` and the EIS implementation
1885        may ignore either or all such requests and/or disconnect the client.
1886
1887        It is a protocol violation to send this request for a client
1888        of an `ei_handshake.context_type` other than sender.
1889         */
1890        pub fn motion_absolute(&self, x: f32, y: f32) -> () {
1891            let args = &[wire::Arg::Float(x.into()), wire::Arg::Float(y.into())];
1892
1893            self.0.request(1, args);
1894
1895            ()
1896        }
1897    }
1898
1899    #[non_exhaustive]
1900    #[derive(Debug)]
1901    pub enum Event {
1902        /**
1903        This object has been removed and a client should release all
1904        associated resources.
1905
1906        This object will be destroyed by the EIS implementation immmediately after
1907        after this event is sent and as such the client must not attempt to use
1908        it after that point.
1909         */
1910        Destroyed {
1911            /** this event's serial number */
1912            serial: u32,
1913        },
1914        /**
1915        See the `ei_pointer_absolute.motion_absolute` request for details.
1916
1917        It is a protocol violation to send this request for a client
1918        of an `ei_handshake.context_type` other than receiver.
1919         */
1920        MotionAbsolute {
1921            /**  */
1922            x: f32,
1923            /**  */
1924            y: f32,
1925        },
1926    }
1927
1928    impl Event {
1929        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
1930            match operand {
1931                0 => Some("destroyed"),
1932                1 => Some("motion_absolute"),
1933                _ => None,
1934            }
1935        }
1936
1937        pub(super) fn parse(
1938            operand: u32,
1939            _bytes: &mut wire::ByteStream,
1940        ) -> Result<Self, wire::ParseError> {
1941            match operand {
1942                0 => {
1943                    let serial = _bytes.read_arg()?;
1944
1945                    Ok(Self::Destroyed { serial })
1946                }
1947                1 => {
1948                    let x = _bytes.read_arg()?;
1949                    let y = _bytes.read_arg()?;
1950
1951                    Ok(Self::MotionAbsolute { x, y })
1952                }
1953                opcode => Err(wire::ParseError::InvalidOpcode("pointer_absolute", opcode)),
1954            }
1955        }
1956
1957        #[allow(
1958            unused_imports,
1959            unused_mut,
1960            unused_variables,
1961            unreachable_code,
1962            unreachable_patterns
1963        )]
1964        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
1965            use crate::{wire::OwnedArg, Interface};
1966            let mut args = Vec::new();
1967            match self {
1968                Self::Destroyed { serial } => {
1969                    args.push(serial.as_arg());
1970                }
1971                Self::MotionAbsolute { x, y } => {
1972                    args.push(x.as_arg());
1973                    args.push(y.as_arg());
1974                }
1975                _ => unreachable!(),
1976            }
1977            args
1978        }
1979    }
1980}
1981
1982pub use pointer_absolute::PointerAbsolute;
1983
1984/**
1985Interface for scroll requests and events.
1986
1987This interface is only provided once per device and where a client
1988requests `ei_scroll.release` the interface does not get
1989re-initialized. An EIS implementation may adjust the behavior of the
1990device (including removing the device) if the interface is releasd.
1991
1992Note that for a client to receive objects of this type, it must announce
1993support for this interface in `ei_handshake.interface_version.`
1994 */
1995pub mod scroll {
1996    use crate::wire;
1997
1998    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
1999    pub struct Scroll(pub(crate) crate::Object);
2000
2001    impl Scroll {
2002        pub fn version(&self) -> u32 {
2003            self.0.version()
2004        }
2005
2006        pub fn is_alive(&self) -> bool {
2007            self.0.is_alive()
2008        }
2009    }
2010
2011    impl crate::private::Sealed for Scroll {}
2012
2013    impl wire::Interface for Scroll {
2014        const NAME: &'static str = "ei_scroll";
2015        const VERSION: u32 = 1;
2016        const CLIENT_SIDE: bool = true;
2017
2018        fn new_unchecked(object: crate::Object) -> Self {
2019            Self(object)
2020        }
2021
2022        fn as_object(&self) -> &crate::Object {
2023            &self.0
2024        }
2025
2026        fn as_arg(&self) -> wire::Arg<'_> {
2027            self.0.as_arg()
2028        }
2029    }
2030
2031    impl crate::ei::Interface for Scroll {}
2032
2033    impl Scroll {
2034        /**
2035        Notification that the client is no longer interested in this object.
2036        The EIS implementation will release any resources related to this object and
2037        send the `ei_scroll.destroyed` event once complete.
2038         */
2039        pub fn release(&self) -> () {
2040            let args = &[];
2041
2042            self.0.request(0, args);
2043
2044            ()
2045        }
2046
2047        /**
2048        Generate a a smooth (pixel-precise) scroll event on this pointer.
2049        Clients must not send `ei_scroll.scroll_discrete` events for the same event,
2050        the EIS implementation is responsible for emulation of discrete
2051        scroll events.
2052
2053        It is a client bug to send this request more than once
2054        within the same `ei_device.frame` and the EIS implementation
2055        may ignore either or all such requests and/or disconnect the client.
2056
2057        It is a protocol violation to send this request for a client
2058        of an `ei_handshake.context_type` other than sender.
2059         */
2060        pub fn scroll(&self, x: f32, y: f32) -> () {
2061            let args = &[wire::Arg::Float(x.into()), wire::Arg::Float(y.into())];
2062
2063            self.0.request(1, args);
2064
2065            ()
2066        }
2067
2068        /**
2069        Generate a a discrete (e.g. wheel) scroll event on this pointer.
2070        Clients must not send `ei_scroll.scroll` events for the same event,
2071        the EIS implementation is responsible for emulation of smooth
2072        scroll events.
2073
2074        A discrete scroll event is based logical scroll units (equivalent to one
2075        mouse wheel click). The value for one scroll unit is 120, a fraction or
2076        multiple thereof represents a fraction or multiple of a wheel click.
2077
2078        It is a client bug to send this request more than once
2079        within the same `ei_device.frame` and the EIS implementation
2080        may ignore either or all such requests and/or disconnect the client.
2081
2082        It is a protocol violation to send this request for a client
2083        of an `ei_handshake.context_type` other than sender.
2084         */
2085        pub fn scroll_discrete(&self, x: i32, y: i32) -> () {
2086            let args = &[wire::Arg::Int32(x.into()), wire::Arg::Int32(y.into())];
2087
2088            self.0.request(2, args);
2089
2090            ()
2091        }
2092
2093        /**
2094        Generate a a scroll stop or cancel event on this pointer.
2095
2096        A scroll stop event notifies the EIS implementation that the interaction causing a
2097        scroll motion previously triggered with `ei_scroll.scroll` or
2098        `ei_scroll.scroll_discrete` has stopped. For example, if all
2099        fingers are lifted off a touchpad, two-finger scrolling has logically
2100        stopped. The EIS implementation may use this information to e.g. start kinetic scrolling
2101        previously based on the previous finger speed.
2102
2103        If is_cancel is nonzero, the event represents a cancellation of the
2104        current interaction. This indicates that the interaction has stopped to the
2105        point where further (server-emulated) scroll events from this device are wrong.
2106
2107        It is a client bug to send this request more than once
2108        within the same `ei_device.frame` and the EIS implementation
2109        may ignore either or all such requests and/or disconnect the client.
2110
2111        It is a client bug to send this request for an axis that
2112        had a a nonzero value in either `ei_scroll.scroll` or `ei_scroll.scroll_discrete`
2113        in the current frame and the EIS implementation
2114        may ignore either or all such requests and/or disconnect the client.
2115
2116        It is a protocol violation to send this request for a client
2117        of an `ei_handshake.context_type` other than sender.
2118         */
2119        pub fn scroll_stop(&self, x: u32, y: u32, is_cancel: u32) -> () {
2120            let args = &[
2121                wire::Arg::Uint32(x.into()),
2122                wire::Arg::Uint32(y.into()),
2123                wire::Arg::Uint32(is_cancel.into()),
2124            ];
2125
2126            self.0.request(3, args);
2127
2128            ()
2129        }
2130    }
2131
2132    #[non_exhaustive]
2133    #[derive(Debug)]
2134    pub enum Event {
2135        /**
2136        This object has been removed and a client should release all
2137        associated resources.
2138
2139        This object will be destroyed by the EIS implementation immmediately after
2140        after this event is sent and as such the client must not attempt to use
2141        it after that point.
2142         */
2143        Destroyed {
2144            /** this event's serial number */
2145            serial: u32,
2146        },
2147        /**
2148        See the `ei_scroll.scroll` request for details.
2149
2150        It is a protocol violation to send this request for a client
2151        of an `ei_handshake.context_type` other than receiver.
2152         */
2153        Scroll {
2154            /**  */
2155            x: f32,
2156            /**  */
2157            y: f32,
2158        },
2159        /**
2160        See the `ei_scroll.scroll_discrete` request for details.
2161
2162        It is a protocol violation to send this request for a client
2163        of an `ei_handshake.context_type` other than receiver.
2164         */
2165        ScrollDiscrete {
2166            /**  */
2167            x: i32,
2168            /**  */
2169            y: i32,
2170        },
2171        /**
2172
2173        See the `ei_scroll.scroll_stop` request for details.
2174        It is a protocol violation to send this request for a client
2175        of an `ei_handshake.context_type` other than receiver.
2176         */
2177        ScrollStop {
2178            /**  */
2179            x: u32,
2180            /**  */
2181            y: u32,
2182            /**  */
2183            is_cancel: u32,
2184        },
2185    }
2186
2187    impl Event {
2188        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
2189            match operand {
2190                0 => Some("destroyed"),
2191                1 => Some("scroll"),
2192                2 => Some("scroll_discrete"),
2193                3 => Some("scroll_stop"),
2194                _ => None,
2195            }
2196        }
2197
2198        pub(super) fn parse(
2199            operand: u32,
2200            _bytes: &mut wire::ByteStream,
2201        ) -> Result<Self, wire::ParseError> {
2202            match operand {
2203                0 => {
2204                    let serial = _bytes.read_arg()?;
2205
2206                    Ok(Self::Destroyed { serial })
2207                }
2208                1 => {
2209                    let x = _bytes.read_arg()?;
2210                    let y = _bytes.read_arg()?;
2211
2212                    Ok(Self::Scroll { x, y })
2213                }
2214                2 => {
2215                    let x = _bytes.read_arg()?;
2216                    let y = _bytes.read_arg()?;
2217
2218                    Ok(Self::ScrollDiscrete { x, y })
2219                }
2220                3 => {
2221                    let x = _bytes.read_arg()?;
2222                    let y = _bytes.read_arg()?;
2223                    let is_cancel = _bytes.read_arg()?;
2224
2225                    Ok(Self::ScrollStop { x, y, is_cancel })
2226                }
2227                opcode => Err(wire::ParseError::InvalidOpcode("scroll", opcode)),
2228            }
2229        }
2230
2231        #[allow(
2232            unused_imports,
2233            unused_mut,
2234            unused_variables,
2235            unreachable_code,
2236            unreachable_patterns
2237        )]
2238        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
2239            use crate::{wire::OwnedArg, Interface};
2240            let mut args = Vec::new();
2241            match self {
2242                Self::Destroyed { serial } => {
2243                    args.push(serial.as_arg());
2244                }
2245                Self::Scroll { x, y } => {
2246                    args.push(x.as_arg());
2247                    args.push(y.as_arg());
2248                }
2249                Self::ScrollDiscrete { x, y } => {
2250                    args.push(x.as_arg());
2251                    args.push(y.as_arg());
2252                }
2253                Self::ScrollStop { x, y, is_cancel } => {
2254                    args.push(x.as_arg());
2255                    args.push(y.as_arg());
2256                    args.push(is_cancel.as_arg());
2257                }
2258                _ => unreachable!(),
2259            }
2260            args
2261        }
2262    }
2263}
2264
2265pub use scroll::Scroll;
2266
2267/**
2268Interface for button requests and events.
2269
2270This interface is only provided once per device and where a client
2271requests `ei_button.release` the interface does not get
2272re-initialized. An EIS implementation may adjust the behavior of the
2273device (including removing the device) if the interface is releasd.
2274
2275Note that for a client to receive objects of this type, it must announce
2276support for this interface in `ei_handshake.interface_version.`
2277 */
2278pub mod button {
2279    use crate::wire;
2280
2281    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
2282    pub struct Button(pub(crate) crate::Object);
2283
2284    impl Button {
2285        pub fn version(&self) -> u32 {
2286            self.0.version()
2287        }
2288
2289        pub fn is_alive(&self) -> bool {
2290            self.0.is_alive()
2291        }
2292    }
2293
2294    impl crate::private::Sealed for Button {}
2295
2296    impl wire::Interface for Button {
2297        const NAME: &'static str = "ei_button";
2298        const VERSION: u32 = 1;
2299        const CLIENT_SIDE: bool = true;
2300
2301        fn new_unchecked(object: crate::Object) -> Self {
2302            Self(object)
2303        }
2304
2305        fn as_object(&self) -> &crate::Object {
2306            &self.0
2307        }
2308
2309        fn as_arg(&self) -> wire::Arg<'_> {
2310            self.0.as_arg()
2311        }
2312    }
2313
2314    impl crate::ei::Interface for Button {}
2315
2316    impl Button {
2317        /**
2318        Notification that the client is no longer interested in this object.
2319        The EIS implementation will release any resources related to this object and
2320        send the `ei_button.destroyed` event once complete.
2321         */
2322        pub fn release(&self) -> () {
2323            let args = &[];
2324
2325            self.0.request(0, args);
2326
2327            ()
2328        }
2329
2330        /**
2331        Generate a button event on this pointer.
2332
2333        The button codes must match the defines in linux/input-event-codes.h.
2334
2335        It is a client bug to send more than one button request for the same button
2336        within the same `ei_device.frame` and the EIS implementation
2337        may ignore either or all button state changes and/or disconnect the client.
2338
2339        It is a protocol violation to send this request for a client
2340        of an `ei_handshake.context_type` other than sender.
2341         */
2342        pub fn button(&self, button: u32, state: ButtonState) -> () {
2343            let args = &[
2344                wire::Arg::Uint32(button.into()),
2345                wire::Arg::Uint32(state.into()),
2346            ];
2347
2348            self.0.request(1, args);
2349
2350            ()
2351        }
2352    }
2353
2354    pub use crate::eiproto_enum::button::ButtonState;
2355
2356    #[non_exhaustive]
2357    #[derive(Debug)]
2358    pub enum Event {
2359        /**
2360        This pointer has been removed and a client should release all
2361        associated resources.
2362
2363        This `ei_scroll` object will be destroyed by the EIS implementation immmediately after
2364        after this event is sent and as such the client must not attempt to use
2365        it after that point.
2366         */
2367        Destroyed {
2368            /** this event's serial number */
2369            serial: u32,
2370        },
2371        /**
2372        See the `ei_scroll.button` request for details.
2373
2374        It is a protocol violation to send this request for a client
2375        of an `ei_handshake.context_type` other than receiver.
2376
2377        It is an EIS implementation bug to send more than one button request
2378        for the same button within the same `ei_device.frame.`
2379         */
2380        Button {
2381            /**  */
2382            button: u32,
2383            /**  */
2384            state: ButtonState,
2385        },
2386    }
2387
2388    impl Event {
2389        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
2390            match operand {
2391                0 => Some("destroyed"),
2392                1 => Some("button"),
2393                _ => None,
2394            }
2395        }
2396
2397        pub(super) fn parse(
2398            operand: u32,
2399            _bytes: &mut wire::ByteStream,
2400        ) -> Result<Self, wire::ParseError> {
2401            match operand {
2402                0 => {
2403                    let serial = _bytes.read_arg()?;
2404
2405                    Ok(Self::Destroyed { serial })
2406                }
2407                1 => {
2408                    let button = _bytes.read_arg()?;
2409                    let state = _bytes.read_arg()?;
2410
2411                    Ok(Self::Button { button, state })
2412                }
2413                opcode => Err(wire::ParseError::InvalidOpcode("button", opcode)),
2414            }
2415        }
2416
2417        #[allow(
2418            unused_imports,
2419            unused_mut,
2420            unused_variables,
2421            unreachable_code,
2422            unreachable_patterns
2423        )]
2424        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
2425            use crate::{wire::OwnedArg, Interface};
2426            let mut args = Vec::new();
2427            match self {
2428                Self::Destroyed { serial } => {
2429                    args.push(serial.as_arg());
2430                }
2431                Self::Button { button, state } => {
2432                    args.push(button.as_arg());
2433                    args.push(state.as_arg());
2434                }
2435                _ => unreachable!(),
2436            }
2437            args
2438        }
2439    }
2440}
2441
2442pub use button::Button;
2443
2444/**
2445Interface for keyboard requests and events.
2446
2447This interface is only provided once per device and where a client
2448requests `ei_keyboard.release` the interface does not get re-initialized. An
2449EIS implementation may adjust the behavior of the device (including removing
2450the device) if the interface is releasd.
2451
2452Note that for a client to receive objects of this type, it must announce
2453support for this interface in `ei_handshake.interface_version.`
2454 */
2455pub mod keyboard {
2456    use crate::wire;
2457
2458    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
2459    pub struct Keyboard(pub(crate) crate::Object);
2460
2461    impl Keyboard {
2462        pub fn version(&self) -> u32 {
2463            self.0.version()
2464        }
2465
2466        pub fn is_alive(&self) -> bool {
2467            self.0.is_alive()
2468        }
2469    }
2470
2471    impl crate::private::Sealed for Keyboard {}
2472
2473    impl wire::Interface for Keyboard {
2474        const NAME: &'static str = "ei_keyboard";
2475        const VERSION: u32 = 1;
2476        const CLIENT_SIDE: bool = true;
2477
2478        fn new_unchecked(object: crate::Object) -> Self {
2479            Self(object)
2480        }
2481
2482        fn as_object(&self) -> &crate::Object {
2483            &self.0
2484        }
2485
2486        fn as_arg(&self) -> wire::Arg<'_> {
2487            self.0.as_arg()
2488        }
2489    }
2490
2491    impl crate::ei::Interface for Keyboard {}
2492
2493    impl Keyboard {
2494        /**
2495        Notification that the client is no longer interested in this keyboard.
2496        The EIS implementation will release any resources related to this keyboard and
2497        send the `ei_keyboard.destroyed` event once complete.
2498         */
2499        pub fn release(&self) -> () {
2500            let args = &[];
2501
2502            self.0.request(0, args);
2503
2504            ()
2505        }
2506
2507        /**
2508        Generate a key event on this keyboard. If the device has an
2509        `ei_keyboard.keymap`, the key code corresponds to that keymap.
2510
2511        The key codes must match the defines in linux/input-event-codes.h.
2512
2513        It is a client bug to send more than one key request for the same key
2514        within the same `ei_device.frame` and the EIS implementation
2515        may ignore either or all key state changes and/or disconnect the client.
2516
2517        It is a protocol violation to send this request for a client
2518        of an `ei_handshake.context_type` other than sender.
2519         */
2520        pub fn key(&self, key: u32, state: KeyState) -> () {
2521            let args = &[
2522                wire::Arg::Uint32(key.into()),
2523                wire::Arg::Uint32(state.into()),
2524            ];
2525
2526            self.0.request(1, args);
2527
2528            ()
2529        }
2530    }
2531
2532    pub use crate::eiproto_enum::keyboard::KeyState;
2533    pub use crate::eiproto_enum::keyboard::KeymapType;
2534
2535    #[non_exhaustive]
2536    #[derive(Debug)]
2537    pub enum Event {
2538        /**
2539        This keyboard has been removed and a client should release all
2540        associated resources.
2541
2542        This `ei_keyboard` object will be destroyed by the EIS implementation immmediately after
2543        after this event is sent and as such the client must not attempt to use
2544        it after that point.
2545         */
2546        Destroyed {
2547            /** this event's serial number */
2548            serial: u32,
2549        },
2550        /**
2551        Notification that this device has a keymap. Future key events must be
2552        interpreted by the client according to this keymap. For clients
2553        of `ei_handshake.context_type` sender it is the client's
2554        responsibility to send the correct `ei_keyboard.key` keycodes to
2555        generate the expected keysym in the EIS implementation.
2556
2557        The keymap is constant for the lifetime of the device.
2558
2559        This event provides a file descriptor to the client which can be
2560        memory-mapped in read-only mode to provide a keyboard mapping
2561        description. The fd must be mapped with MAP_PRIVATE by
2562        the recipient, as MAP_SHARED may fail.
2563
2564        This event is optional and only sent immediately after the `ei_keyboard` object is created
2565        and before the `ei_device.done` event. It is a protocol violation to send this
2566        event after the `ei_device.done` event.
2567         */
2568        Keymap {
2569            /** the keymap type */
2570            keymap_type: KeymapType,
2571            /** the keymap size in bytes */
2572            size: u32,
2573            /** file descriptor to the keymap */
2574            keymap: std::os::unix::io::OwnedFd,
2575        },
2576        /**
2577        See the `ei_keyboard.key` request for details.
2578
2579        It is a protocol violation to send this request for a client
2580        of an `ei_handshake.context_type` other than receiver.
2581
2582        It is a protocol violation to send a key down event in the same
2583        frame as a key up event for the same key in the same frame.
2584         */
2585        Key {
2586            /**  */
2587            key: u32,
2588            /**  */
2589            state: KeyState,
2590        },
2591        /**
2592        Notification that the EIS implementation has changed group or modifier
2593        states on this device, but not necessarily in response to an
2594        `ei_keyboard.key` event or request. Future `ei_keyboard.key` requests must
2595        take the new group and modifier state into account.
2596
2597        This event should be sent any time the modifier state or effective group
2598        has changed, whether caused by an `ei_keyboard.key` event in accordance
2599        with the keymap, indirectly due to further handling of an
2600        `ei_keyboard.key` event (e.g., because it triggered a keyboard shortcut
2601        that then changed the state), or caused by an unrelated an event (e.g.,
2602        input from a different keyboard, or a group change triggered by a layout
2603        selection widget).
2604
2605        For receiver clients, modifiers events will always be properly ordered
2606        with received key events, so each key event should be interpreted using
2607        the most recently-received modifier state. The server should send this
2608        event immediately following the `ei_device.frame` event for the key press
2609        that caused the change. If the state change impacts multiple keyboards,
2610        this event should be sent for all of them.
2611
2612        For sender clients, the modifiers event is not inherently synchronized
2613        with key requests, but the client may send an `ei_connection.sync` request
2614        when synchronization is required. When the corresponding
2615        `ei_callback.done` event is received, all key requests sent prior to the
2616        sync request are guaranteed to have been processed, and any
2617        directly-resulting modifiers events are guaranteed to have been
2618        received. Note, however, that it is still possible for
2619        indirectly-triggered state changes, such as via a keyboard shortcut not
2620        encoded in the keymap, to be reported after the done event.
2621
2622        A client must assume that all modifiers are lifted when it
2623        receives an `ei_device.paused` event. The EIS implementation
2624        must send this event after `ei_device.resumed` to notify the client
2625        of any nonzero modifier state.
2626
2627        This event does not reqire an `ei_device.frame` and should
2628        be processed immediately by the client.
2629
2630        This event is only sent for devices with an `ei_keyboard.keymap.`
2631
2632        Note: A previous version of the documentation instead specified that
2633        this event should not be sent in response to `ei_keyboard.key` events
2634        that change the group or modifier state according to the keymap.
2635        However, this complicated client implementation and resulted in
2636        situations where the client state could get out of sync with the server.
2637         */
2638        Modifiers {
2639            /** this event's serial number */
2640            serial: u32,
2641            /** depressed modifiers */
2642            depressed: u32,
2643            /** locked modifiers */
2644            locked: u32,
2645            /** latched modifiers */
2646            latched: u32,
2647            /** the keyboard group (layout) */
2648            group: u32,
2649        },
2650    }
2651
2652    impl Event {
2653        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
2654            match operand {
2655                0 => Some("destroyed"),
2656                1 => Some("keymap"),
2657                2 => Some("key"),
2658                3 => Some("modifiers"),
2659                _ => None,
2660            }
2661        }
2662
2663        pub(super) fn parse(
2664            operand: u32,
2665            _bytes: &mut wire::ByteStream,
2666        ) -> Result<Self, wire::ParseError> {
2667            match operand {
2668                0 => {
2669                    let serial = _bytes.read_arg()?;
2670
2671                    Ok(Self::Destroyed { serial })
2672                }
2673                1 => {
2674                    let keymap_type = _bytes.read_arg()?;
2675                    let size = _bytes.read_arg()?;
2676                    let keymap = _bytes.read_arg()?;
2677
2678                    Ok(Self::Keymap {
2679                        keymap_type,
2680                        size,
2681                        keymap,
2682                    })
2683                }
2684                2 => {
2685                    let key = _bytes.read_arg()?;
2686                    let state = _bytes.read_arg()?;
2687
2688                    Ok(Self::Key { key, state })
2689                }
2690                3 => {
2691                    let serial = _bytes.read_arg()?;
2692                    let depressed = _bytes.read_arg()?;
2693                    let locked = _bytes.read_arg()?;
2694                    let latched = _bytes.read_arg()?;
2695                    let group = _bytes.read_arg()?;
2696
2697                    Ok(Self::Modifiers {
2698                        serial,
2699                        depressed,
2700                        locked,
2701                        latched,
2702                        group,
2703                    })
2704                }
2705                opcode => Err(wire::ParseError::InvalidOpcode("keyboard", opcode)),
2706            }
2707        }
2708
2709        #[allow(
2710            unused_imports,
2711            unused_mut,
2712            unused_variables,
2713            unreachable_code,
2714            unreachable_patterns
2715        )]
2716        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
2717            use crate::{wire::OwnedArg, Interface};
2718            let mut args = Vec::new();
2719            match self {
2720                Self::Destroyed { serial } => {
2721                    args.push(serial.as_arg());
2722                }
2723                Self::Keymap {
2724                    keymap_type,
2725                    size,
2726                    keymap,
2727                } => {
2728                    args.push(keymap_type.as_arg());
2729                    args.push(size.as_arg());
2730                    args.push(keymap.as_arg());
2731                }
2732                Self::Key { key, state } => {
2733                    args.push(key.as_arg());
2734                    args.push(state.as_arg());
2735                }
2736                Self::Modifiers {
2737                    serial,
2738                    depressed,
2739                    locked,
2740                    latched,
2741                    group,
2742                } => {
2743                    args.push(serial.as_arg());
2744                    args.push(depressed.as_arg());
2745                    args.push(locked.as_arg());
2746                    args.push(latched.as_arg());
2747                    args.push(group.as_arg());
2748                }
2749                _ => unreachable!(),
2750            }
2751            args
2752        }
2753    }
2754}
2755
2756pub use keyboard::Keyboard;
2757
2758/**
2759Interface for touchscreen requests and events.
2760
2761This interface is only provided once per device and where a client
2762requests `ei_touchscreen.release` the interface does not get re-initialized. An
2763EIS implementation may adjust the behavior of the device (including removing
2764the device) if the interface is releasd.
2765
2766Note that for a client to receive objects of this type, it must announce
2767support for this interface in `ei_handshake.interface_version.`
2768 */
2769pub mod touchscreen {
2770    use crate::wire;
2771
2772    #[derive(Clone, Debug, Hash, Eq, PartialEq)]
2773    pub struct Touchscreen(pub(crate) crate::Object);
2774
2775    impl Touchscreen {
2776        pub fn version(&self) -> u32 {
2777            self.0.version()
2778        }
2779
2780        pub fn is_alive(&self) -> bool {
2781            self.0.is_alive()
2782        }
2783    }
2784
2785    impl crate::private::Sealed for Touchscreen {}
2786
2787    impl wire::Interface for Touchscreen {
2788        const NAME: &'static str = "ei_touchscreen";
2789        const VERSION: u32 = 2;
2790        const CLIENT_SIDE: bool = true;
2791
2792        fn new_unchecked(object: crate::Object) -> Self {
2793            Self(object)
2794        }
2795
2796        fn as_object(&self) -> &crate::Object {
2797            &self.0
2798        }
2799
2800        fn as_arg(&self) -> wire::Arg<'_> {
2801            self.0.as_arg()
2802        }
2803    }
2804
2805    impl crate::ei::Interface for Touchscreen {}
2806
2807    impl Touchscreen {
2808        /**
2809        Notification that the client is no longer interested in this touchscreen.
2810        The EIS implementation will release any resources related to this touch and
2811        send the `ei_touchscreen.destroyed` event once complete.
2812         */
2813        pub fn release(&self) -> () {
2814            let args = &[];
2815
2816            self.0.request(0, args);
2817
2818            ()
2819        }
2820
2821        /**
2822        Notifies the EIS implementation about a new touch logically down at the
2823        given coordinates. The touchid is a unique id for this touch. Touchids
2824        may be re-used after `ei_touchscreen.up.`
2825
2826        The x/y coordinates must be within the device's regions or the event and future
2827        `ei_touchscreen.motion` events with the same touchid are silently discarded.
2828
2829        It is a protocol violation to send a touch down in the same
2830        frame as a touch motion or touch up.
2831         */
2832        pub fn down(&self, touchid: u32, x: f32, y: f32) -> () {
2833            let args = &[
2834                wire::Arg::Uint32(touchid.into()),
2835                wire::Arg::Float(x.into()),
2836                wire::Arg::Float(y.into()),
2837            ];
2838
2839            self.0.request(1, args);
2840
2841            ()
2842        }
2843
2844        /**
2845        Notifies the EIS implementation about an existing touch changing position to
2846        the given coordinates. The touchid is the unique id for this touch previously
2847        sent with `ei_touchscreen.down.`
2848
2849        The x/y coordinates must be within the device's regions or the event is
2850        silently discarded.
2851
2852        It is a protocol violation to send a touch motion in the same
2853        frame as a touch down or touch up.
2854         */
2855        pub fn motion(&self, touchid: u32, x: f32, y: f32) -> () {
2856            let args = &[
2857                wire::Arg::Uint32(touchid.into()),
2858                wire::Arg::Float(x.into()),
2859                wire::Arg::Float(y.into()),
2860            ];
2861
2862            self.0.request(2, args);
2863
2864            ()
2865        }
2866
2867        /**
2868        Notifies the EIS implementation about an existing touch being logically
2869        up. The touchid is the unique id for this touch previously
2870        sent with `ei_touchscreen.down.`
2871
2872        If a touch is cancelled via `ei_touchscreen.cancel`, the `ei_touchscreen.up`
2873        request must not be sent for this same touch. Likewise, a touch released
2874        with `ei_touchscreen.up` must not be cancelled.
2875
2876        The touchid may be re-used after this request.
2877
2878        It is a protocol violation to send a touch up in the same
2879        frame as a touch motion or touch down.
2880         */
2881        pub fn up(&self, touchid: u32) -> () {
2882            let args = &[wire::Arg::Uint32(touchid.into())];
2883
2884            self.0.request(3, args);
2885
2886            ()
2887        }
2888
2889        /**
2890        Notifies the EIS implementation about an existing touch being cancelled.
2891        This typically means that any effects the touch may have had on the
2892        user interface should be reverted or otherwise made inconsequential.
2893
2894        This request replaces `ei_touchscreen.up` for the same touch.
2895        If a touch is cancelled via `ei_touchscreen.cancel`, the `ei_touchscreen.up`
2896        request must not be sent for this same touch. Likewise, a touch released
2897        with `ei_touchscreen.up` must not be cancelled.
2898
2899        The touchid is the unique id for this touch previously
2900        sent with `ei_touchscreen.down.`
2901
2902        The touchid may be re-used after this request.
2903
2904        It is a protocol violation to send a touch cancel
2905        in the same frame as a touch motion or touch down.
2906         */
2907        pub fn cancel(&self, touchid: u32) -> () {
2908            let args = &[wire::Arg::Uint32(touchid.into())];
2909
2910            self.0.request(4, args);
2911
2912            ()
2913        }
2914    }
2915
2916    #[non_exhaustive]
2917    #[derive(Debug)]
2918    pub enum Event {
2919        /**
2920        This touch has been removed and a client should release all
2921        associated resources.
2922
2923        This `ei_touchscreen` object will be destroyed by the EIS implementation immmediately after
2924        after this event is sent and as such the client must not attempt to use
2925        it after that point.
2926         */
2927        Destroyed {
2928            /** this event's serial number */
2929            serial: u32,
2930        },
2931        /**
2932        See the `ei_touchscreen.down` request for details.
2933
2934        It is a protocol violation to send this request for a client
2935        of an `ei_handshake.context_type` other than receiver.
2936
2937        It is a protocol violation to send a touch down in the same
2938        frame as a touch motion or touch up.
2939         */
2940        Down {
2941            /**  */
2942            touchid: u32,
2943            /**  */
2944            x: f32,
2945            /**  */
2946            y: f32,
2947        },
2948        /**
2949        See the `ei_touchscreen.motion` request for details.
2950
2951        It is a protocol violation to send this request for a client
2952        of an `ei_handshake.context_type` other than receiver.
2953
2954        It is a protocol violation to send a touch motion in the same
2955        frame as a touch down or touch up.
2956         */
2957        Motion {
2958            /**  */
2959            touchid: u32,
2960            /**  */
2961            x: f32,
2962            /**  */
2963            y: f32,
2964        },
2965        /**
2966        See the `ei_touchscreen.up` request for details.
2967
2968        It is a protocol violation to send this request for a client
2969        of an `ei_handshake.context_type` other than receiver.
2970
2971        If a touch is released via `ei_touchscreen.up`, no `ei_touchscreen.cancel`
2972        event is sent for this same touch. Likewise, a touch released
2973        with `ei_touchscreen.cancel` must not be released via `ei_touchscreen.up.`
2974
2975        It is a protocol violation to send a touch up in the same
2976        frame as a touch motion or touch down.
2977         */
2978        Up {
2979            /**  */
2980            touchid: u32,
2981        },
2982        /**
2983        See the `ei_touchscreen.cancel` request for details.
2984
2985        It is a protocol violation to send this event for a client
2986        of an `ei_handshake.context_type` other than receiver.
2987
2988        If a touch is cancelled via `ei_touchscreen.cancel`, no `ei_touchscreen.up`
2989        event is sent for this same touch. Likewise, a touch released
2990        with `ei_touchscreen.up` must not be cancelled via `ei_touchscreen.cancel.`
2991
2992        It is a protocol violation to send a touch cancel event in the same
2993        frame as a touch motion or touch down.
2994         */
2995        Cancel {
2996            /**  */
2997            touchid: u32,
2998        },
2999    }
3000
3001    impl Event {
3002        pub(super) fn op_name(operand: u32) -> Option<&'static str> {
3003            match operand {
3004                0 => Some("destroyed"),
3005                1 => Some("down"),
3006                2 => Some("motion"),
3007                3 => Some("up"),
3008                4 => Some("cancel"),
3009                _ => None,
3010            }
3011        }
3012
3013        pub(super) fn parse(
3014            operand: u32,
3015            _bytes: &mut wire::ByteStream,
3016        ) -> Result<Self, wire::ParseError> {
3017            match operand {
3018                0 => {
3019                    let serial = _bytes.read_arg()?;
3020
3021                    Ok(Self::Destroyed { serial })
3022                }
3023                1 => {
3024                    let touchid = _bytes.read_arg()?;
3025                    let x = _bytes.read_arg()?;
3026                    let y = _bytes.read_arg()?;
3027
3028                    Ok(Self::Down { touchid, x, y })
3029                }
3030                2 => {
3031                    let touchid = _bytes.read_arg()?;
3032                    let x = _bytes.read_arg()?;
3033                    let y = _bytes.read_arg()?;
3034
3035                    Ok(Self::Motion { touchid, x, y })
3036                }
3037                3 => {
3038                    let touchid = _bytes.read_arg()?;
3039
3040                    Ok(Self::Up { touchid })
3041                }
3042                4 => {
3043                    let touchid = _bytes.read_arg()?;
3044
3045                    Ok(Self::Cancel { touchid })
3046                }
3047                opcode => Err(wire::ParseError::InvalidOpcode("touchscreen", opcode)),
3048            }
3049        }
3050
3051        #[allow(
3052            unused_imports,
3053            unused_mut,
3054            unused_variables,
3055            unreachable_code,
3056            unreachable_patterns
3057        )]
3058        pub(super) fn args(&self) -> Vec<wire::Arg<'_>> {
3059            use crate::{wire::OwnedArg, Interface};
3060            let mut args = Vec::new();
3061            match self {
3062                Self::Destroyed { serial } => {
3063                    args.push(serial.as_arg());
3064                }
3065                Self::Down { touchid, x, y } => {
3066                    args.push(touchid.as_arg());
3067                    args.push(x.as_arg());
3068                    args.push(y.as_arg());
3069                }
3070                Self::Motion { touchid, x, y } => {
3071                    args.push(touchid.as_arg());
3072                    args.push(x.as_arg());
3073                    args.push(y.as_arg());
3074                }
3075                Self::Up { touchid } => {
3076                    args.push(touchid.as_arg());
3077                }
3078                Self::Cancel { touchid } => {
3079                    args.push(touchid.as_arg());
3080                }
3081                _ => unreachable!(),
3082            }
3083            args
3084        }
3085    }
3086}
3087
3088pub use touchscreen::Touchscreen;
3089
3090#[non_exhaustive]
3091#[derive(Debug)]
3092pub enum Event {
3093    Handshake(handshake::Handshake, handshake::Event),
3094    Connection(connection::Connection, connection::Event),
3095    Callback(callback::Callback, callback::Event),
3096    Pingpong(pingpong::Pingpong, pingpong::Event),
3097    Seat(seat::Seat, seat::Event),
3098    Device(device::Device, device::Event),
3099    Pointer(pointer::Pointer, pointer::Event),
3100    PointerAbsolute(pointer_absolute::PointerAbsolute, pointer_absolute::Event),
3101    Scroll(scroll::Scroll, scroll::Event),
3102    Button(button::Button, button::Event),
3103    Keyboard(keyboard::Keyboard, keyboard::Event),
3104    Touchscreen(touchscreen::Touchscreen, touchscreen::Event),
3105}
3106
3107impl Event {
3108    pub(crate) fn op_name(interface: &str, operand: u32) -> Option<&'static str> {
3109        match interface {
3110            "ei_handshake" => handshake::Event::op_name(operand),
3111            "ei_connection" => connection::Event::op_name(operand),
3112            "ei_callback" => callback::Event::op_name(operand),
3113            "ei_pingpong" => pingpong::Event::op_name(operand),
3114            "ei_seat" => seat::Event::op_name(operand),
3115            "ei_device" => device::Event::op_name(operand),
3116            "ei_pointer" => pointer::Event::op_name(operand),
3117            "ei_pointer_absolute" => pointer_absolute::Event::op_name(operand),
3118            "ei_scroll" => scroll::Event::op_name(operand),
3119            "ei_button" => button::Event::op_name(operand),
3120            "ei_keyboard" => keyboard::Event::op_name(operand),
3121            "ei_touchscreen" => touchscreen::Event::op_name(operand),
3122            _ => None,
3123        }
3124    }
3125
3126    pub(crate) fn parse(
3127        object: crate::Object,
3128        operand: u32,
3129        bytes: &mut wire::ByteStream,
3130    ) -> Result<Self, wire::ParseError> {
3131        match object.interface() {
3132            "ei_handshake" => Ok(Self::Handshake(
3133                object.downcast_unchecked(),
3134                handshake::Event::parse(operand, bytes)?,
3135            )),
3136            "ei_connection" => Ok(Self::Connection(
3137                object.downcast_unchecked(),
3138                connection::Event::parse(operand, bytes)?,
3139            )),
3140            "ei_callback" => Ok(Self::Callback(
3141                object.downcast_unchecked(),
3142                callback::Event::parse(operand, bytes)?,
3143            )),
3144            "ei_pingpong" => Ok(Self::Pingpong(
3145                object.downcast_unchecked(),
3146                pingpong::Event::parse(operand, bytes)?,
3147            )),
3148            "ei_seat" => Ok(Self::Seat(
3149                object.downcast_unchecked(),
3150                seat::Event::parse(operand, bytes)?,
3151            )),
3152            "ei_device" => Ok(Self::Device(
3153                object.downcast_unchecked(),
3154                device::Event::parse(operand, bytes)?,
3155            )),
3156            "ei_pointer" => Ok(Self::Pointer(
3157                object.downcast_unchecked(),
3158                pointer::Event::parse(operand, bytes)?,
3159            )),
3160            "ei_pointer_absolute" => Ok(Self::PointerAbsolute(
3161                object.downcast_unchecked(),
3162                pointer_absolute::Event::parse(operand, bytes)?,
3163            )),
3164            "ei_scroll" => Ok(Self::Scroll(
3165                object.downcast_unchecked(),
3166                scroll::Event::parse(operand, bytes)?,
3167            )),
3168            "ei_button" => Ok(Self::Button(
3169                object.downcast_unchecked(),
3170                button::Event::parse(operand, bytes)?,
3171            )),
3172            "ei_keyboard" => Ok(Self::Keyboard(
3173                object.downcast_unchecked(),
3174                keyboard::Event::parse(operand, bytes)?,
3175            )),
3176            "ei_touchscreen" => Ok(Self::Touchscreen(
3177                object.downcast_unchecked(),
3178                touchscreen::Event::parse(operand, bytes)?,
3179            )),
3180            intr => Err(wire::ParseError::InvalidInterface(intr.to_owned())),
3181        }
3182    }
3183}
3184
3185impl wire::MessageEnum for Event {
3186    fn args(&self) -> Vec<wire::Arg<'_>> {
3187        match self {
3188            Self::Handshake(_, x) => x.args(),
3189            Self::Connection(_, x) => x.args(),
3190            Self::Callback(_, x) => x.args(),
3191            Self::Pingpong(_, x) => x.args(),
3192            Self::Seat(_, x) => x.args(),
3193            Self::Device(_, x) => x.args(),
3194            Self::Pointer(_, x) => x.args(),
3195            Self::PointerAbsolute(_, x) => x.args(),
3196            Self::Scroll(_, x) => x.args(),
3197            Self::Button(_, x) => x.args(),
3198            Self::Keyboard(_, x) => x.args(),
3199            Self::Touchscreen(_, x) => x.args(),
3200        }
3201    }
3202}