config: allow retrieving the modes
This commit is contained in:
parent
2ab7b43f74
commit
558bea47b7
8 changed files with 73 additions and 3 deletions
|
|
@ -375,6 +375,7 @@ fn create_dummy_output(state: &Rc<State>) {
|
|||
async_event: Default::default(),
|
||||
}),
|
||||
0,
|
||||
Vec::new(),
|
||||
&backend::Mode {
|
||||
width: 0,
|
||||
height: 0,
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ pub struct WlOutputGlobal {
|
|||
pub pos: Cell<Rect>,
|
||||
pub output_id: Rc<OutputId>,
|
||||
pub mode: Cell<backend::Mode>,
|
||||
pub modes: Vec<backend::Mode>,
|
||||
pub node: CloneCell<Option<Rc<OutputNode>>>,
|
||||
pub width_mm: i32,
|
||||
pub height_mm: i32,
|
||||
|
|
@ -96,6 +97,7 @@ impl WlOutputGlobal {
|
|||
state: &Rc<State>,
|
||||
connector: &Rc<ConnectorData>,
|
||||
x1: i32,
|
||||
modes: Vec<backend::Mode>,
|
||||
mode: &backend::Mode,
|
||||
manufacturer: &str,
|
||||
product: &str,
|
||||
|
|
@ -122,6 +124,7 @@ impl WlOutputGlobal {
|
|||
pos: Cell::new(Rect::new_sized(x1, 0, width, height).unwrap()),
|
||||
output_id,
|
||||
mode: Cell::new(*mode),
|
||||
modes,
|
||||
node: Default::default(),
|
||||
width_mm,
|
||||
height_mm,
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ impl ConnectorHandler {
|
|||
&self.state,
|
||||
&self.data,
|
||||
x1,
|
||||
info.modes.clone(),
|
||||
&info.initial_mode,
|
||||
&info.manufacturer,
|
||||
&info.product,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue