1
0
Fork 0
forked from wry/wry

config: allow retrieving the modes

This commit is contained in:
Julian Orth 2024-03-04 16:09:53 +01:00
parent 2ab7b43f74
commit 558bea47b7
8 changed files with 73 additions and 3 deletions

View file

@ -27,6 +27,7 @@ use {
_private::{
bincode_ops,
ipc::{ClientMessage, Response, ServerMessage},
WireMode,
},
input::{
acceleration::{AccelProfile, ACCEL_PROFILE_ADAPTIVE, ACCEL_PROFILE_FLAT},
@ -694,6 +695,24 @@ impl ConfigProxyHandler {
Ok(())
}
fn handle_connector_modes(&self, connector: Connector) -> Result<(), CphError> {
let connector = self.get_output(connector)?;
self.respond(Response::ConnectorModes {
modes: connector
.node
.global
.modes
.iter()
.map(|m| WireMode {
width: m.width,
height: m.height,
refresh_millihz: m.refresh_rate_millihz,
})
.collect(),
});
Ok(())
}
fn handle_set_cursor_size(&self, seat: Seat, size: i32) -> Result<(), CphError> {
let seat = self.get_seat(seat)?;
if size < 0 {
@ -1369,6 +1388,9 @@ impl ConfigProxyHandler {
ClientMessage::SetDoubleClickDistance { dist } => {
self.handle_set_double_click_distance(dist)
}
ClientMessage::ConnectorModes { connector } => self
.handle_connector_modes(connector)
.wrn("connector_modes")?,
}
Ok(())
}