cosmic-comp/src/wayland/handlers/seat.rs

43 lines
1.2 KiB
Rust
Raw Normal View History

// SPDX-License-Identifier: GPL-3.0-only
2022-09-28 12:01:29 +02:00
use crate::{
2024-04-05 13:53:35 +02:00
shell::Devices,
2025-10-16 18:53:57 +02:00
shell::focus::target::{KeyboardFocusTarget, PointerFocusTarget},
2022-09-28 12:01:29 +02:00
state::State,
utils::prelude::SeatExt,
2022-09-28 12:01:29 +02:00
};
use smithay::{
2024-09-09 16:21:27 +02:00
delegate_cursor_shape, delegate_seat,
2025-10-16 18:53:57 +02:00
input::{SeatHandler, SeatState, keyboard::LedState, pointer::CursorImageStatus},
};
impl SeatHandler for State {
2022-09-28 12:01:29 +02:00
type KeyboardFocus = KeyboardFocusTarget;
type PointerFocus = PointerFocusTarget;
2024-03-26 16:45:30 +01:00
type TouchFocus = PointerFocusTarget;
2022-08-31 13:01:23 +02:00
fn seat_state(&mut self) -> &mut SeatState<Self> {
&mut self.common.seat_state
}
2022-08-31 13:01:23 +02:00
fn cursor_image(&mut self, seat: &smithay::input::Seat<Self>, image: CursorImageStatus) {
seat.set_cursor_image_status(image);
2022-08-31 13:01:23 +02:00
}
fn focus_changed(
&mut self,
_seat: &smithay::input::Seat<Self>,
_focused: Option<&Self::KeyboardFocus>,
2022-08-31 13:01:23 +02:00
) {
}
fn led_state_changed(&mut self, seat: &smithay::input::Seat<Self>, led_state: LedState) {
let userdata = seat.user_data();
let devices = userdata.get::<Devices>().unwrap();
devices.update_led_state(led_state);
}
}
delegate_seat!(State);
2024-09-09 16:21:27 +02:00
delegate_cursor_shape!(State);