Skip to content

Commit 870e5be

Browse files
committed
kms: Use scaled sizes for placing new outputs
1 parent bebd7c5 commit 870e5be

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

src/backend/kms/device.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl State {
277277
) {
278278
Ok((output, should_expose)) => {
279279
if should_expose {
280-
w += output.config().transformed_size().w as u32;
280+
w += output.geometry().size.w as u32;
281281
wl_outputs.push(output.clone());
282282
}
283283
device.outputs.insert(conn, output);
@@ -345,13 +345,7 @@ impl State {
345345
.find_map(|(crtc, surface)| (surface.connector == conn).then_some(crtc))
346346
.cloned()
347347
{
348-
let surface = device.surfaces.remove(&crtc).unwrap();
349-
if surface.output.mirroring().is_none() {
350-
// TODO: move up later outputs?
351-
w = w.saturating_sub(
352-
surface.output.config().transformed_size().w as u32,
353-
);
354-
}
348+
device.surfaces.remove(&crtc).unwrap();
355349
}
356350

357351
if !changes.added.iter().any(|(c, _)| c == &conn) {
@@ -376,7 +370,7 @@ impl State {
376370
) {
377371
Ok((output, should_expose)) => {
378372
if should_expose {
379-
w += output.config().transformed_size().w as u32;
373+
w += output.geometry().size.w as u32;
380374
outputs_added.push(output.clone());
381375
}
382376

src/backend/kms/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ impl KmsState {
635635
startup_done.clone(),
636636
)?;
637637
if output.mirroring().is_none() {
638-
w += output.config().transformed_size().w as u32;
638+
w += output.geometry().size.w as u32;
639639
}
640640
}
641641
}

src/config/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use crate::{
44
shell::Shell,
55
state::{BackendData, State},
6+
utils::prelude::OutputExt,
67
wayland::protocols::{
78
output_configuration::OutputConfigurationState, workspace::WorkspaceUpdateGuard,
89
},
@@ -476,6 +477,16 @@ impl Config {
476477
output_state.update();
477478
self.write_outputs(output_state.outputs());
478479
} else {
480+
// we don't have a config, so lets generate somewhat sane positions
481+
let mut w = 0;
482+
for output in outputs.iter().filter(|o| o.mirroring().is_none()) {
483+
{
484+
let mut config = output.config_mut();
485+
config.position = (w, 0);
486+
}
487+
w += output.geometry().size.w as u32;
488+
}
489+
479490
if let Err(err) = backend.apply_config_for_outputs(
480491
false,
481492
loop_handle,

src/shell/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3617,7 +3617,7 @@ impl Shell {
36173617
.unwrap()
36183618
.take()
36193619
.unwrap_or(ManagedLayer::Floating);
3620-
3620+
36213621
match previous_layer {
36223622
ManagedLayer::Tiling if workspace.tiling_enabled => {
36233623
let focus_stack = workspace.focus_stack.get(seat);

0 commit comments

Comments
 (0)