Initial support for idle notify and idle ihibit

This commit is contained in:
Mattias Eriksson 2024-04-19 14:57:17 +02:00 committed by Victoria Brekenfeld
parent c4fc91d6e9
commit 19ba568f02
6 changed files with 85 additions and 3 deletions

View file

@ -0,0 +1,19 @@
use smithay::{
delegate_idle_inhibit, reexports::wayland_server::protocol::wl_surface::WlSurface,
wayland::idle_inhibit::IdleInhibitHandler,
};
use crate::state::State;
impl IdleInhibitHandler for State {
fn inhibit(&mut self, surface: WlSurface) {
self.common.idle_inhibiting_surfaces.insert(surface);
self.common.idle_notifier_state.set_is_inhibited(true);
}
fn uninhibit(&mut self, surface: WlSurface) {
self.common.idle_inhibiting_surfaces.remove(&surface);
self.common.refresh_idle_inhibit();
}
}
delegate_idle_inhibit!(State);