fix(corner-radius): force redraw after corner radius change

This commit is contained in:
Ashley Wulber 2025-09-25 09:57:08 -04:00 committed by Victoria Brekenfeld
parent ce655d2063
commit 4e30513673
2 changed files with 35 additions and 25 deletions

View file

@ -22,23 +22,37 @@ impl CornerRadiusHandler for State {
fn set_corner_radius(
&mut self,
_toplevel: &cosmic_corner_radius_toplevel_v1::CosmicCornerRadiusToplevelV1,
_data: &CornerRadiusData,
_top_left: u32,
_top_right: u32,
_bottom_right: u32,
_bottom_left: u32,
_: &cosmic_corner_radius_toplevel_v1::CosmicCornerRadiusToplevelV1,
data: &CornerRadiusData,
) {
// TODO force redraw? of focus element?
if force_redraw(self, data).is_none() {
tracing::warn!("Failed to force redraw for corner radius change.");
}
}
fn unset_corner_radius(
&mut self,
_toplevel: &cosmic_corner_radius_toplevel_v1::CosmicCornerRadiusToplevelV1,
_data: &CornerRadiusData,
_: &cosmic_corner_radius_toplevel_v1::CosmicCornerRadiusToplevelV1,
data: &CornerRadiusData,
) {
// TODO force redraw?
if force_redraw(self, data).is_none() {
tracing::warn!("Failed to force redraw for corner radius reset.");
}
}
}
fn force_redraw(state: &mut State, data: &CornerRadiusData) -> Option<()> {
let guard = data.lock().unwrap();
let toplevel = guard.toplevel.upgrade().ok()?;
let surface = state.common.xdg_shell_state.get_toplevel(&toplevel)?;
let guard = state.common.shell.read();
let output = guard.visible_output_for_surface(surface.wl_surface())?;
state.backend.schedule_render(output);
Some(())
}
delegate_corner_radius!(State);