1
0
Fork 0
forked from wry/wry

autocommit 2022-04-17 18:45:01 CEST

This commit is contained in:
Julian Orth 2022-04-17 18:45:01 +02:00
parent 1eb0d3e173
commit affab05b94
7 changed files with 114 additions and 15 deletions

View file

@ -9,6 +9,7 @@ use {
std::{rc::Rc, time::Duration},
thiserror::Error,
};
use crate::ifs::wl_surface::zwp_idle_inhibitor_v1::ZwpIdleInhibitorV1;
pub struct JayIdle {
pub id: JayIdleId,
@ -25,9 +26,26 @@ impl JayIdle {
});
}
fn send_inhibitor(&self, surface: &ZwpIdleInhibitorV1) {
let surface = &surface.surface;
self.client.event(Inhibitor {
self_id: self.id,
surface: surface.id,
client_id: surface.client.id.raw(),
pid: surface.client.pid_info.pid as _,
comm: &surface.client.pid_info.comm,
});
}
fn get_status(&self, parser: MsgParser<'_, '_>) -> Result<(), JayIdleError> {
let _req: GetStatus = self.client.parse(self, parser)?;
self.send_interval();
{
let inhibitors = self.client.state.idle.inhibitors.lock();
for inhibitor in inhibitors.values() {
self.send_inhibitor(inhibitor);
}
}
Ok(())
}