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);

View file

@ -0,0 +1,12 @@
use smithay::{delegate_idle_notify, wayland::idle_notify::IdleNotifierHandler};
use crate::state::State;
impl IdleNotifierHandler for State {
fn idle_notifier_state(
&mut self,
) -> &mut smithay::wayland::idle_notify::IdleNotifierState<Self> {
&mut self.common.idle_notifier_state
}
}
delegate_idle_notify!(State);

View file

@ -9,6 +9,8 @@ pub mod dmabuf;
pub mod drm;
pub mod drm_lease;
pub mod fractional_scale;
pub mod idle_inhibit;
pub mod idle_notify;
pub mod image_source;
pub mod input_method;
pub mod keyboard_shortcuts_inhibit;