kms: Use scaled sizes for placing new outputs
This commit is contained in:
parent
bebd7c5c40
commit
870e5be2a6
4 changed files with 16 additions and 11 deletions
|
|
@ -277,7 +277,7 @@ impl State {
|
||||||
) {
|
) {
|
||||||
Ok((output, should_expose)) => {
|
Ok((output, should_expose)) => {
|
||||||
if should_expose {
|
if should_expose {
|
||||||
w += output.config().transformed_size().w as u32;
|
w += output.geometry().size.w as u32;
|
||||||
wl_outputs.push(output.clone());
|
wl_outputs.push(output.clone());
|
||||||
}
|
}
|
||||||
device.outputs.insert(conn, output);
|
device.outputs.insert(conn, output);
|
||||||
|
|
@ -345,13 +345,7 @@ impl State {
|
||||||
.find_map(|(crtc, surface)| (surface.connector == conn).then_some(crtc))
|
.find_map(|(crtc, surface)| (surface.connector == conn).then_some(crtc))
|
||||||
.cloned()
|
.cloned()
|
||||||
{
|
{
|
||||||
let surface = device.surfaces.remove(&crtc).unwrap();
|
device.surfaces.remove(&crtc).unwrap();
|
||||||
if surface.output.mirroring().is_none() {
|
|
||||||
// TODO: move up later outputs?
|
|
||||||
w = w.saturating_sub(
|
|
||||||
surface.output.config().transformed_size().w as u32,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !changes.added.iter().any(|(c, _)| c == &conn) {
|
if !changes.added.iter().any(|(c, _)| c == &conn) {
|
||||||
|
|
@ -376,7 +370,7 @@ impl State {
|
||||||
) {
|
) {
|
||||||
Ok((output, should_expose)) => {
|
Ok((output, should_expose)) => {
|
||||||
if should_expose {
|
if should_expose {
|
||||||
w += output.config().transformed_size().w as u32;
|
w += output.geometry().size.w as u32;
|
||||||
outputs_added.push(output.clone());
|
outputs_added.push(output.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ impl KmsState {
|
||||||
startup_done.clone(),
|
startup_done.clone(),
|
||||||
)?;
|
)?;
|
||||||
if output.mirroring().is_none() {
|
if output.mirroring().is_none() {
|
||||||
w += output.config().transformed_size().w as u32;
|
w += output.geometry().size.w as u32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
shell::Shell,
|
shell::Shell,
|
||||||
state::{BackendData, State},
|
state::{BackendData, State},
|
||||||
|
utils::prelude::OutputExt,
|
||||||
wayland::protocols::{
|
wayland::protocols::{
|
||||||
output_configuration::OutputConfigurationState, workspace::WorkspaceUpdateGuard,
|
output_configuration::OutputConfigurationState, workspace::WorkspaceUpdateGuard,
|
||||||
},
|
},
|
||||||
|
|
@ -476,6 +477,16 @@ impl Config {
|
||||||
output_state.update();
|
output_state.update();
|
||||||
self.write_outputs(output_state.outputs());
|
self.write_outputs(output_state.outputs());
|
||||||
} else {
|
} else {
|
||||||
|
// we don't have a config, so lets generate somewhat sane positions
|
||||||
|
let mut w = 0;
|
||||||
|
for output in outputs.iter().filter(|o| o.mirroring().is_none()) {
|
||||||
|
{
|
||||||
|
let mut config = output.config_mut();
|
||||||
|
config.position = (w, 0);
|
||||||
|
}
|
||||||
|
w += output.geometry().size.w as u32;
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(err) = backend.apply_config_for_outputs(
|
if let Err(err) = backend.apply_config_for_outputs(
|
||||||
false,
|
false,
|
||||||
loop_handle,
|
loop_handle,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue