control-center: handle outputs without unique names
This commit is contained in:
parent
cf36da4077
commit
0cb887c4b5
1 changed files with 43 additions and 36 deletions
|
|
@ -25,9 +25,10 @@ use {
|
||||||
},
|
},
|
||||||
ahash::AHashMap,
|
ahash::AHashMap,
|
||||||
egui::{
|
egui::{
|
||||||
Align, Button, Checkbox, Color32, ComboBox, DragValue, EventFilter, FontId, Frame, Grid,
|
Align, Button, Checkbox, CollapsingHeader, Color32, ComboBox, DragValue, EventFilter,
|
||||||
Id, Key, Layout, PointerButton, Rect, ScrollArea, Sense, Shadow, Stroke, StrokeKind, Style,
|
FontId, Frame, Grid, Id, Key, Layout, PointerButton, Rect, ScrollArea, Sense, Shadow,
|
||||||
TextFormat, Ui, UiBuilder, Vec2, Widget, WidgetText, emath, pos2, text::LayoutJob, vec2,
|
Stroke, StrokeKind, Style, TextFormat, Ui, UiBuilder, Vec2, Widget, WidgetText, emath,
|
||||||
|
pos2, text::LayoutJob, vec2,
|
||||||
},
|
},
|
||||||
egui_tiles::{
|
egui_tiles::{
|
||||||
Behavior, Container, Linear, LinearDir, ResizeState, SimplificationOptions, Tile, TileId,
|
Behavior, Container, Linear, LinearDir, ResizeState, SimplificationOptions, Tile, TileId,
|
||||||
|
|
@ -68,6 +69,7 @@ enum Pane {
|
||||||
struct CompleteHead {
|
struct CompleteHead {
|
||||||
id: ConnectorId,
|
id: ConnectorId,
|
||||||
name: HeadName,
|
name: HeadName,
|
||||||
|
pretty_name: Rc<String>,
|
||||||
live_state: ReadOnlyHeadState,
|
live_state: ReadOnlyHeadState,
|
||||||
changed_state: Option<HeadState>,
|
changed_state: Option<HeadState>,
|
||||||
z: u64,
|
z: u64,
|
||||||
|
|
@ -123,9 +125,9 @@ pub enum View {
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
enum HeadTransactionError {
|
enum HeadTransactionError {
|
||||||
#[error("The connector {} has been removed", .0)]
|
#[error("The connector {} has been removed", .0)]
|
||||||
HeadRemoved(ConnectorId),
|
HeadRemoved(Rc<String>),
|
||||||
#[error("The display connected to connector {} has changed", .0)]
|
#[error("The display connected to connector {} has changed", .0)]
|
||||||
MonitorChanged(ConnectorId),
|
MonitorChanged(Rc<String>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Backend(#[from] BackendConnectorTransactionError),
|
Backend(#[from] BackendConnectorTransactionError),
|
||||||
}
|
}
|
||||||
|
|
@ -811,10 +813,12 @@ impl OutputsPaneInner {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let Some(connector) = self.state.connectors.get(&head.id) else {
|
let Some(connector) = self.state.connectors.get(&head.id) else {
|
||||||
return Err(HeadTransactionError::HeadRemoved(head.id));
|
return Err(HeadTransactionError::HeadRemoved(head.pretty_name.clone()));
|
||||||
};
|
};
|
||||||
if head.live_state.borrow().monitor_info != desired.monitor_info {
|
if head.live_state.borrow().monitor_info != desired.monitor_info {
|
||||||
return Err(HeadTransactionError::MonitorChanged(head.id));
|
return Err(HeadTransactionError::MonitorChanged(
|
||||||
|
head.pretty_name.clone(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
let old = connector.state.borrow().clone();
|
let old = connector.state.borrow().clone();
|
||||||
let mut new = old.clone();
|
let mut new = old.clone();
|
||||||
|
|
@ -894,6 +898,7 @@ impl OutputsPaneInner {
|
||||||
self.heads.entry(mgrs.name).or_insert_with(|| CompleteHead {
|
self.heads.entry(mgrs.name).or_insert_with(|| CompleteHead {
|
||||||
id: connector.id,
|
id: connector.id,
|
||||||
name: mgrs.name,
|
name: mgrs.name,
|
||||||
|
pretty_name: connector.name.clone(),
|
||||||
live_state: mgrs.state(),
|
live_state: mgrs.state(),
|
||||||
changed_state: None,
|
changed_state: None,
|
||||||
z: 0,
|
z: 0,
|
||||||
|
|
@ -946,36 +951,38 @@ fn show_connector(state: &State, settings: &Settings, head: &mut CompleteHead, u
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
ui.collapsing(layout_job, |ui| {
|
CollapsingHeader::new(layout_job)
|
||||||
grid(ui, ("settings", head.name), |ui| {
|
.id_salt(("connector", head.name))
|
||||||
let mut diff = false;
|
.show(ui, |ui| {
|
||||||
show_serial_number(ui, m);
|
grid(ui, ("settings", head.name), |ui| {
|
||||||
diff |= show_enablement(ui, m, t);
|
let mut diff = false;
|
||||||
diff |= show_position(ui, m, t);
|
show_serial_number(ui, m);
|
||||||
diff |= show_scale(ui, m, t);
|
diff |= show_enablement(ui, m, t);
|
||||||
diff |= show_mode(ui, m, t);
|
diff |= show_position(ui, m, t);
|
||||||
diff |= show_size(ui, m, t);
|
diff |= show_scale(ui, m, t);
|
||||||
diff |= show_transform(ui, m, t);
|
diff |= show_mode(ui, m, t);
|
||||||
diff |= show_brightness(ui, m, t);
|
diff |= show_size(ui, m, t);
|
||||||
diff |= show_color_space(ui, m, t);
|
diff |= show_transform(ui, m, t);
|
||||||
diff |= show_eotf(ui, m, t);
|
diff |= show_brightness(ui, m, t);
|
||||||
diff |= show_format(ui, m, t);
|
diff |= show_color_space(ui, m, t);
|
||||||
diff |= show_tearing(ui, m, t);
|
diff |= show_eotf(ui, m, t);
|
||||||
diff |= show_vrr(ui, m, t);
|
diff |= show_format(ui, m, t);
|
||||||
diff |= show_non_desktop(ui, m, t);
|
diff |= show_tearing(ui, m, t);
|
||||||
diff |= show_blend_space(ui, m, t);
|
diff |= show_vrr(ui, m, t);
|
||||||
diff |= show_use_native_gamut(ui, m, t);
|
diff |= show_non_desktop(ui, m, t);
|
||||||
show_native_gamut(ui, m);
|
diff |= show_blend_space(ui, m, t);
|
||||||
diff |= show_cursor_hz(ui, m, t);
|
diff |= show_use_native_gamut(ui, m, t);
|
||||||
show_flip_margin(state, ui, m, t, head.id);
|
show_native_gamut(ui, m);
|
||||||
if diff {
|
diff |= show_cursor_hz(ui, m, t);
|
||||||
let ui = &mut *ui.row();
|
show_flip_margin(state, ui, m, t, head.id);
|
||||||
ui.label("");
|
if diff {
|
||||||
ui.label("");
|
let ui = &mut *ui.row();
|
||||||
ui.label("^ current");
|
ui.label("");
|
||||||
}
|
ui.label("");
|
||||||
|
ui.label("^ current");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_serial_number(ui: &mut Ui, m: &HeadState) {
|
fn show_serial_number(ui: &mut Ui, m: &HeadState) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue