1
0
Fork 0
forked from wry/wry

all: refactor to cargo workspace, remove config shared library, remove protocol perms, add dpms cli (#7)

This commit is contained in:
kossLAN 2026-06-06 23:14:53 -04:00
parent 5db14936e7
commit bfc2a525de
616 changed files with 32344 additions and 31026 deletions

View file

@ -7,7 +7,7 @@ use {
jay_tray_v1::JayTrayV1Global,
wl_output::{BlendSpace, WlOutputGlobal},
},
output_schedule::OutputSchedule,
output_schedule::create_output_schedule,
state::{ConnectorData, OutputData, State},
tree::{OutputNode, Transform, WsMoveConfig, move_ws_to_output},
utils::{
@ -177,7 +177,11 @@ impl ConnectorHandler {
info.primaries,
info.luminance,
));
let schedule = Rc::new(OutputSchedule::new(&self.state, &self.data, &desired_state));
let schedule = Rc::new(create_output_schedule(
&self.state,
&self.data,
&desired_state,
));
let _schedule = self
.state
.eng
@ -309,7 +313,12 @@ impl ConnectorHandler {
match event {
ConnectorEvent::Disconnected => break 'outer,
ConnectorEvent::HardwareCursor(hc) => {
on.schedule.set_hardware_cursor(&hc);
let hardware_cursor_damage = hc.as_ref().map(|hc| {
let hc = hc.clone();
Rc::new(move || hc.damage()) as Rc<dyn Fn()>
});
on.schedule
.set_hardware_cursor_damage(&hardware_cursor_damage);
on.set_hardware_cursor(hc);
self.state.refresh_hardware_cursors();
}

View file

@ -1,6 +1,6 @@
use {
crate::{
backend::transaction::{BackendConnectorTransactionError, ConnectorTransaction},
backend::transaction::BackendConnectorTransactionError,
state::State,
utils::{
errorfmt::ErrorFmt,
@ -136,15 +136,7 @@ impl Idle {
}
fn try_set_idle(&self, idle: bool) -> Result<(), BackendConnectorTransactionError> {
let mut tran = ConnectorTransaction::new(&self.state);
for connector in self.state.connectors.lock().values() {
let mut state = connector.state.borrow().clone();
state.active = !idle;
tran.add(&connector.connector, state)?;
}
tran.prepare()?.apply()?.commit();
self.state.set_backend_idle(idle);
Ok(())
self.state.set_connectors_active(!idle)
}
}

View file

@ -1,12 +1,12 @@
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},
utils::{asyncevent::AsyncEvent, event_listener::EventListener},
},
jay_config::_private::DEFAULT_SEAT_NAME,
jay_config::protocol::DEFAULT_SEAT_NAME,
std::{
cell::Cell,
rc::{Rc, Weak},
@ -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),
}
}