@@ -445,6 +445,22 @@ impl EisRequestConverter {
445445 self . queue_request ( EisRequest :: Bind ( Bind { seat, capabilities } ) ) ;
446446 return Ok ( ( ) ) ;
447447 }
448+ eis:: seat:: Request :: RequestDevice { capabilities } => {
449+ let Some ( seat) = self . connection . 0 . seats . lock ( ) . unwrap ( ) . get ( seat) . cloned ( ) else {
450+ return Ok ( ( ) ) ;
451+ } ;
452+
453+ let capabilities = DeviceCapability :: from_bits ( * capabilities)
454+ . map_err ( |_err| RequestError :: InvalidCapabilities ) ?;
455+ if !seat. 0 . advertised_capabilities . contains ( capabilities) {
456+ return Err ( RequestError :: InvalidCapabilities . into ( ) ) ;
457+ }
458+
459+ self . queue_request ( EisRequest :: RequestDevice ( RequestDevice {
460+ seat,
461+ capabilities,
462+ } ) ) ;
463+ }
448464 }
449465 Ok ( ( ) )
450466 }
@@ -490,6 +506,9 @@ impl EisRequestConverter {
490506 time : timestamp,
491507 } ) ) ;
492508 }
509+ eis:: device:: Request :: Ready => {
510+ self . queue_request ( EisRequest :: Ready ( Ready { device } ) ) ;
511+ }
493512 }
494513 }
495514
@@ -971,7 +990,9 @@ pub enum EisRequest {
971990 Disconnect ,
972991 Bind ( Bind ) ,
973992 // Only for sender context
993+ RequestDevice ( RequestDevice ) ,
974994 Frame ( Frame ) ,
995+ Ready ( Ready ) ,
975996 DeviceStartEmulating ( DeviceStartEmulating ) ,
976997 DeviceStopEmulating ( DeviceStopEmulating ) ,
977998 PointerMotion ( PointerMotion ) ,
@@ -1008,7 +1029,9 @@ impl EisRequest {
10081029 Self :: TouchCancel ( evt) => Some ( & mut evt. time ) ,
10091030 Self :: Disconnect
10101031 | Self :: Bind ( _)
1032+ | Self :: RequestDevice ( _)
10111033 | Self :: Frame ( _)
1034+ | Self :: Ready ( _)
10121035 | Self :: DeviceStartEmulating ( _)
10131036 | Self :: DeviceStopEmulating ( _) => None ,
10141037 }
@@ -1019,6 +1042,7 @@ impl EisRequest {
10191042 pub fn device ( & self ) -> Option < & Device > {
10201043 match self {
10211044 Self :: Frame ( evt) => Some ( & evt. device ) ,
1045+ Self :: Ready ( evt) => Some ( & evt. device ) ,
10221046 Self :: DeviceStartEmulating ( evt) => Some ( & evt. device ) ,
10231047 Self :: DeviceStopEmulating ( evt) => Some ( & evt. device ) ,
10241048 Self :: PointerMotion ( evt) => Some ( & evt. device ) ,
@@ -1033,7 +1057,7 @@ impl EisRequest {
10331057 Self :: TouchUp ( evt) => Some ( & evt. device ) ,
10341058 Self :: TouchMotion ( evt) => Some ( & evt. device ) ,
10351059 Self :: TouchCancel ( evt) => Some ( & evt. device ) ,
1036- Self :: Disconnect | Self :: Bind ( _) => None ,
1060+ Self :: Disconnect | Self :: Bind ( _) | Self :: RequestDevice ( _ ) => None ,
10371061 }
10381062 }
10391063}
@@ -1047,6 +1071,15 @@ pub struct Bind {
10471071 pub capabilities : BitFlags < DeviceCapability > ,
10481072}
10491073
1074+ /// High-level translation of [`ei_seat.bind`](eis::seat::Request::RequestDevice).
1075+ #[ derive( Clone , Debug , PartialEq ) ]
1076+ pub struct RequestDevice {
1077+ /// High-level [`Seat`] wrapper.
1078+ pub seat : Seat ,
1079+ /// Capabilities requested by the client.
1080+ pub capabilities : BitFlags < DeviceCapability > ,
1081+ }
1082+
10501083/// High-level translation of [`ei_device.frame`](eis::device::Request::Frame).
10511084#[ derive( Clone , Debug , PartialEq ) ]
10521085pub struct Frame {
@@ -1058,6 +1091,13 @@ pub struct Frame {
10581091 pub time : u64 ,
10591092}
10601093
1094+ /// High-level translation of [`ei_device.ready`](eis::device::Request::Ready).
1095+ #[ derive( Clone , Debug , PartialEq ) ]
1096+ pub struct Ready {
1097+ /// High-level [`Device`] wrapper.
1098+ pub device : Device ,
1099+ }
1100+
10611101/// High-level translation of [`ei_device.start_emulating`](eis::device::Request::StartEmulating).
10621102#[ derive( Clone , Debug , PartialEq ) ]
10631103pub struct DeviceStartEmulating {
0 commit comments