From e2232fb56cc7467a851a7b97feda9ced22dba9f5 Mon Sep 17 00:00:00 2001 From: Ottatop Date: Wed, 24 Apr 2024 20:47:47 -0500 Subject: [PATCH] Don't add modes with `add_mode` Doing so adds non-current modes to the output (which are deprecated) and causes smithay to send them to `wl_output` consumers. Caused swww to open at the wrong size --- src/backend/udev.rs | 9 --------- src/handlers.rs | 9 ++++----- src/output.rs | 3 +++ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 7f85c06..52f788d 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -985,11 +985,6 @@ impl State { let drm_mode = connector.modes()[mode_id]; let wl_mode = smithay::output::Mode::from(drm_mode); - let modes = connector - .modes() - .iter() - .map(|mode| smithay::output::Mode::from(*mode)); - let surface = match device .drm .create_surface(crtc, drm_mode, &[connector.handle()]) @@ -1037,10 +1032,6 @@ impl State { output.with_state_mut(|state| state.serial = serial); - for mode in modes { - output.add_mode(mode); - } - output.set_preferred(wl_mode); self.output_focus_stack.set_focus(output.clone()); diff --git a/src/handlers.rs b/src/handlers.rs index 4e18162..bdc7648 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -309,6 +309,8 @@ fn ensure_initial_configure(surface: &WlSurface, state: &mut State) { map.layer_for_surface(surface, WindowSurfaceType::TOPLEVEL) .is_some() }) { + layer_map_for_output(output).arrange(); + let initial_configure_sent = compositor::with_states(surface, |states| { states .data_map @@ -319,12 +321,9 @@ fn ensure_initial_configure(surface: &WlSurface, state: &mut State) { .initial_configure_sent }); - let mut map = layer_map_for_output(output); - - map.arrange(); - if !initial_configure_sent { - map.layer_for_surface(surface, WindowSurfaceType::TOPLEVEL) + layer_map_for_output(output) + .layer_for_surface(surface, WindowSurfaceType::TOPLEVEL) .expect("no layer for surface") .layer_surface() .send_configure(); diff --git a/src/output.rs b/src/output.rs index a96dec9..08777fc 100644 --- a/src/output.rs +++ b/src/output.rs @@ -110,5 +110,8 @@ impl State { }); }); } + if let Some(mode) = mode { + output.set_preferred(mode); + } } }