Initial support for idle notify and idle ihibit
This commit is contained in:
parent
c4fc91d6e9
commit
19ba568f02
6 changed files with 85 additions and 3 deletions
19
src/wayland/handlers/idle_inhibit.rs
Normal file
19
src/wayland/handlers/idle_inhibit.rs
Normal 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);
|
||||
12
src/wayland/handlers/idle_notify.rs
Normal file
12
src/wayland/handlers/idle_notify.rs
Normal 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);
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue