From dbd385d225e27a7d732d60ba5a6d6f13c1184add Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Mon, 3 Jun 2024 21:26:11 +0100 Subject: [PATCH] fix(launcher): apps with multiple windows stay focused when window closed Resolves #618 --- .../wayland/wlr_foreign_toplevel/handle.rs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/clients/wayland/wlr_foreign_toplevel/handle.rs b/src/clients/wayland/wlr_foreign_toplevel/handle.rs index 1cf1a14..91abfea 100644 --- a/src/clients/wayland/wlr_foreign_toplevel/handle.rs +++ b/src/clients/wayland/wlr_foreign_toplevel/handle.rs @@ -49,6 +49,7 @@ impl ToplevelHandleData { #[derive(Debug, Default)] pub struct ToplevelHandleDataInner { initial_done: bool, + closed: bool, output: Option, current_info: Option, @@ -137,14 +138,17 @@ where } Event::OutputEnter { output } => lock!(data.inner).output = Some(output), Event::OutputLeave { output: _ } => lock!(data.inner).output = None, - Event::Closed => state.remove_handle( - conn, - qh, - ToplevelHandle { - handle: handle.clone(), - }, - ), - Event::Done => { + Event::Closed => { + lock!(data.inner).closed = true; + state.remove_handle( + conn, + qh, + ToplevelHandle { + handle: handle.clone(), + }, + ) + } + Event::Done if !lock!(data.inner).closed => { { let pending_info = lock!(data.inner).pending_info.clone(); lock!(data.inner).current_info = Some(pending_info);