fix: flicker on wayland context menu pop up

fix
This commit is contained in:
Hojjat 2026-07-16 15:58:54 -06:00 committed by Victoria Brekenfeld
parent 9b5a2a0f83
commit aabf1cdc08
2 changed files with 27 additions and 8 deletions

View file

@ -4013,6 +4013,7 @@ impl TilingLayout {
&self, &self,
renderer: &mut R, renderer: &mut R,
seat: Option<&Seat<State>>, seat: Option<&Seat<State>>,
focused: Option<&CosmicMapped>,
non_exclusive_zone: Rectangle<i32, Local>, non_exclusive_zone: Rectangle<i32, Local>,
overview: (OverviewMode, Option<(SwapIndicator, Option<&Tree<Data>>)>), overview: (OverviewMode, Option<(SwapIndicator, Option<&Tree<Data>>)>),
resize_indicator: Option<(ResizeMode, ResizeIndicator)>, resize_indicator: Option<(ResizeMode, ResizeIndicator)>,
@ -4143,6 +4144,7 @@ impl TilingLayout {
old_geometries, old_geometries,
is_overview, is_overview,
seat, seat,
focused,
&self.output, &self.output,
percentage, percentage,
draw_groups, draw_groups,
@ -5276,6 +5278,7 @@ fn render_new_tree_windows<R>(
old_geometries: Option<HashMap<NodeId, Rectangle<i32, Local>>>, old_geometries: Option<HashMap<NodeId, Rectangle<i32, Local>>>,
is_overview: bool, is_overview: bool,
seat: Option<&Seat<State>>, seat: Option<&Seat<State>>,
focused: Option<&CosmicMapped>,
output: &Output, output: &Output,
percentage: f32, percentage: f32,
transition: Option<f32>, transition: Option<f32>,
@ -5295,14 +5298,19 @@ fn render_new_tree_windows<R>(
CosmicWindowRenderElement<R>: RenderElement<R>, CosmicWindowRenderElement<R>: RenderElement<R>,
CosmicStackRenderElement<R>: RenderElement<R>, CosmicStackRenderElement<R>: RenderElement<R>,
{ {
let focused = seat let focused = match seat.and_then(|seat| seat.get_keyboard().unwrap().current_focus()) {
.and_then(|seat| { Some(target @ KeyboardFocusTarget::Group(_)) => {
seat.get_keyboard() TilingLayout::currently_focused_node(target_tree, target).map(|(id, _)| id)
.unwrap() }
.current_focus() _ => focused.and_then(|mapped| {
.and_then(|target| TilingLayout::currently_focused_node(target_tree, target)) let node_id = mapped.tiling_node_id.lock().unwrap().clone()?;
}) target_tree
.map(|(id, _)| id); .get(&node_id)
.ok()
.filter(|node| node.data().is_mapped(Some(mapped)))
.map(|_| node_id)
}),
};
let focused_geo = if let Some(focused) = focused.as_ref() { let focused_geo = if let Some(focused) = focused.as_ref() {
geometries geometries
.as_ref() .as_ref()

View file

@ -1799,6 +1799,17 @@ impl Workspace {
self.tiling_layer.render( self.tiling_layer.render(
renderer, renderer,
render_focus.then_some(last_active_seat), render_focus.then_some(last_active_seat),
render_focus
.then(|| {
focused.as_ref().and_then(|target| {
if let FocusTarget::Window(mapped) = target {
Some(mapped)
} else {
None
}
})
})
.flatten(),
zone, zone,
overview, overview,
resize_indicator, resize_indicator,