1
0
Fork 0
forked from wry/wry

config: allow handling switch events

This commit is contained in:
Julian Orth 2024-04-28 13:35:52 +02:00
parent 55d55bf161
commit cf233abb5a
21 changed files with 443 additions and 27 deletions

View file

@ -8,7 +8,7 @@ use {
jay_seat_events::{
Axis120, AxisFrame, AxisInverted, AxisPx, AxisSource, AxisStop, Button, HoldBegin,
HoldEnd, Key, Modifiers, PinchBegin, PinchEnd, PinchUpdate, PointerAbs, PointerRel,
SwipeBegin, SwipeEnd, SwipeUpdate,
SwipeBegin, SwipeEnd, SwipeUpdate, SwitchEvent,
},
},
},
@ -324,6 +324,26 @@ async fn run(seat_test: Rc<SeatTest>) {
println!();
}
});
let st = seat_test.clone();
SwitchEvent::handle(tc, se, (), move |_, ev| {
let event = match ev.event {
0 => "lid opened",
1 => "lid closed",
2 => "converted to laptop",
3 => "converted to tablet",
_ => "unknown event",
};
if all || ev.seat == seat {
if all {
print!("Seat: {}, ", st.name(ev.seat));
}
println!(
"Time: {:.4}, Device: {}, {event}",
time(ev.time_usec),
ev.input_device
);
}
});
pending::<()>().await;
}