seat: Add unique id

This commit is contained in:
Victoria Brekenfeld 2022-07-08 14:00:13 +02:00
parent b884b91068
commit b64071b068
2 changed files with 28 additions and 1 deletions

View file

@ -1,4 +1,4 @@
use crate::{input::ActiveOutput, state::Common};
use crate::{input::{ActiveOutput, SeatId}, state::Common};
use smithay::{
utils::{Logical, Rectangle, Transform},
wayland::{output::Output, seat::Seat},
@ -28,6 +28,16 @@ impl OutputExt for Output {
}
}
pub trait SeatExt {
fn id(&self) -> usize;
}
impl SeatExt for Seat<State> {
fn id(&self) -> usize {
self.user_data().get::<SeatId>().unwrap().0
}
}
pub fn active_output(seat: &Seat<State>, state: &Common) -> Output {
seat.user_data()
.get::<ActiveOutput>()