diff --git a/.github/workflows/managedshell.yml b/.github/workflows/managedshell.yml index eac01d39..5eabafc4 100644 --- a/.github/workflows/managedshell.yml +++ b/.github/workflows/managedshell.yml @@ -16,7 +16,7 @@ jobs: matrix: buildconfig: [ Release ] - runs-on: windows-latest + runs-on: windows-2022 env: project: src\ManagedShell\ManagedShell.csproj diff --git a/src/ManagedShell.AppBar/AppBarManager.cs b/src/ManagedShell.AppBar/AppBarManager.cs index eeefda60..49cdb14e 100644 --- a/src/ManagedShell.AppBar/AppBarManager.cs +++ b/src/ManagedShell.AppBar/AppBarManager.cs @@ -19,6 +19,7 @@ public class AppBarManager : IDisposable public List AppBars { get; } = new List(); public List AutoHideBars { get; } = new List(); + public List OverlappingBars { get; } = new List(); public AppBarManager(ExplorerHelper explorerHelper) { @@ -213,6 +214,26 @@ public void UnregisterAutoHideBar(AppBarWindow window) AutoHideBars.Remove(window); } + public void RegisterOverlappingBar(AppBarWindow window) + { + if (OverlappingBars.Contains(window)) + { + return; + } + + OverlappingBars.Add(window); + } + + public void UnregisterOverlappingBar(AppBarWindow window) + { + if (!OverlappingBars.Contains(window)) + { + return; + } + + OverlappingBars.Remove(window); + } + public int RegisterBar(AppBarWindow abWindow) { lock (appBarLock) @@ -409,6 +430,56 @@ public Rect GetWorkArea(AppBarScreen screen, bool edgeBarsOnly, bool enabledBars } } + if (!enabledBarsOnly) + { + foreach (var window in AutoHideBars) + { + if (window.Screen.DeviceName == screen.DeviceName && + window.Handle != hWndIgnore && + (window.RequiresScreenEdge || !edgeBarsOnly)) + { + switch (window.AppBarEdge) + { + case AppBarEdge.Left: + leftEdgeWindowWidth += window.WindowRect.Width; + break; + case AppBarEdge.Right: + rightEdgeWindowWidth += window.WindowRect.Width; + break; + case AppBarEdge.Bottom: + bottomEdgeWindowHeight += window.WindowRect.Height; + break; + case AppBarEdge.Top: + topEdgeWindowHeight += window.WindowRect.Height; + break; + } + } + } + foreach (var window in OverlappingBars) + { + if (window.Screen.DeviceName == screen.DeviceName && + window.Handle != hWndIgnore && + (window.RequiresScreenEdge || !edgeBarsOnly)) + { + switch (window.AppBarEdge) + { + case AppBarEdge.Left: + leftEdgeWindowWidth += window.WindowRect.Width; + break; + case AppBarEdge.Right: + rightEdgeWindowWidth += window.WindowRect.Width; + break; + case AppBarEdge.Bottom: + bottomEdgeWindowHeight += window.WindowRect.Height; + break; + case AppBarEdge.Top: + topEdgeWindowHeight += window.WindowRect.Height; + break; + } + } + } + } + rc.Top = screen.Bounds.Top + topEdgeWindowHeight; rc.Bottom = screen.Bounds.Bottom - bottomEdgeWindowHeight; rc.Left = screen.Bounds.Left + leftEdgeWindowWidth; diff --git a/src/ManagedShell.AppBar/AppBarWindow.cs b/src/ManagedShell.AppBar/AppBarWindow.cs index 79681177..2162db9d 100644 --- a/src/ManagedShell.AppBar/AppBarWindow.cs +++ b/src/ManagedShell.AppBar/AppBarWindow.cs @@ -194,6 +194,15 @@ private void AppBarWindow_PropertyChanged(object sender, PropertyChangedEventArg _appBarManager.UnregisterAutoHideBar(this); AnimateAutoHide(false, true); } + + if (AppBarMode == AppBarMode.None) + { + _appBarManager.RegisterOverlappingBar(this); + } + else + { + _appBarManager.UnregisterOverlappingBar(this); + } } } @@ -294,6 +303,10 @@ protected virtual void OnSourceInitialized(object sender, EventArgs e) { _appBarManager.RegisterAutoHideBar(this); } + else + { + _appBarManager.RegisterOverlappingBar(this); + } // hide from alt-tab etc WindowHelper.HideWindowFromTasks(Handle); @@ -363,6 +376,7 @@ private void OnClosing(object sender, CancelEventArgs e) { UnregisterAppBar(); _appBarManager.UnregisterAutoHideBar(this); + _appBarManager.UnregisterOverlappingBar(this); AutoHideElement?.RenderTransform?.BeginAnimation(TranslateTransform.YProperty, null); AutoHideElement?.RenderTransform?.BeginAnimation(TranslateTransform.XProperty, null); diff --git a/src/ManagedShell.UWPInterop/ManagedShell.UWPInterop.csproj b/src/ManagedShell.UWPInterop/ManagedShell.UWPInterop.csproj index 25e14d36..0d0536c6 100644 --- a/src/ManagedShell.UWPInterop/ManagedShell.UWPInterop.csproj +++ b/src/ManagedShell.UWPInterop/ManagedShell.UWPInterop.csproj @@ -42,6 +42,7 @@ Windows.Globalization.DayOfWeek; Windows.Management.Deployment; Windows.Storage; + Windows.Storage.Provider.FileUpdateStatus; Windows.System.IUser; Windows.System.ProcessorArchitecture; Windows.System.User; @@ -50,6 +51,7 @@ Windows.Foundation.Diagnostics; Windows.Foundation.PropertyType; Windows.Storage.BulkAccess; + Windows.Storage.Provider;