From 9faebb7731e0f84d6b6039b4b918eac9052b7bee Mon Sep 17 00:00:00 2001 From: eythaann Date: Wed, 28 Aug 2024 08:13:59 -0500 Subject: [PATCH] fix(fullscreen): duplicate events on create followed by show --- src/background/seelen_bar/hook.rs | 6 ------ src/background/winevent.rs | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/background/seelen_bar/hook.rs b/src/background/seelen_bar/hook.rs index 9773f320..74fc8b5a 100644 --- a/src/background/seelen_bar/hook.rs +++ b/src/background/seelen_bar/hook.rs @@ -36,12 +36,6 @@ impl FancyToolbar { WinEvent::SyntheticFullscreenEnd(event_data) => { let monitor = WindowsApi::monitor_from_window(self.window.hwnd()?); if monitor == event_data.monitor { - log::trace!( - "Exit Fullscreen on {} || {} || {}", - WindowsApi::exe(origin).unwrap_or_default(), - WindowsApi::get_class(origin).unwrap_or_default(), - WindowsApi::get_window_text(origin) - ); self.show()?; } } diff --git a/src/background/winevent.rs b/src/background/winevent.rs index 29446b78..21441fa4 100644 --- a/src/background/winevent.rs +++ b/src/background/winevent.rs @@ -316,7 +316,10 @@ impl WinEvent { return None; } - if WindowsApi::is_fullscreen(origin).ok()? { + let fullscreened = trace_lock!(FULLSCREENED); + if WindowsApi::is_fullscreen(origin).ok()? + && !fullscreened.iter().any(|x| x.handle == origin) + { let data = SyntheticFullscreenData { handle: origin, monitor: WindowsApi::monitor_from_window(origin),