From 3857d1a46c7cfbae12864de02a817b0cf7ffc689 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sun, 3 Nov 2024 15:21:32 -0800 Subject: [PATCH] feat(borders): clean up render targets on destroy --- komorebi/src/border_manager/border.rs | 5 ++--- komorebi/src/border_manager/mod.rs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/komorebi/src/border_manager/border.rs b/komorebi/src/border_manager/border.rs index 0f05a1e42..305c188aa 100644 --- a/komorebi/src/border_manager/border.rs +++ b/komorebi/src/border_manager/border.rs @@ -15,7 +15,6 @@ use std::ops::Deref; use std::sync::atomic::Ordering; use std::sync::mpsc; use std::sync::LazyLock; -use std::time::Duration; use windows::Foundation::Numerics::Matrix3x2; use windows::Win32::Foundation::BOOL; use windows::Win32::Foundation::FALSE; @@ -141,8 +140,6 @@ impl Border { let _ = TranslateMessage(&msg); DispatchMessageW(&msg); } - - std::thread::sleep(Duration::from_millis(1)) } Ok(()) @@ -201,6 +198,8 @@ impl Border { } pub fn destroy(&self) -> color_eyre::Result<()> { + let mut render_targets = RENDER_TARGETS.lock(); + render_targets.remove(&self.hwnd); WindowsApi::close_window(self.hwnd) } diff --git a/komorebi/src/border_manager/mod.rs b/komorebi/src/border_manager/mod.rs index a39bafb1d..2af2dd9a6 100644 --- a/komorebi/src/border_manager/mod.rs +++ b/komorebi/src/border_manager/mod.rs @@ -100,6 +100,7 @@ pub fn destroy_all_borders() -> color_eyre::Result<()> { borders.clear(); BORDERS_MONITORS.lock().clear(); FOCUS_STATE.lock().clear(); + RENDER_TARGETS.lock().clear(); let mut remaining_hwnds = vec![];