Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/managedshell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
buildconfig: [ Release ]

runs-on: windows-latest
runs-on: windows-2022

env:
project: src\ManagedShell\ManagedShell.csproj
Expand Down
71 changes: 71 additions & 0 deletions src/ManagedShell.AppBar/AppBarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class AppBarManager : IDisposable

public List<AppBarWindow> AppBars { get; } = new List<AppBarWindow>();
public List<AppBarWindow> AutoHideBars { get; } = new List<AppBarWindow>();
public List<AppBarWindow> OverlappingBars { get; } = new List<AppBarWindow>();

public AppBarManager(ExplorerHelper explorerHelper)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions src/ManagedShell.AppBar/AppBarWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/ManagedShell.UWPInterop/ManagedShell.UWPInterop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -50,6 +51,7 @@
Windows.Foundation.Diagnostics;
Windows.Foundation.PropertyType;
Windows.Storage.BulkAccess;
Windows.Storage.Provider;
</CsWinRTExcludes>
</PropertyGroup>

Expand Down