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
This commit is contained in:
Ottatop 2024-04-24 20:47:47 -05:00
parent 3e7ef6d079
commit e2232fb56c
3 changed files with 7 additions and 14 deletions

View file

@ -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());

View file

@ -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();

View file

@ -110,5 +110,8 @@ impl State {
});
});
}
if let Some(mode) = mode {
output.set_preferred(mode);
}
}
}