output-configuration: Test all outputs at once
This commit is contained in:
parent
aae16c49dc
commit
f481112cf9
7 changed files with 188 additions and 144 deletions
|
|
@ -65,6 +65,15 @@ pub fn init_backend_auto(
|
|||
.unwrap()
|
||||
.seats
|
||||
.add_seat(initial_seat);
|
||||
|
||||
{
|
||||
{
|
||||
let (lock, cvar) = &*state.common.startup_done;
|
||||
let mut startup = lock.lock().unwrap();
|
||||
*startup = true;
|
||||
cvar.notify_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,15 +107,15 @@ impl WinitState {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn apply_config_for_output(
|
||||
pub fn apply_config_for_outputs(
|
||||
&mut self,
|
||||
output: &Output,
|
||||
test_only: bool,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
) -> Result<Vec<Output>, anyhow::Error> {
|
||||
// TODO: if we ever have multiple winit outputs, don't ignore config.enabled
|
||||
// reset size
|
||||
let size = self.backend.window_size();
|
||||
let mut config = output
|
||||
let mut config = self
|
||||
.output
|
||||
.user_data()
|
||||
.get::<RefCell<OutputConfig>>()
|
||||
.unwrap()
|
||||
|
|
@ -126,7 +126,7 @@ impl WinitState {
|
|||
}
|
||||
Err(anyhow::anyhow!("Cannot set window size"))
|
||||
} else {
|
||||
Ok(())
|
||||
Ok(vec![self.output.clone()])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -229,17 +229,15 @@ pub fn init_backend(
|
|||
.add_heads(std::iter::once(&output));
|
||||
{
|
||||
state.common.add_output(&output);
|
||||
let mut shell = state.common.shell.write().unwrap();
|
||||
state.common.config.read_outputs(
|
||||
&mut state.common.output_configuration_state,
|
||||
&mut state.backend,
|
||||
&mut *shell,
|
||||
&state.common.shell,
|
||||
&state.common.event_loop_handle,
|
||||
&mut state.common.workspace_state.update(),
|
||||
&state.common.xdg_activation_state,
|
||||
state.common.startup_done.clone(),
|
||||
);
|
||||
|
||||
std::mem::drop(shell);
|
||||
state.common.refresh();
|
||||
}
|
||||
state.launch_xwayland(None);
|
||||
|
|
|
|||
|
|
@ -167,32 +167,29 @@ impl X11State {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn apply_config_for_output(
|
||||
pub fn apply_config_for_outputs(
|
||||
&mut self,
|
||||
output: &Output,
|
||||
test_only: bool,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
// TODO: if we ever have multiple winit outputs, don't ignore config.enabled
|
||||
// reset size
|
||||
let size = self
|
||||
.surfaces
|
||||
.iter()
|
||||
.find(|s| s.output == *output)
|
||||
.unwrap()
|
||||
.window
|
||||
.size();
|
||||
let mut config = output
|
||||
) -> Result<Vec<Output>, anyhow::Error> {
|
||||
// TODO: if we ever have multiple winit outputs, don't juse use the first and don't ignore OutputState
|
||||
|
||||
let surface = self.surfaces.first().unwrap();
|
||||
let size = surface.window.size();
|
||||
let mut config = surface
|
||||
.output
|
||||
.user_data()
|
||||
.get::<RefCell<OutputConfig>>()
|
||||
.unwrap()
|
||||
.borrow_mut();
|
||||
|
||||
// reset size
|
||||
if config.mode.0 != (size.w as i32, size.h as i32) {
|
||||
if !test_only {
|
||||
config.mode = ((size.w as i32, size.h as i32), None);
|
||||
}
|
||||
Err(anyhow::anyhow!("Cannot set window size"))
|
||||
} else {
|
||||
Ok(())
|
||||
Ok(vec![surface.output.clone()])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -366,17 +363,15 @@ pub fn init_backend(
|
|||
.add_heads(std::iter::once(&output));
|
||||
{
|
||||
state.common.add_output(&output);
|
||||
let mut shell = state.common.shell.write().unwrap();
|
||||
state.common.config.read_outputs(
|
||||
&mut state.common.output_configuration_state,
|
||||
&mut state.backend,
|
||||
&mut *shell,
|
||||
&state.common.shell,
|
||||
&state.common.event_loop_handle,
|
||||
&mut state.common.workspace_state.update(),
|
||||
&state.common.xdg_activation_state,
|
||||
state.common.startup_done.clone(),
|
||||
);
|
||||
|
||||
std::mem::drop(shell);
|
||||
state.common.refresh();
|
||||
}
|
||||
state.launch_xwayland(None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue