From 44b17d422519f6cd83f3cb32d018905e6a98c092 Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Fri, 13 Dec 2024 11:29:24 -0800 Subject: [PATCH] improve robustness of full screen detection #94 --- .../Common/PersistentWindowProcessor.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs index 5bea9b9..d8f37fe 100644 --- a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs +++ b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs @@ -1189,23 +1189,13 @@ namespace PersistentWindows.Common if (curDisplayKey.Contains(size)) isFullScreen = true; - if (!isFullScreen) + List displays = GetDisplays(); + foreach (var display in displays) { - List displays = GetDisplays(); - foreach (var display in displays) - { - RECT screen = display.Position; - RECT intersect = new RECT(); - if (!User32.IntersectRect(out intersect, ref screenPosition, ref screen)) - { - //must intersect with all screens - isFullScreen = false; - break; - } - - if (intersect.Equals(screen)) - isFullScreen = true; //fully covers at least one screen - } + RECT screen = display.Position; + RECT intersect = new RECT(); + if (User32.IntersectRect(out intersect, ref screenPosition, ref screen)) + isFullScreen = intersect.Equals(screen); //fully covers at least one screen } }