add config options for waking dpms on mouse and keyboard interaction
This commit is contained in:
parent
2167484861
commit
eece44a59c
12 changed files with 116 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{InputDevice, InputDeviceCapability},
|
||||
backend::{InputDevice, InputDeviceCapability, InputEvent, KeyState},
|
||||
ifs::wl_seat::PX_PER_SCROLL,
|
||||
state::{DeviceHandlerData, InputDeviceData, State},
|
||||
tasks::udev_utils::{UdevProps, udev_props},
|
||||
|
|
@ -80,13 +80,21 @@ impl DeviceHandler {
|
|||
}
|
||||
if let Some(seat) = self.data.seat.get() {
|
||||
let mut any_events = false;
|
||||
let mut key_press = false;
|
||||
let mut mouse_move = false;
|
||||
while let Some(event) = self.dev.event() {
|
||||
let (is_key_press, is_mouse_move) = dpms_wake_triggers_for(&event);
|
||||
key_press |= is_key_press;
|
||||
mouse_move |= is_mouse_move;
|
||||
if is_key_press || is_mouse_move {
|
||||
self.state.input_occurred(is_key_press, is_mouse_move);
|
||||
}
|
||||
seat.event(&self.data, event);
|
||||
any_events = true;
|
||||
}
|
||||
if any_events {
|
||||
seat.mark_last_active();
|
||||
self.state.input_occurred();
|
||||
self.state.input_occurred(key_press, mouse_move);
|
||||
}
|
||||
} else {
|
||||
while self.dev.event().is_some() {
|
||||
|
|
@ -105,3 +113,16 @@ impl DeviceHandler {
|
|||
self.data.set_seat(&self.state, None);
|
||||
}
|
||||
}
|
||||
|
||||
fn dpms_wake_triggers_for(event: &InputEvent) -> (bool, bool) {
|
||||
match event {
|
||||
InputEvent::Key {
|
||||
state: KeyState::Pressed,
|
||||
..
|
||||
} => (true, false),
|
||||
InputEvent::ConnectorPosition { .. }
|
||||
| InputEvent::Motion { .. }
|
||||
| InputEvent::MotionAbsolute { .. } => (false, true),
|
||||
_ => (false, false),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue