diff --git a/Whim.sln b/Whim.sln index 5ecb76673..ccdfa25b9 100644 --- a/Whim.sln +++ b/Whim.sln @@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Gaps", "src\Whim.Gaps\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Tests", "src\Whim.Tests\Whim.Tests.csproj", "{B2BA068D-D77A-4B7B-9B64-2C23701F48B5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingLayout", "src\Whim.FloatingLayout\Whim.FloatingLayout.csproj", "{636EA561-2625-4D2A-9A8A-890E5AEF18B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingWindow", "src\Whim.FloatingWindow\Whim.FloatingWindow.csproj", "{636EA561-2625-4D2A-9A8A-890E5AEF18B9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Runner", "src\Whim.Runner\Whim.Runner.csproj", "{D74F1389-F4D1-4A1C-ACE3-D91D70472DBB}" ProjectSection(ProjectDependencies) = postProject @@ -43,7 +43,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.CommandPalette.Tests", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.TreeLayout.Bar", "src\Whim.TreeLayout.Bar\Whim.TreeLayout.Bar.csproj", "{4F66FB22-C4B3-494F-BEE0-9F878349621E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingLayout.Tests", "src\Whim.FloatingLayout.Tests\Whim.FloatingLayout.Tests.csproj", "{2E407C3C-FCE9-4851-9091-61C6CC687AFD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.FloatingWindow.Tests", "src\Whim.FloatingWindow.Tests\Whim.FloatingWindow.Tests.csproj", "{2E407C3C-FCE9-4851-9091-61C6CC687AFD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Whim.Gaps.Tests", "src\Whim.Gaps.Tests\Whim.Gaps.Tests.csproj", "{3771BD98-746A-446D-BEA9-22C97B719299}" EndProject diff --git a/docs/docs/contribute/development.md b/docs/docs/contribute/development.md index c1ebe414e..229df2d20 100644 --- a/docs/docs/contribute/development.md +++ b/docs/docs/contribute/development.md @@ -52,7 +52,7 @@ To use your existing configuration, make sure to update the `#r` directives to p #r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\whim.dll" #r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.Bar\Whim.Bar.dll" #r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.CommandPalette\Whim.CommandPalette.dll" -#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll" +#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll" #r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll" #r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.Gaps\Whim.Gaps.dll" #r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll" @@ -64,7 +64,7 @@ To use your existing configuration, make sure to update the `#r` directives to p // #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\whim.dll" // #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.Bar\Whim.Bar.dll" // #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.CommandPalette\Whim.CommandPalette.dll" -// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll" +// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll" // #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll" // #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.Gaps\Whim.Gaps.dll" // #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll" @@ -79,7 +79,7 @@ Alternatively, the `#r` directives can be specified using a magic path prefix `W #r "WHIM_PATH\whim.dll" #r "WHIM_PATH\plugins\Whim.Bar\Whim.Bar.dll" #r "WHIM_PATH\plugins\Whim.CommandPalette\Whim.CommandPalette.dll" -#r "WHIM_PATH\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll" +#r "WHIM_PATH\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll" #r "WHIM_PATH\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll" #r "WHIM_PATH\plugins\Whim.Gaps\Whim.Gaps.dll" #r "WHIM_PATH\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll" diff --git a/docs/docs/customize/layout-engines.md b/docs/docs/customize/layout-engines.md index 21d094a45..d2c7dde30 100644 --- a/docs/docs/customize/layout-engines.md +++ b/docs/docs/customize/layout-engines.md @@ -101,8 +101,8 @@ context.PluginManager.AddPlugin(treeLayoutPlugin); ![TreeLayoutEngine demo](../../images/tree-layout-demo.gif) -### `FreeLayoutEngine` +### `FloatingLayoutEngine` - is a layout that has all windows being free-floating. To have specific windows float within a different layout, see the [Floating Layout Plugin](../plugins/floating-layout.md). + is a layout that has all windows being free-floating. To have specific windows float within a different layout, see the [Floating Window Plugin](../plugins/floating-window.md). -![FreeLayoutEngine demo](../../images/free-layout-demo.gif) +![FloatingLayoutEngine demo](../../images/floating-layout-demo.gif) diff --git a/docs/docs/getting-started/plugins.md b/docs/docs/getting-started/plugins.md index b2cd0e9cd..28e710ed6 100644 --- a/docs/docs/getting-started/plugins.md +++ b/docs/docs/getting-started/plugins.md @@ -9,10 +9,10 @@ context.PluginManager.AddPlugin(barPlugin); ``` | Plugin | TL;DR | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | +|--------------------------------------------------------------------------| ------------------------------------------------------------------------------------------------- | | [Bar](../plugins/bar.md) | Adds a configurable bar to the top of each screen | | [Command Palette](../plugins/command-palette.md) | Fuzzy command palette filled with [commands](../customize/commands.md) | -| [Floating Layout](../plugins/floating-layout.md) | Lets windows float outside other layout engines | +| [Floating Window](../plugins/floating-window.md) | Lets windows float outside other layout engines | | [Focus](../plugins/focus-indicator.md) | Adds a border around the current window | | [Gaps](../plugins/gaps.md) | Adds gaps between windows | | [Layout Preview](../plugins/layout-preview.md) | Shows a preview when dragging windows | diff --git a/docs/docs/plugins/floating-layout.md b/docs/docs/plugins/floating-layout.md deleted file mode 100644 index 1f59654cd..000000000 --- a/docs/docs/plugins/floating-layout.md +++ /dev/null @@ -1,37 +0,0 @@ -# Floating Layout Plugin - -The adds a `FloatingLayoutEngine` proxy engine to Whim. This adds the ability for windows to float outside of any other layouts. - -The has no configuration options. - -![Floating layout demo](../../images/floating-layout-demo.gif) - -## Example Config - -```csharp -#r "WHIM_PATH\whim.dll" -#r "WHIM_PATH\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll" - -using Whim; -using Whim.FloatingLayout; - -void DoConfig(IContext context) -{ - // ... - - FloatingLayoutPlugin floatingLayoutPlugin = new(context); - context.PluginManager.AddPlugin(floatingLayoutPlugin); - - // ... -} - -return DoConfig; -``` - -## Commands - -| Identifier | Title | Keybind | -| ---------------------------------------------- | ----------------------- | ------------------------------------------------ | -| `whim.floating_layout.toggle_window_floating` | Toggle window floating | Win + Shift + F | -| `whim.floating_layout.mark_window_as_floating` | Mark window as floating | Win + Shift + M | -| `whim.floating_layout.mark_window_as_docked` | Mark window as docked | Win + Shift + D | diff --git a/docs/docs/plugins/floating-window.md b/docs/docs/plugins/floating-window.md new file mode 100644 index 000000000..6af8cec4a --- /dev/null +++ b/docs/docs/plugins/floating-window.md @@ -0,0 +1,37 @@ +# Floating Window Plugin + +The adds a `ProxyFloatingLayoutEngine` proxy engine to Whim. This adds the ability for windows to float outside of any other layouts. If you want to have a layout of free-floating windows, see the . + +The has no configuration options. + +![Floating window demo](../../images/floating-window-demo.gif) + +## Example Config + +```csharp +#r "WHIM_PATH\whim.dll" +#r "WHIM_PATH\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll" + +using Whim; +using Whim.FloatingLayout; + +void DoConfig(IContext context) +{ + // ... + + FloatingWindowPlugin floatingWindowPlugin = new(context); + context.PluginManager.AddPlugin(floatingWindowPlugin); + + // ... +} + +return DoConfig; +``` + +## Commands + +| Identifier | Title | Keybind | +|------------------------------------------------| ----------------------- | ------------------------------------------------ | +| `whim.floating_window.toggle_window_floating` | Toggle window floating | Win + Shift + F | +| `whim.floating_window.mark_window_as_floating` | Mark window as floating | Win + Shift + M | +| `whim.floating_window.mark_window_as_docked` | Mark window as docked | Win + Shift + D | diff --git a/docs/docs/toc.yml b/docs/docs/toc.yml index 5179f8943..d3a4cde38 100644 --- a/docs/docs/toc.yml +++ b/docs/docs/toc.yml @@ -22,7 +22,7 @@ items: - name: Plugins - href: plugins/bar.md - href: plugins/command-palette.md - - href: plugins/floating-layout.md + - href: plugins/floating-window.md - href: plugins/focus-indicator.md - href: plugins/gaps.md - href: plugins/layout-preview.md diff --git a/docs/images/floating-layout-demo.gif b/docs/images/floating-layout-demo.gif index 890121966..1fcd02c37 100644 Binary files a/docs/images/floating-layout-demo.gif and b/docs/images/floating-layout-demo.gif differ diff --git a/docs/images/floating-window-demo.gif b/docs/images/floating-window-demo.gif new file mode 100644 index 000000000..890121966 Binary files /dev/null and b/docs/images/floating-window-demo.gif differ diff --git a/docs/images/free-layout-demo.gif b/docs/images/free-layout-demo.gif deleted file mode 100644 index 1fcd02c37..000000000 Binary files a/docs/images/free-layout-demo.gif and /dev/null differ diff --git a/src/Whim.FloatingLayout.Tests/FloatingLayoutCommandsTests.cs b/src/Whim.FloatingLayout.Tests/FloatingLayoutCommandsTests.cs deleted file mode 100644 index 79511f9aa..000000000 --- a/src/Whim.FloatingLayout.Tests/FloatingLayoutCommandsTests.cs +++ /dev/null @@ -1,61 +0,0 @@ -using AutoFixture; -using NSubstitute; -using Whim.TestUtils; -using Xunit; - -namespace Whim.FloatingLayout.Tests; - -public class FloatingLayoutCommandsCustomization : ICustomization -{ - public void Customize(IFixture fixture) - { - IFloatingLayoutPlugin plugin = fixture.Freeze(); - plugin.Name.Returns("whim.floating_layout"); - fixture.Inject(plugin); - } -} - -public class FloatingLayoutCommandsTests -{ - private static ICommand CreateSut(IFloatingLayoutPlugin plugin, string id) => - new PluginCommandsTestUtils(new FloatingLayoutCommands(plugin)).GetCommand(id); - - [Theory, AutoSubstituteData] - public void ToggleWindowFloatingCommand(IFloatingLayoutPlugin plugin) - { - // Given - ICommand command = CreateSut(plugin, "whim.floating_layout.toggle_window_floating"); - - // When - command.TryExecute(); - - // Then - plugin.Received(1).ToggleWindowFloating(null); - } - - [Theory, AutoSubstituteData] - public void MarkWindowAsFloatingCommand(IFloatingLayoutPlugin plugin) - { - // Given - ICommand command = CreateSut(plugin, "whim.floating_layout.mark_window_as_floating"); - - // When - command.TryExecute(); - - // Then - plugin.Received(1).MarkWindowAsFloating(null); - } - - [Theory, AutoSubstituteData] - public void MarkWindowAsDockedCommand(IFloatingLayoutPlugin plugin) - { - // Given - ICommand command = CreateSut(plugin, "whim.floating_layout.mark_window_as_docked"); - - // When - command.TryExecute(); - - // Then - plugin.Received(1).MarkWindowAsDocked(null); - } -} diff --git a/src/Whim.FloatingLayout.Tests/BaseFloatingLayoutEngineTests.cs b/src/Whim.FloatingWindow.Tests/BaseProxyFloatingLayoutEngineTests.cs similarity index 72% rename from src/Whim.FloatingLayout.Tests/BaseFloatingLayoutEngineTests.cs rename to src/Whim.FloatingWindow.Tests/BaseProxyFloatingLayoutEngineTests.cs index c580c0fa0..4f104489c 100644 --- a/src/Whim.FloatingLayout.Tests/BaseFloatingLayoutEngineTests.cs +++ b/src/Whim.FloatingWindow.Tests/BaseProxyFloatingLayoutEngineTests.cs @@ -2,16 +2,16 @@ using Whim.TestUtils; using Windows.Win32.Foundation; -namespace Whim.FloatingLayout.Tests; +namespace Whim.FloatingWindow.Tests; -public class BaseFloatingLayoutEngineTests : ProxyLayoutEngineBaseTests +public class BaseProxyFloatingLayoutEngineTests : ProxyLayoutEngineBaseTests { public override Func CreateLayoutEngine => (inner) => { IContext context = Substitute.For(); IMonitor monitor = Substitute.For(); - IInternalFloatingLayoutPlugin plugin = Substitute.For(); + IInternalFloatingWindowPlugin plugin = Substitute.For(); ILayoutEngine innerLayoutEngine = Substitute.For(); context @@ -21,6 +21,6 @@ public class BaseFloatingLayoutEngineTests : ProxyLayoutEngineBaseTests monitor.WorkingArea.Returns(new Rectangle() { Width = 1000, Height = 1000 }); innerLayoutEngine.Identity.Returns(new LayoutEngineIdentity()); - return new FloatingLayoutEngine(context, plugin, innerLayoutEngine); + return new ProxyFloatingLayoutEngine(context, plugin, innerLayoutEngine); }; } diff --git a/src/Whim.FloatingLayout.Tests/Directory.Build.props b/src/Whim.FloatingWindow.Tests/Directory.Build.props similarity index 100% rename from src/Whim.FloatingLayout.Tests/Directory.Build.props rename to src/Whim.FloatingWindow.Tests/Directory.Build.props diff --git a/src/Whim.FloatingLayout.Tests/FreeLayoutEngineTests.cs b/src/Whim.FloatingWindow.Tests/FloatingLayoutEngineTests.cs similarity index 66% rename from src/Whim.FloatingLayout.Tests/FreeLayoutEngineTests.cs rename to src/Whim.FloatingWindow.Tests/FloatingLayoutEngineTests.cs index b83d27c9e..07e2f8f17 100644 --- a/src/Whim.FloatingLayout.Tests/FreeLayoutEngineTests.cs +++ b/src/Whim.FloatingWindow.Tests/FloatingLayoutEngineTests.cs @@ -4,9 +4,9 @@ using Windows.Win32.Foundation; using Xunit; -namespace Whim.FloatingLayout.Tests; +namespace Whim.FloatingWindow.Tests; -public class FreeLayoutEngineCustomization : ICustomization +public class FloatingLayoutEngineCustomization : ICustomization { public void Customize(IFixture fixture) { @@ -24,7 +24,7 @@ public void Customize(IFixture fixture) } } -public class FreeLayoutEngineTests +public class FloatingLayoutEngineTests { private static readonly LayoutEngineIdentity identity = new(); @@ -32,21 +32,21 @@ public class FreeLayoutEngineTests public void Name(IContext context) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity); // When string name = engine.Name; // Then - Assert.Equal("Free", name); + Assert.Equal("Floating", name); } #region AddWindow - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void AddWindow(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity); // When ILayoutEngine newLayoutEngine = engine.AddWindow(window); @@ -56,11 +56,11 @@ public void AddWindow(IContext context, IWindow window) Assert.Equal(1, newLayoutEngine.Count); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void AddWindow_WindowAlreadyPresent(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newLayoutEngine = engine.AddWindow(window); @@ -72,11 +72,11 @@ public void AddWindow_WindowAlreadyPresent(IContext context, IWindow window) #endregion #region RemoveWindow - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void Remove(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newLayoutEngine = engine.RemoveWindow(window); @@ -86,11 +86,11 @@ public void Remove(IContext context, IWindow window) Assert.Equal(0, newLayoutEngine.Count); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void Remove_NoChanges(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newLayoutEngine = engine.RemoveWindow(Substitute.For()); @@ -102,11 +102,11 @@ public void Remove_NoChanges(IContext context, IWindow window) #endregion RemoveWindow #region Contains - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void Contains(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When bool contains = engine.ContainsWindow(window); @@ -115,11 +115,11 @@ public void Contains(IContext context, IWindow window) Assert.True(contains); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void Contains_False(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When bool contains = engine.ContainsWindow(Substitute.For()); @@ -130,11 +130,11 @@ public void Contains_False(IContext context, IWindow window) #endregion #region DoLayout - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void DoLayout_Empty(IContext context) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity); // When IWindowState[] windowStates = engine @@ -145,7 +145,7 @@ public void DoLayout_Empty(IContext context) Assert.Empty(windowStates); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void DoLayout_KeepWindowSize( IContext context, IWindow windowNormal, @@ -156,7 +156,7 @@ IWindow windowMaximized // Given windowMinimized.IsMinimized.Returns(true); windowMaximized.IsMaximized.Returns(true); - ILayoutEngine engine = new FreeLayoutEngine(context, identity) + ILayoutEngine engine = new FloatingLayoutEngine(context, identity) .AddWindow(windowNormal) .AddWindow(windowMinimized) .AddWindow(windowMaximized); @@ -180,7 +180,7 @@ IWindow windowMaximized public void GetFirstWindow_Null(IContext context) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity); // When IWindow? result = engine.GetFirstWindow(); @@ -189,11 +189,11 @@ public void GetFirstWindow_Null(IContext context) Assert.Null(result); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void GetFirstWindow_SingleWindow(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When IWindow? result = engine.GetFirstWindow(); @@ -204,11 +204,11 @@ public void GetFirstWindow_SingleWindow(IContext context, IWindow window) #endregion #region WindowRelated - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MoveWindowToPoint(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); IRectangle rect = new Rectangle(); // When @@ -218,11 +218,11 @@ public void MoveWindowToPoint(IContext context, IWindow window) Assert.Equal(engine, newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MoveWindowEdgesInDirection(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); IRectangle rect = new Rectangle(); // When @@ -232,11 +232,11 @@ public void MoveWindowEdgesInDirection(IContext context, IWindow window) Assert.Equal(engine, newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MinimizeWindowStart(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newEngine = engine.MinimizeWindowStart(window); @@ -245,11 +245,11 @@ public void MinimizeWindowStart(IContext context, IWindow window) Assert.Equal(engine, newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MinimizeWindowEnd(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newEngine = engine.MinimizeWindowEnd(window); @@ -258,11 +258,11 @@ public void MinimizeWindowEnd(IContext context, IWindow window) Assert.Equal(engine, newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void FocusWindowInDirection(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newEngine = engine.FocusWindowInDirection(Direction.Up, window); @@ -271,11 +271,11 @@ public void FocusWindowInDirection(IContext context, IWindow window) Assert.Equal(engine, newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void SwapWindowInDirection(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); // When ILayoutEngine newEngine = engine.SwapWindowInDirection(Direction.Up, window); @@ -285,11 +285,11 @@ public void SwapWindowInDirection(IContext context, IWindow window) } #endregion - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void PerformCustomAction(IContext context, IWindow window) { // Given - ILayoutEngine engine = new FreeLayoutEngine(context, identity).AddWindow(window); + ILayoutEngine engine = new FloatingLayoutEngine(context, identity).AddWindow(window); LayoutEngineCustomAction action = new() { diff --git a/src/Whim.FloatingWindow.Tests/FloatingWindowCommandsTests.cs b/src/Whim.FloatingWindow.Tests/FloatingWindowCommandsTests.cs new file mode 100644 index 000000000..04f0c22af --- /dev/null +++ b/src/Whim.FloatingWindow.Tests/FloatingWindowCommandsTests.cs @@ -0,0 +1,61 @@ +using AutoFixture; +using NSubstitute; +using Whim.TestUtils; +using Xunit; + +namespace Whim.FloatingWindow.Tests; + +public class FloatingWindowCommandsCustomization : ICustomization +{ + public void Customize(IFixture fixture) + { + IFloatingWindowPlugin plugin = fixture.Freeze(); + plugin.Name.Returns("whim.floating_window"); + fixture.Inject(plugin); + } +} + +public class FloatingWindowCommandsTests +{ + private static ICommand CreateSut(IFloatingWindowPlugin plugin, string id) => + new PluginCommandsTestUtils(new FloatingWindowCommands(plugin)).GetCommand(id); + + [Theory, AutoSubstituteData] + public void ToggleWindowFloatingCommand(IFloatingWindowPlugin plugin) + { + // Given + ICommand command = CreateSut(plugin, "whim.floating_window.toggle_window_floating"); + + // When + command.TryExecute(); + + // Then + plugin.Received(1).ToggleWindowFloating(null); + } + + [Theory, AutoSubstituteData] + public void MarkWindowAsFloatingCommand(IFloatingWindowPlugin plugin) + { + // Given + ICommand command = CreateSut(plugin, "whim.floating_window.mark_window_as_floating"); + + // When + command.TryExecute(); + + // Then + plugin.Received(1).MarkWindowAsFloating(null); + } + + [Theory, AutoSubstituteData] + public void MarkWindowAsDockedCommand(IFloatingWindowPlugin plugin) + { + // Given + ICommand command = CreateSut(plugin, "whim.floating_window.mark_window_as_docked"); + + // When + command.TryExecute(); + + // Then + plugin.Received(1).MarkWindowAsDocked(null); + } +} diff --git a/src/Whim.FloatingLayout.Tests/FloatingLayoutPluginTests.cs b/src/Whim.FloatingWindow.Tests/FloatingWindowPluginTests.cs similarity index 79% rename from src/Whim.FloatingLayout.Tests/FloatingLayoutPluginTests.cs rename to src/Whim.FloatingWindow.Tests/FloatingWindowPluginTests.cs index a0c714d80..fb4a620a0 100644 --- a/src/Whim.FloatingLayout.Tests/FloatingLayoutPluginTests.cs +++ b/src/Whim.FloatingWindow.Tests/FloatingWindowPluginTests.cs @@ -4,9 +4,9 @@ using Whim.TestUtils; using Xunit; -namespace Whim.FloatingLayout.Tests; +namespace Whim.FloatingWindow.Tests; -public class FloatingLayoutPluginCustomization : ICustomization +public class FloatingWindowPluginCustomization : ICustomization { public void Customize(IFixture fixture) { @@ -40,9 +40,9 @@ public void Customize(IFixture fixture) } } -public class FloatingLayoutPluginTests +public class FloatingWindowPluginTests { - private static FloatingLayoutPlugin CreateSut(IContext context) => new(context); + private static FloatingWindowPlugin CreateSut(IContext context) => new(context); private static void AssertFloatingWindowsEqual( IReadOnlyDictionary> expected, @@ -58,24 +58,24 @@ IReadOnlyDictionary> actual } } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void Name(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When string name = plugin.Name; // Then - Assert.Equal("whim.floating_layout", name); + Assert.Equal("whim.floating_window", name); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void PluginCommands(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When IPluginCommands commands = plugin.PluginCommands; @@ -84,11 +84,11 @@ public void PluginCommands(IContext context) Assert.NotEmpty(commands.Commands); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void PreInitialize(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.PreInitialize(); @@ -97,11 +97,11 @@ public void PreInitialize(IContext context) context.WorkspaceManager.Received(1).AddProxyLayoutEngine(Arg.Any()); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void PostInitialize(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.PostInitialize(); @@ -110,7 +110,7 @@ public void PostInitialize(IContext context) context.WorkspaceManager.DidNotReceive().AddProxyLayoutEngine(Arg.Any()); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void WindowManager_WindowRemoved( IContext context, IWindow window, @@ -132,7 +132,7 @@ IWorkspace activeWorkspace activeWorkspace.TryGetWindowState(window).Returns(windowState); context.MonitorManager.GetMonitorAtPoint(rect).Returns(monitor); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.PreInitialize(); @@ -144,11 +144,11 @@ IWorkspace activeWorkspace } #region MarkWindowAsFloating - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsFloating_NoWindow(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.MarkWindowAsFloating(null); @@ -157,11 +157,11 @@ public void MarkWindowAsFloating_NoWindow(IContext context) Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsFloating_NoWorkspaceForWindow(IContext context, IWindow window) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); context.Butler.Pantry.GetWorkspaceForWindow(window).Returns((IWorkspace?)null); // When @@ -171,7 +171,7 @@ public void MarkWindowAsFloating_NoWorkspaceForWindow(IContext context, IWindow Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsFloating_NoWorkspaceForWindow_LastFocusedWindow( IContext context, IWindow window, @@ -179,7 +179,7 @@ IWorkspace activeWorkspace ) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); context.Butler.Pantry.GetWorkspaceForWindow(window).Returns((IWorkspace?)null); activeWorkspace.LastFocusedWindow.Returns(window); @@ -191,14 +191,14 @@ IWorkspace activeWorkspace Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsFloating_NoWindowState(IContext context, IWindow window, IWorkspace activeWorkspace) { // Given context.Butler.Pantry.GetWorkspaceForWindow(window).Returns(activeWorkspace); activeWorkspace.TryGetWindowState(window).Returns((IWindowState?)null); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.MarkWindowAsFloating(window); @@ -207,7 +207,7 @@ public void MarkWindowAsFloating_NoWindowState(IContext context, IWindow window, Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsFloating(IContext context, IWindow window, IWorkspace activeWorkspace) { // Given @@ -223,7 +223,7 @@ public void MarkWindowAsFloating(IContext context, IWindow window, IWorkspace ac } ); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.MarkWindowAsFloating(window); @@ -236,11 +236,11 @@ public void MarkWindowAsFloating(IContext context, IWindow window, IWorkspace ac #endregion #region MarkWindowAsDocked - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsDocked_WindowIsNotFloating(IContext context, IWindow window, IWorkspace activeWorkspace) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.MarkWindowAsDocked(window); @@ -251,7 +251,7 @@ public void MarkWindowAsDocked_WindowIsNotFloating(IContext context, IWindow win activeWorkspace.DidNotReceive().DoLayout(); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsDocked_WindowIsFloating(IContext context, IWindow window, IWorkspace activeWorkspace) { // Given @@ -267,7 +267,7 @@ public void MarkWindowAsDocked_WindowIsFloating(IContext context, IWindow window } ); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); plugin.MarkWindowAsFloating(window); // When @@ -280,11 +280,11 @@ public void MarkWindowAsDocked_WindowIsFloating(IContext context, IWindow window #endregion #region ToggleWindowFloating - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void ToggleWindowFloating_NoWindow(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.ToggleWindowFloating(null); @@ -293,7 +293,7 @@ public void ToggleWindowFloating_NoWindow(IContext context) Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void ToggleWindowFloating_ToFloating(IContext context, IWindow window, IWorkspace activeWorkspace) { // Given @@ -309,7 +309,7 @@ public void ToggleWindowFloating_ToFloating(IContext context, IWindow window, IW } ); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.ToggleWindowFloating(window); @@ -319,7 +319,7 @@ public void ToggleWindowFloating_ToFloating(IContext context, IWindow window, IW Assert.Equal(window, plugin.FloatingWindows.Keys.First()); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void ToggleWindowFloating_ToDocked(IContext context, IWindow window, IWorkspace activeWorkspace) { // Given @@ -335,7 +335,7 @@ public void ToggleWindowFloating_ToDocked(IContext context, IWindow window, IWor } ); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); plugin.MarkWindowAsFloating(window); @@ -347,11 +347,11 @@ public void ToggleWindowFloating_ToDocked(IContext context, IWindow window, IWor } #endregion - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void SaveState(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When JsonElement? json = plugin.SaveState(); @@ -360,11 +360,11 @@ public void SaveState(IContext context) Assert.Null(json); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void LoadState(IContext context) { // Given - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); // When plugin.LoadState(JsonDocument.Parse("{}").RootElement); @@ -374,7 +374,7 @@ public void LoadState(IContext context) } #region MarkWindowAsDockedInLayoutEngine - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsDockedInLayoutEngine_WindowIsNotFloating( IContext context, IWindow window, @@ -383,7 +383,7 @@ IWorkspace activeWorkspace { // Given ILayoutEngine layoutEngine = activeWorkspace.ActiveLayoutEngine; - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); Assert.Empty(plugin.FloatingWindows); @@ -394,7 +394,7 @@ IWorkspace activeWorkspace Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsDockedInLayoutEngine_WindowIsFloating( IContext context, IWindow window, @@ -415,7 +415,7 @@ IWorkspace activeWorkspace } ); - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); plugin.MarkWindowAsFloating(window); AssertFloatingWindowsEqual( @@ -436,7 +436,7 @@ IWorkspace activeWorkspace Assert.Empty(plugin.FloatingWindows); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] public void MarkWindowAsDocked_WindowIsFloatingInMultipleLayoutEngines( IContext context, IWindow window, @@ -461,7 +461,7 @@ IWorkspace activeWorkspace ); // When - FloatingLayoutPlugin plugin = CreateSut(context); + FloatingWindowPlugin plugin = CreateSut(context); plugin.MarkWindowAsFloating(window); activeWorkspace.ActiveLayoutEngine.Returns(layoutEngine2); diff --git a/src/Whim.FloatingLayout.Tests/GlobalSuppressions.cs b/src/Whim.FloatingWindow.Tests/GlobalSuppressions.cs similarity index 100% rename from src/Whim.FloatingLayout.Tests/GlobalSuppressions.cs rename to src/Whim.FloatingWindow.Tests/GlobalSuppressions.cs diff --git a/src/Whim.FloatingLayout.Tests/FloatingLayoutEngineTests.cs b/src/Whim.FloatingWindow.Tests/ProxyFloatingLayoutEngineTests.cs similarity index 75% rename from src/Whim.FloatingLayout.Tests/FloatingLayoutEngineTests.cs rename to src/Whim.FloatingWindow.Tests/ProxyFloatingLayoutEngineTests.cs index 7e4d63a41..a5827fd96 100644 --- a/src/Whim.FloatingLayout.Tests/FloatingLayoutEngineTests.cs +++ b/src/Whim.FloatingWindow.Tests/ProxyFloatingLayoutEngineTests.cs @@ -5,9 +5,9 @@ using Windows.Win32.Foundation; using Xunit; -namespace Whim.FloatingLayout.Tests; +namespace Whim.FloatingWindow.Tests; -public class FloatingLayoutEngineCustomization : ICustomization +public class ProxyFloatingLayoutEngineCustomization : ICustomization { public void Customize(IFixture fixture) { @@ -25,10 +25,10 @@ public void Customize(IFixture fixture) } } -public class FloatingLayoutEngineTests +public class ProxyFloatingLayoutEngineTests { - private FloatingLayoutEngineTests MarkWindowAsFloating( - IInternalFloatingLayoutPlugin plugin, + private ProxyFloatingLayoutEngineTests MarkWindowAsFloating( + IInternalFloatingWindowPlugin plugin, IWindow window, ILayoutEngine innerLayoutEngine ) @@ -47,7 +47,7 @@ ILayoutEngine innerLayoutEngine return this; } - private FloatingLayoutEngineTests Setup_RemoveWindow( + private ProxyFloatingLayoutEngineTests Setup_RemoveWindow( ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -58,7 +58,7 @@ ILayoutEngine newInnerLayoutEngine return this; } - private FloatingLayoutEngineTests Setup_AddWindow( + private ProxyFloatingLayoutEngineTests Setup_AddWindow( ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -70,16 +70,16 @@ ILayoutEngine newInnerLayoutEngine } #region AddWindow - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void AddWindow_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.AddWindow(window); @@ -89,16 +89,16 @@ IWindow window innerLayoutEngine.Received(1).AddWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void AddWindow_UseInner_SameInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.AddWindow(window).Returns(innerLayoutEngine); @@ -110,17 +110,17 @@ IWindow window innerLayoutEngine.Received(1).AddWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void AddWindow_FloatingInPlugin_Succeed( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given MarkWindowAsFloating(plugin, window, innerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.AddWindow(window); @@ -130,17 +130,17 @@ IWindow window innerLayoutEngine.DidNotReceive().AddWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void AddWindow_FloatingInPlugin_FailOnNoRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given MarkWindowAsFloating(plugin, window, innerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); context.NativeManager.DwmGetWindowRectangle(Arg.Any()).Returns((Rectangle?)null); @@ -152,10 +152,10 @@ IWindow window innerLayoutEngine.Received(1).AddWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void AddWindow_FloatingInPlugin_FailOnSameRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -164,7 +164,7 @@ ILayoutEngine newInnerLayoutEngine // Given MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine1 = engine.AddWindow(window); @@ -177,10 +177,10 @@ ILayoutEngine newInnerLayoutEngine newInnerLayoutEngine.DidNotReceive().AddWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void AddWindow_FloatingInPlugin_RemoveFromInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -188,7 +188,7 @@ ILayoutEngine newInnerLayoutEngine { // Given Setup_AddWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.AddWindow(window); @@ -204,16 +204,16 @@ ILayoutEngine newInnerLayoutEngine #endregion #region RemoveWindow - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void RemoveWindow_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.RemoveWindow(window); @@ -223,16 +223,16 @@ IWindow window innerLayoutEngine.Received(1).RemoveWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void RemoveWindow_UseInner_SameInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.RemoveWindow(window).Returns(innerLayoutEngine); // When @@ -243,10 +243,10 @@ IWindow window innerLayoutEngine.Received(1).RemoveWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void RemoveWindow_FloatingInPlugin( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -255,7 +255,7 @@ ILayoutEngine newInnerLayoutEngine // Given MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine1 = engine.AddWindow(window); @@ -273,17 +273,17 @@ ILayoutEngine newInnerLayoutEngine #endregion #region MoveWindowToPoint - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowToPoint_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given IRectangle rect = new Rectangle(); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.MoveWindowToPoint(window, rect); @@ -293,10 +293,10 @@ IWindow window innerLayoutEngine.Received(1).MoveWindowToPoint(window, rect); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowToPoint_UseInner_SameInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) @@ -304,7 +304,7 @@ IWindow window // Given IRectangle rect = new Rectangle(); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.MoveWindowToPoint(window, rect).Returns(innerLayoutEngine); // When @@ -315,10 +315,10 @@ IWindow window innerLayoutEngine.Received(1).MoveWindowToPoint(window, rect); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowToPoint_FloatingInPlugin_WindowIsNew( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) @@ -327,7 +327,7 @@ IWindow window IRectangle rect = new Rectangle(); MarkWindowAsFloating(plugin, window, innerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.MoveWindowToPoint(window, rect); @@ -337,10 +337,10 @@ IWindow window innerLayoutEngine.DidNotReceive().MoveWindowToPoint(window, rect); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowToPoint_FloatingInPlugin_WindowIsNotNew_SameRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -351,7 +351,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine1 = engine.AddWindow(window); @@ -363,10 +363,10 @@ ILayoutEngine newInnerLayoutEngine innerLayoutEngine.DidNotReceive().MoveWindowToPoint(window, rect); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowToPoint_FloatingInPlugin_WindowIsNotNew_DifferentRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -377,7 +377,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine1 = engine.AddWindow(window); @@ -389,10 +389,10 @@ ILayoutEngine newInnerLayoutEngine innerLayoutEngine.DidNotReceive().MoveWindowToPoint(window, rect); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowToPoint_FloatingInPlugin_CannotGetDwmRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -403,7 +403,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_AddWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); context.NativeManager.DwmGetWindowRectangle(Arg.Any()).Returns((Rectangle?)null); @@ -420,10 +420,10 @@ ILayoutEngine newInnerLayoutEngine #endregion #region MoveWindowEdgesInDirection - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowEdgesInDirection_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) @@ -432,7 +432,7 @@ IWindow window Direction direction = Direction.Left; IPoint deltas = new Point(); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.MoveWindowEdgesInDirection(direction, deltas, window); @@ -442,10 +442,10 @@ IWindow window innerLayoutEngine.Received(1).MoveWindowEdgesInDirection(direction, deltas, window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowEdgesInDirection_UseInner_SameInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) @@ -454,7 +454,7 @@ IWindow window Direction direction = Direction.Left; IPoint deltas = new Point(); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.MoveWindowEdgesInDirection(direction, deltas, window).Returns(innerLayoutEngine); @@ -466,10 +466,10 @@ IWindow window innerLayoutEngine.Received(1).MoveWindowEdgesInDirection(direction, deltas, window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowEdgesInDirection_FloatingInPlugin_WindowIsNew( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) @@ -479,7 +479,7 @@ IWindow window IPoint deltas = new Point(); MarkWindowAsFloating(plugin, window, innerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.MoveWindowEdgesInDirection(direction, deltas, window); @@ -489,10 +489,10 @@ IWindow window innerLayoutEngine.DidNotReceive().MoveWindowEdgesInDirection(direction, deltas, window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowEdgesInDirection_FloatingInPlugin_WindowIsNotNew_SameRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -504,7 +504,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine1 = engine.AddWindow(window); @@ -516,10 +516,10 @@ ILayoutEngine newInnerLayoutEngine innerLayoutEngine.DidNotReceive().MoveWindowEdgesInDirection(direction, deltas, window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowEdgesInDirection_FloatingInPlugin_WindowIsNotNew_DifferentRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -531,7 +531,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine1 = engine.AddWindow(window); @@ -543,10 +543,10 @@ ILayoutEngine newInnerLayoutEngine innerLayoutEngine.DidNotReceive().MoveWindowEdgesInDirection(direction, deltas, window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void MoveWindowEdgesInDirection_FloatingInPlugin_CannotGetDwmRectangle( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -558,7 +558,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_AddWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); context.NativeManager.DwmGetWindowRectangle(Arg.Any()).Returns((Rectangle?)null); @@ -575,10 +575,10 @@ ILayoutEngine newInnerLayoutEngine #endregion #region DoLayout - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void DoLayout( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, ILayoutEngine newInnerLayoutEngine, IWindow window1, @@ -591,7 +591,7 @@ IMonitor monitor MarkWindowAsFloating(plugin, floatingWindow, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, floatingWindow, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); newInnerLayoutEngine .DoLayout(Arg.Any>(), Arg.Any()) @@ -668,15 +668,15 @@ IMonitor monitor #endregion #region GetFirstWindow - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void GetFirstWindow_NoInnerFirstWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.GetFirstWindow().Returns((IWindow?)null); // When @@ -686,16 +686,16 @@ ILayoutEngine innerLayoutEngine Assert.Null(firstWindow); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void GetFirstWindow_InnerFirstWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.GetFirstWindow().Returns(window); // When @@ -705,17 +705,17 @@ IWindow window Assert.Same(window, firstWindow); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void GetFirstWindow_FloatingFirstWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); @@ -731,17 +731,17 @@ ILayoutEngine newInnerLayoutEngine #endregion #region FocusWindowInDirection - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void FocusWindowInDirection_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given Direction direction = Direction.Left; - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.GetFirstWindow().Returns(window); // When @@ -752,13 +752,13 @@ IWindow window innerLayoutEngine.DidNotReceive().GetFirstWindow(); window.DidNotReceive().Focus(); Assert.NotSame(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void FocusWindowInDirection_FloatingWindow_NullFirstWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -769,7 +769,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.AddWindow(window).FocusWindowInDirection(direction, window); @@ -783,13 +783,13 @@ ILayoutEngine newInnerLayoutEngine window.DidNotReceive().Focus(); Assert.NotSame(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void FocusWindowInDirection_FloatingWindow_DefinedFirstWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -800,7 +800,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); newInnerLayoutEngine.GetFirstWindow().Returns(window); @@ -816,22 +816,22 @@ ILayoutEngine newInnerLayoutEngine window.Received(1).Focus(); Assert.NotSame(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } #endregion #region SwapWindowInDirection - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void SwapWindowInDirection_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given Direction direction = Direction.Left; - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.SwapWindowInDirection(direction, window); @@ -839,20 +839,20 @@ IWindow window // Then innerLayoutEngine.Received(1).SwapWindowInDirection(direction, window); Assert.NotSame(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void SwapWindowInDirection_UseInner_SameInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given Direction direction = Direction.Left; - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.SwapWindowInDirection(direction, window).Returns(innerLayoutEngine); @@ -862,13 +862,13 @@ IWindow window // Then innerLayoutEngine.Received(1).SwapWindowInDirection(direction, window); Assert.Same(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void SwapWindowInDirection_FloatingWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -879,7 +879,7 @@ ILayoutEngine newInnerLayoutEngine MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.AddWindow(window).SwapWindowInDirection(direction, window); @@ -887,21 +887,21 @@ ILayoutEngine newInnerLayoutEngine // Then innerLayoutEngine.DidNotReceive().SwapWindowInDirection(direction, window); Assert.NotSame(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } #endregion #region ContainsWindow - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void ContainsWindow_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When bool containsWindow = engine.ContainsWindow(window); @@ -911,16 +911,16 @@ IWindow window innerLayoutEngine.Received(1).ContainsWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void ContainsWindow_UseInner_SameInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.ContainsWindow(window).Returns(true); // When @@ -931,10 +931,10 @@ IWindow window innerLayoutEngine.Received(1).ContainsWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void ContainsWindow_FloatingWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -943,7 +943,7 @@ ILayoutEngine newInnerLayoutEngine // Given MarkWindowAsFloating(plugin, window, innerLayoutEngine) .Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When bool containsWindow = engine.AddWindow(window).ContainsWindow(window); @@ -955,10 +955,10 @@ ILayoutEngine newInnerLayoutEngine #endregion #region WindowWasFloating_ShouldBeGarbageCollectedByUpdateInner - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void WindowWasFloating_AddWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -966,7 +966,7 @@ ILayoutEngine newInnerLayoutEngine { // Given Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When the window is floating... MarkWindowAsFloating(plugin, window, innerLayoutEngine); @@ -984,10 +984,10 @@ ILayoutEngine newInnerLayoutEngine newInnerLayoutEngine.Received(1).AddWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void WindowWasFloating_MoveWindowToPoint( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -995,7 +995,7 @@ ILayoutEngine newInnerLayoutEngine { // Given Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When the window is floating... MarkWindowAsFloating(plugin, window, innerLayoutEngine); @@ -1013,10 +1013,10 @@ ILayoutEngine newInnerLayoutEngine newInnerLayoutEngine.Received(1).MoveWindowToPoint(window, new Rectangle()); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void WindowWasFloating_RemoveWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -1024,7 +1024,7 @@ ILayoutEngine newInnerLayoutEngine { // Given Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When the window is floating... MarkWindowAsFloating(plugin, window, innerLayoutEngine); @@ -1042,10 +1042,10 @@ ILayoutEngine newInnerLayoutEngine newInnerLayoutEngine.Received(1).RemoveWindow(window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void WindowWasFloating_MoveWindowEdgesInDirection( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -1055,7 +1055,7 @@ ILayoutEngine newInnerLayoutEngine Point deltas = new(); Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When the window is floating... MarkWindowAsFloating(plugin, window, innerLayoutEngine); @@ -1073,10 +1073,10 @@ ILayoutEngine newInnerLayoutEngine newInnerLayoutEngine.Received(1).MoveWindowEdgesInDirection(Direction.Left, deltas, window); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void WindowWasFloating_SwapWindowInDirection( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window, ILayoutEngine newInnerLayoutEngine @@ -1084,7 +1084,7 @@ ILayoutEngine newInnerLayoutEngine { // Given Setup_RemoveWindow(innerLayoutEngine, window, newInnerLayoutEngine); - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When the window is floating... MarkWindowAsFloating(plugin, window, innerLayoutEngine); @@ -1104,15 +1104,15 @@ ILayoutEngine newInnerLayoutEngine #endregion #region PerformCustomAction - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void PerformCustomAction_UseInner( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); LayoutEngineCustomAction action = new() { @@ -1126,18 +1126,18 @@ ILayoutEngine innerLayoutEngine // Then Assert.NotSame(engine, newEngine); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void PerformCustomAction_UseInner_WindowIsDefined( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); LayoutEngineCustomAction action = new() { @@ -1153,19 +1153,19 @@ ILayoutEngine innerLayoutEngine // Then Assert.Same(engine, newEngine); innerLayoutEngine.Received(1).PerformCustomAction(action); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } - [Theory, AutoSubstituteData] + [Theory, AutoSubstituteData] internal void PerformCustomAction_FloatingWindow( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); LayoutEngineCustomAction action = new() { @@ -1183,7 +1183,7 @@ IWindow window Assert.NotSame(engine, newEngine); Assert.Same(newEngine, newEngine2); innerLayoutEngine.DidNotReceive().PerformCustomAction(action); - Assert.IsType(newEngine); + Assert.IsType(newEngine); } #endregion @@ -1191,13 +1191,13 @@ IWindow window [Theory, AutoSubstituteData] internal void MinimizeWindowStart_NotSame( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.MinimizeWindowStart(window); @@ -1209,13 +1209,13 @@ IWindow window [Theory, AutoSubstituteData] internal void MinimizeWindowStart_Same( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.MinimizeWindowStart(window).Returns(innerLayoutEngine); // When @@ -1228,13 +1228,13 @@ IWindow window [Theory, AutoSubstituteData] internal void MinimizeWindowEnd_NotSame( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); // When ILayoutEngine newEngine = engine.MinimizeWindowEnd(window); @@ -1246,13 +1246,13 @@ IWindow window [Theory, AutoSubstituteData] internal void MinimizeWindowEnd_Same( IContext context, - IInternalFloatingLayoutPlugin plugin, + IInternalFloatingWindowPlugin plugin, ILayoutEngine innerLayoutEngine, IWindow window ) { // Given - FloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); + ProxyFloatingLayoutEngine engine = new(context, plugin, innerLayoutEngine); innerLayoutEngine.MinimizeWindowEnd(window).Returns(innerLayoutEngine); // When diff --git a/src/Whim.FloatingLayout.Tests/Whim.FloatingLayout.Tests.csproj b/src/Whim.FloatingWindow.Tests/Whim.FloatingWindow.Tests.csproj similarity index 94% rename from src/Whim.FloatingLayout.Tests/Whim.FloatingLayout.Tests.csproj rename to src/Whim.FloatingWindow.Tests/Whim.FloatingWindow.Tests.csproj index 99522c347..d5197ca3c 100644 --- a/src/Whim.FloatingLayout.Tests/Whim.FloatingLayout.Tests.csproj +++ b/src/Whim.FloatingWindow.Tests/Whim.FloatingWindow.Tests.csproj @@ -23,6 +23,7 @@ x64;arm64;Any CPU net7.0-windows10.0.19041.0 0.7.0 + Whim.FloatingWindow.Tests @@ -43,7 +44,7 @@ - + \ No newline at end of file diff --git a/src/Whim.FloatingLayout/FreeLayoutEngine.cs b/src/Whim.FloatingWindow/FloatingLayoutEngine.cs similarity index 86% rename from src/Whim.FloatingLayout/FreeLayoutEngine.cs rename to src/Whim.FloatingWindow/FloatingLayoutEngine.cs index d3d713df0..6676148a6 100644 --- a/src/Whim.FloatingLayout/FreeLayoutEngine.cs +++ b/src/Whim.FloatingWindow/FloatingLayoutEngine.cs @@ -2,19 +2,18 @@ using System.Collections.Immutable; using System.Linq; -namespace Whim.FloatingLayout; +namespace Whim.FloatingWindow; /// /// Layout engine that lays out all windows as free-floating. -/// This layout will be soon renamed FloatingLayoutEngine. /// -public class FreeLayoutEngine : ILayoutEngine +public class FloatingLayoutEngine : ILayoutEngine { private readonly IContext _context; private readonly ImmutableDictionary> _dict; /// - public string Name { get; init; } = "Free"; + public string Name { get; init; } = "Floating"; /// public int Count => _dict.Count; @@ -23,18 +22,21 @@ public class FreeLayoutEngine : ILayoutEngine public LayoutEngineIdentity Identity { get; } /// - /// Creates a new instance of the class. + /// Creates a new instance of the class. /// /// The identity of the layout engine. /// The context of the layout engine. - public FreeLayoutEngine(IContext context, LayoutEngineIdentity identity) + public FloatingLayoutEngine(IContext context, LayoutEngineIdentity identity) { Identity = identity; _context = context; _dict = ImmutableDictionary>.Empty; } - private FreeLayoutEngine(FreeLayoutEngine layoutEngine, ImmutableDictionary> dict) + private FloatingLayoutEngine( + FloatingLayoutEngine layoutEngine, + ImmutableDictionary> dict + ) { Name = layoutEngine.Name; Identity = layoutEngine.Identity; @@ -63,7 +65,7 @@ public ILayoutEngine RemoveWindow(IWindow window) ImmutableDictionary> newDict = _dict.Remove(window); - return new FreeLayoutEngine(this, newDict); + return new FloatingLayoutEngine(this, newDict); } /// @@ -118,7 +120,7 @@ public ILayoutEngine MoveWindowEdgesInDirection(Direction edges, IPoint /// public ILayoutEngine SwapWindowInDirection(Direction direction, IWindow window) => this; - private FreeLayoutEngine UpdateWindowRectangle(IWindow window) + private FloatingLayoutEngine UpdateWindowRectangle(IWindow window) { // Try get the old rectangle. IRectangle? oldRectangle = _dict.TryGetValue(window, out IRectangle? rectangle) @@ -143,6 +145,6 @@ private FreeLayoutEngine UpdateWindowRectangle(IWindow window) ImmutableDictionary> newDict = _dict.SetItem(window, newUnitSquareRectangle); - return new FreeLayoutEngine(this, newDict); + return new FloatingLayoutEngine(this, newDict); } } diff --git a/src/Whim.FloatingLayout/FloatingLayoutCommands.cs b/src/Whim.FloatingWindow/FloatingWindowCommands.cs similarity index 50% rename from src/Whim.FloatingLayout/FloatingLayoutCommands.cs rename to src/Whim.FloatingWindow/FloatingWindowCommands.cs index 1881b7169..266a373ec 100644 --- a/src/Whim.FloatingLayout/FloatingLayoutCommands.cs +++ b/src/Whim.FloatingWindow/FloatingWindowCommands.cs @@ -1,38 +1,38 @@ using Windows.Win32.UI.Input.KeyboardAndMouse; -namespace Whim.FloatingLayout; +namespace Whim.FloatingWindow; /// -/// The commands for the floating layout plugin. +/// The commands for the floating window plugin. /// -public class FloatingLayoutCommands : PluginCommands +public class FloatingWindowCommands : PluginCommands { - private readonly IFloatingLayoutPlugin _floatingLayoutPlugin; + private readonly IFloatingWindowPlugin _floatingWindowPlugin; /// - /// Creates a new instance of the floating layout commands. + /// Creates a new instance of the floating window commands. /// - public FloatingLayoutCommands(IFloatingLayoutPlugin floatingLayoutPlugin) - : base(floatingLayoutPlugin.Name) + public FloatingWindowCommands(IFloatingWindowPlugin floatingWindowPlugin) + : base(floatingWindowPlugin.Name) { - _floatingLayoutPlugin = floatingLayoutPlugin; + _floatingWindowPlugin = floatingWindowPlugin; Add( identifier: "toggle_window_floating", title: "Toggle window floating", - () => _floatingLayoutPlugin.ToggleWindowFloating(), + () => _floatingWindowPlugin.ToggleWindowFloating(), keybind: new Keybind(IKeybind.WinShift, VIRTUAL_KEY.VK_F) ) .Add( identifier: "mark_window_as_floating", title: "Mark window as floating", - () => _floatingLayoutPlugin.MarkWindowAsFloating(), + () => _floatingWindowPlugin.MarkWindowAsFloating(), keybind: new Keybind(IKeybind.WinShift, VIRTUAL_KEY.VK_M) ) .Add( identifier: "mark_window_as_docked", title: "Mark window as docked", - () => _floatingLayoutPlugin.MarkWindowAsDocked(), + () => _floatingWindowPlugin.MarkWindowAsDocked(), keybind: new Keybind(IKeybind.WinShift, VIRTUAL_KEY.VK_D) ); } diff --git a/src/Whim.FloatingLayout/FloatingLayoutPlugin.cs b/src/Whim.FloatingWindow/FloatingWindowPlugin.cs similarity index 88% rename from src/Whim.FloatingLayout/FloatingLayoutPlugin.cs rename to src/Whim.FloatingWindow/FloatingWindowPlugin.cs index 1addf1f1f..881f453c6 100644 --- a/src/Whim.FloatingLayout/FloatingLayoutPlugin.cs +++ b/src/Whim.FloatingWindow/FloatingWindowPlugin.cs @@ -1,17 +1,17 @@ using System.Collections.Generic; using System.Text.Json; -namespace Whim.FloatingLayout; +namespace Whim.FloatingWindow; /// -public class FloatingLayoutPlugin : IFloatingLayoutPlugin, IInternalFloatingLayoutPlugin +public class FloatingWindowPlugin : IFloatingWindowPlugin, IInternalFloatingWindowPlugin { private readonly IContext _context; /// - /// whim.floating_layout + /// whim.floating_window /// - public string Name => "whim.floating_layout"; + public string Name => "whim.floating_window"; private readonly Dictionary> _floatingWindows = new(); @@ -19,10 +19,10 @@ public class FloatingLayoutPlugin : IFloatingLayoutPlugin, IInternalFloatingLayo public IReadOnlyDictionary> FloatingWindows => _floatingWindows; /// - /// Creates a new instance of the floating layout plugin. + /// Creates a new instance of the floating window plugin. /// /// - public FloatingLayoutPlugin(IContext context) + public FloatingWindowPlugin(IContext context) { _context = context; } @@ -30,7 +30,7 @@ public FloatingLayoutPlugin(IContext context) /// public void PreInitialize() { - _context.WorkspaceManager.AddProxyLayoutEngine(layout => new FloatingLayoutEngine(_context, this, layout)); + _context.WorkspaceManager.AddProxyLayoutEngine(layout => new ProxyFloatingLayoutEngine(_context, this, layout)); _context.WindowManager.WindowRemoved += WindowManager_WindowRemoved; } @@ -38,7 +38,7 @@ public void PreInitialize() public void PostInitialize() { } /// - public IPluginCommands PluginCommands => new FloatingLayoutCommands(this); + public IPluginCommands PluginCommands => new FloatingWindowCommands(this); private void WindowManager_WindowRemoved(object? sender, WindowEventArgs e) => _floatingWindows.Remove(e.Window); diff --git a/src/Whim.FloatingLayout/IFloatingLayoutPlugin.cs b/src/Whim.FloatingWindow/IFloatingWindowPlugin.cs similarity index 81% rename from src/Whim.FloatingLayout/IFloatingLayoutPlugin.cs rename to src/Whim.FloatingWindow/IFloatingWindowPlugin.cs index 6cd8f2faa..0823507a1 100644 --- a/src/Whim.FloatingLayout/IFloatingLayoutPlugin.cs +++ b/src/Whim.FloatingWindow/IFloatingWindowPlugin.cs @@ -1,9 +1,9 @@ -namespace Whim.FloatingLayout; +namespace Whim.FloatingWindow; /// -/// FloatingLayoutPlugin lets windows escape the layout engine and be free-floating. +/// FloatingWindowPlugin lets windows escape the layout engine and be free-floating. /// -public interface IFloatingLayoutPlugin : IPlugin +public interface IFloatingWindowPlugin : IPlugin { /// /// Mark the given as a floating window diff --git a/src/Whim.FloatingLayout/IInternalFloatingLayoutPlugin.cs b/src/Whim.FloatingWindow/IInternalFloatingWindowPlugin.cs similarity index 88% rename from src/Whim.FloatingLayout/IInternalFloatingLayoutPlugin.cs rename to src/Whim.FloatingWindow/IInternalFloatingWindowPlugin.cs index da75e659c..3b062a63d 100644 --- a/src/Whim.FloatingLayout/IInternalFloatingLayoutPlugin.cs +++ b/src/Whim.FloatingWindow/IInternalFloatingWindowPlugin.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace Whim.FloatingLayout; +namespace Whim.FloatingWindow; -internal interface IInternalFloatingLayoutPlugin +internal interface IInternalFloatingWindowPlugin { /// /// Mapping of floating windows to the layout engines that they are floating in. diff --git a/src/Whim.FloatingLayout/FloatingLayoutEngine.cs b/src/Whim.FloatingWindow/ProxyFloatingLayoutEngine.cs similarity index 84% rename from src/Whim.FloatingLayout/FloatingLayoutEngine.cs rename to src/Whim.FloatingWindow/ProxyFloatingLayoutEngine.cs index 1c8fe0f30..658c12777 100644 --- a/src/Whim.FloatingLayout/FloatingLayoutEngine.cs +++ b/src/Whim.FloatingWindow/ProxyFloatingLayoutEngine.cs @@ -2,27 +2,31 @@ using System.Collections.Immutable; using System.Linq; -namespace Whim.FloatingLayout; +namespace Whim.FloatingWindow; /// -/// A proxy layout engine to allow windows to be free-floating. +/// A proxy layout engine to allow windows to be free-floating within another layout. /// -internal record FloatingLayoutEngine : BaseProxyLayoutEngine +internal record ProxyFloatingLayoutEngine : BaseProxyLayoutEngine { private readonly IContext _context; - private readonly IInternalFloatingLayoutPlugin _plugin; + private readonly IInternalFloatingWindowPlugin _plugin; private readonly ImmutableDictionary> _floatingWindowRects; /// public override int Count => InnerLayoutEngine.Count + _floatingWindowRects.Count; /// - /// Creates a new instance of the proxy layout engine . + /// Creates a new instance of the proxy layout engine . /// /// /// /// - public FloatingLayoutEngine(IContext context, IInternalFloatingLayoutPlugin plugin, ILayoutEngine innerLayoutEngine) + public ProxyFloatingLayoutEngine( + IContext context, + IInternalFloatingWindowPlugin plugin, + ILayoutEngine innerLayoutEngine + ) : base(innerLayoutEngine) { _context = context; @@ -30,7 +34,7 @@ public FloatingLayoutEngine(IContext context, IInternalFloatingLayoutPlugin plug _floatingWindowRects = ImmutableDictionary>.Empty; } - private FloatingLayoutEngine(FloatingLayoutEngine oldEngine, ILayoutEngine newInnerLayoutEngine) + private ProxyFloatingLayoutEngine(ProxyFloatingLayoutEngine oldEngine, ILayoutEngine newInnerLayoutEngine) : base(newInnerLayoutEngine) { _context = oldEngine._context; @@ -38,8 +42,8 @@ private FloatingLayoutEngine(FloatingLayoutEngine oldEngine, ILayoutEngine newIn _floatingWindowRects = oldEngine._floatingWindowRects; } - private FloatingLayoutEngine( - FloatingLayoutEngine oldEngine, + private ProxyFloatingLayoutEngine( + ProxyFloatingLayoutEngine oldEngine, ILayoutEngine newInnerLayoutEngine, ImmutableDictionary> floatingWindowRects ) @@ -49,7 +53,7 @@ ImmutableDictionary> floatingWindowRects } /// - /// Returns a new instance of with the given inner layout engine, + /// Returns a new instance of with the given inner layout engine, /// if the inner layout engine has changed, or the was floating. /// /// The new inner layout engine. @@ -59,14 +63,14 @@ ImmutableDictionary> floatingWindowRects /// couldn't get the window's rectangle). /// /// - private FloatingLayoutEngine UpdateInner(ILayoutEngine newInnerLayoutEngine, IWindow? gcWindow) + private ProxyFloatingLayoutEngine UpdateInner(ILayoutEngine newInnerLayoutEngine, IWindow? gcWindow) { ImmutableDictionary> newFloatingWindowRects = gcWindow != null ? _floatingWindowRects.Remove(gcWindow) : _floatingWindowRects; return InnerLayoutEngine == newInnerLayoutEngine && _floatingWindowRects == newFloatingWindowRects ? this - : new FloatingLayoutEngine(this, newInnerLayoutEngine, newFloatingWindowRects); + : new ProxyFloatingLayoutEngine(this, newInnerLayoutEngine, newFloatingWindowRects); } /// @@ -76,7 +80,7 @@ public override ILayoutEngine AddWindow(IWindow window) // update the rectangle and return. if (IsWindowFloating(window)) { - (FloatingLayoutEngine newEngine, bool error) = UpdateWindowRectangle(window); + (ProxyFloatingLayoutEngine newEngine, bool error) = UpdateWindowRectangle(window); if (!error) { return newEngine; @@ -100,7 +104,7 @@ public override ILayoutEngine RemoveWindow(IWindow window) // If the window was not supposed to be floating, remove it from the inner layout engine. if (isFloating) { - return new FloatingLayoutEngine(this, InnerLayoutEngine, _floatingWindowRects.Remove(window)); + return new ProxyFloatingLayoutEngine(this, InnerLayoutEngine, _floatingWindowRects.Remove(window)); } } @@ -113,7 +117,7 @@ public override ILayoutEngine MoveWindowToPoint(IWindow window, IPoint p // If the window is floating, update the rectangle and return. if (IsWindowFloating(window)) { - (FloatingLayoutEngine newEngine, bool error) = UpdateWindowRectangle(window); + (ProxyFloatingLayoutEngine newEngine, bool error) = UpdateWindowRectangle(window); if (!error) { return newEngine; @@ -129,7 +133,7 @@ public override ILayoutEngine MoveWindowEdgesInDirection(Direction edge, IPoint< // If the window is floating, update the rectangle and return. if (IsWindowFloating(window)) { - (FloatingLayoutEngine newEngine, bool error) = UpdateWindowRectangle(window); + (ProxyFloatingLayoutEngine newEngine, bool error) = UpdateWindowRectangle(window); if (!error) { return newEngine; @@ -143,7 +147,7 @@ private bool IsWindowFloating(IWindow window) => _plugin.FloatingWindows.TryGetValue(window, out ISet? layoutEngines) && layoutEngines.Contains(InnerLayoutEngine.Identity); - private (FloatingLayoutEngine, bool error) UpdateWindowRectangle(IWindow window) + private (ProxyFloatingLayoutEngine, bool error) UpdateWindowRectangle(IWindow window) { // Try get the old rectangle. IRectangle? oldRectangle = _floatingWindowRects.TryGetValue(window, out IRectangle? rectangle) @@ -168,7 +172,7 @@ private bool IsWindowFloating(IWindow window) => ILayoutEngine innerLayoutEngine = InnerLayoutEngine.RemoveWindow(window); return ( - new FloatingLayoutEngine( + new ProxyFloatingLayoutEngine( this, innerLayoutEngine, _floatingWindowRects.SetItem(window, newUnitSquareRectangle) diff --git a/src/Whim.FloatingLayout/README.md b/src/Whim.FloatingWindow/README.md similarity index 81% rename from src/Whim.FloatingLayout/README.md rename to src/Whim.FloatingWindow/README.md index f3cac3cf9..4c601f6f6 100644 --- a/src/Whim.FloatingLayout/README.md +++ b/src/Whim.FloatingWindow/README.md @@ -1,3 +1,3 @@ -# Whim.FloatingLayout +# Whim.FloatingWindow A floating window still stays within its appropriate workspace. However, it can be moved freely. diff --git a/src/Whim.FloatingLayout/Whim.FloatingLayout.csproj b/src/Whim.FloatingWindow/Whim.FloatingWindow.csproj similarity index 92% rename from src/Whim.FloatingLayout/Whim.FloatingLayout.csproj rename to src/Whim.FloatingWindow/Whim.FloatingWindow.csproj index 0f31b100a..ac05294e8 100644 --- a/src/Whim.FloatingLayout/Whim.FloatingLayout.csproj +++ b/src/Whim.FloatingWindow/Whim.FloatingWindow.csproj @@ -23,12 +23,13 @@ win10-x64;win10-arm64 net7.0-windows10.0.19041.0 0.7.0 + Whim.FloatingWindow - + \ No newline at end of file diff --git a/src/Whim.Gaps.Tests/GapsLayoutEngineTests.cs b/src/Whim.Gaps.Tests/GapsLayoutEngineTests.cs index 065316aa3..1d3d208e1 100644 --- a/src/Whim.Gaps.Tests/GapsLayoutEngineTests.cs +++ b/src/Whim.Gaps.Tests/GapsLayoutEngineTests.cs @@ -1,6 +1,6 @@ using FluentAssertions; using NSubstitute; -using Whim.FloatingLayout; +using Whim.FloatingWindow; using Whim.TestUtils; using Xunit; @@ -414,7 +414,7 @@ IWindowState[] expectedWindowStates } [Theory, AutoSubstituteData] - public void DoLayout_WithFreeLayoutEngine(GapsConfig gapsConfig, IWindow window) + public void DoLayout_WithFloatingLayoutEngine(GapsConfig gapsConfig, IWindow window) { // Input Rectangle rect = new(0, 0, -300, -300); @@ -431,8 +431,8 @@ public void DoLayout_WithFreeLayoutEngine(GapsConfig gapsConfig, IWindow window) // Given ILayoutEngine innerLayoutEngine = Substitute.For(); innerLayoutEngine - .GetLayoutEngine() - .Returns(new FreeLayoutEngine(Substitute.For(), _identity)); + .GetLayoutEngine() + .Returns(new FloatingLayoutEngine(Substitute.For(), _identity)); innerLayoutEngine.DoLayout(rect, Arg.Any()).Returns(inputWindowStates); GapsLayoutEngine gapsLayoutEngine = new(gapsConfig, innerLayoutEngine); diff --git a/src/Whim.Gaps/GapsLayoutEngine.cs b/src/Whim.Gaps/GapsLayoutEngine.cs index de6ece156..ca1291c4a 100644 --- a/src/Whim.Gaps/GapsLayoutEngine.cs +++ b/src/Whim.Gaps/GapsLayoutEngine.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Whim.FloatingLayout; +using Whim.FloatingWindow; namespace Whim.Gaps; @@ -43,7 +43,7 @@ private GapsLayoutEngine UpdateInner(ILayoutEngine newInnerLayoutEngine) => /// public override IEnumerable DoLayout(IRectangle rectangle, IMonitor monitor) { - if (InnerLayoutEngine.GetLayoutEngine() is not null) + if (InnerLayoutEngine.GetLayoutEngine() is not null) { foreach (IWindowState windowState in InnerLayoutEngine.DoLayout(rectangle, monitor)) { diff --git a/src/Whim.Gaps/Whim.Gaps.csproj b/src/Whim.Gaps/Whim.Gaps.csproj index 5f2005f62..680d22893 100644 --- a/src/Whim.Gaps/Whim.Gaps.csproj +++ b/src/Whim.Gaps/Whim.Gaps.csproj @@ -26,6 +26,6 @@ - + \ No newline at end of file diff --git a/src/Whim.LayoutPreview.Tests/LayoutPreviewPluginTests.cs b/src/Whim.LayoutPreview.Tests/LayoutPreviewPluginTests.cs index 021e8ee4b..0752c51c7 100644 --- a/src/Whim.LayoutPreview.Tests/LayoutPreviewPluginTests.cs +++ b/src/Whim.LayoutPreview.Tests/LayoutPreviewPluginTests.cs @@ -3,7 +3,7 @@ using System.Text.Json; using AutoFixture; using NSubstitute; -using Whim.FloatingLayout; +using Whim.FloatingWindow; using Whim.TestUtils; using Windows.Win32.Graphics.Gdi; using Xunit; @@ -229,7 +229,7 @@ IMonitor monitor workspace = workspace with { LayoutEngines = ImmutableList.Empty.Add( - new FreeLayoutEngine(ctx, new LayoutEngineIdentity()) + new FloatingLayoutEngine(ctx, new LayoutEngineIdentity()) ), ActiveLayoutEngineIndex = 0 }; diff --git a/src/Whim.LayoutPreview/LayoutPreviewPlugin.cs b/src/Whim.LayoutPreview/LayoutPreviewPlugin.cs index ed632b14e..869b9c8dd 100644 --- a/src/Whim.LayoutPreview/LayoutPreviewPlugin.cs +++ b/src/Whim.LayoutPreview/LayoutPreviewPlugin.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using System.Text.Json; -using Whim.FloatingLayout; +using Whim.FloatingWindow; namespace Whim.LayoutPreview; @@ -85,10 +85,9 @@ e.CursorDraggedPoint is not IPoint cursorDraggedPoint IPoint normalizedPoint = monitor.WorkingArea.NormalizeAbsolutePoint(cursorDraggedPoint); ILayoutEngine layoutEngine = workspace.ActiveLayoutEngine.MoveWindowToPoint(e.Window, normalizedPoint); - if (layoutEngine.GetLayoutEngine() is not null) + if (layoutEngine.GetLayoutEngine() is not null) { - // To be renamed when FreeLayoutEngine will be renamed - Logger.Debug("Skip LayoutPreview as LeafLayoutEngine is a FreeLayoutEngine"); + Logger.Debug("Skip LayoutPreview as LeafLayoutEngine is a FloatingLayoutEngine"); Hide(); return; diff --git a/src/Whim.LayoutPreview/Whim.LayoutPreview.csproj b/src/Whim.LayoutPreview/Whim.LayoutPreview.csproj index 353266798..9abdbb139 100644 --- a/src/Whim.LayoutPreview/Whim.LayoutPreview.csproj +++ b/src/Whim.LayoutPreview/Whim.LayoutPreview.csproj @@ -42,7 +42,7 @@ - + diff --git a/src/Whim.Runner/Whim.Runner.csproj b/src/Whim.Runner/Whim.Runner.csproj index 8e50cff1f..24db83e0e 100644 --- a/src/Whim.Runner/Whim.Runner.csproj +++ b/src/Whim.Runner/Whim.Runner.csproj @@ -139,7 +139,7 @@ - + @@ -173,9 +173,9 @@ - - - + + + diff --git a/src/Whim/Layout/LayoutEngineCustomAction.cs b/src/Whim/Layout/LayoutEngineCustomAction.cs index e0d915617..4553c52f7 100644 --- a/src/Whim/Layout/LayoutEngineCustomAction.cs +++ b/src/Whim/Layout/LayoutEngineCustomAction.cs @@ -12,7 +12,7 @@ public record LayoutEngineCustomAction /// /// The window that triggered the action, if any. Proxy layout engines may use this for their - /// own purposes - for example, the FloatingLayoutEngine. + /// own purposes - for example, the ProxyFloatingLayoutEngine. /// /// This is deliberately set to required to force the specification of the triggering window, where possible. /// diff --git a/src/Whim/Template/whim.config.csx b/src/Whim/Template/whim.config.csx index f616c8949..8f45a2817 100644 --- a/src/Whim/Template/whim.config.csx +++ b/src/Whim/Template/whim.config.csx @@ -2,7 +2,7 @@ #r "WHIM_PATH\whim.dll" #r "WHIM_PATH\plugins\Whim.Bar\Whim.Bar.dll" #r "WHIM_PATH\plugins\Whim.CommandPalette\Whim.CommandPalette.dll" -#r "WHIM_PATH\plugins\Whim.FloatingLayout\Whim.FloatingLayout.dll" +#r "WHIM_PATH\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll" #r "WHIM_PATH\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll" #r "WHIM_PATH\plugins\Whim.Gaps\Whim.Gaps.dll" #r "WHIM_PATH\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll" @@ -19,7 +19,7 @@ using Microsoft.UI.Xaml.Media; using Whim; using Whim.Bar; using Whim.CommandPalette; -using Whim.FloatingLayout; +using Whim.FloatingWindow; using Whim.FocusIndicator; using Whim.Gaps; using Whim.LayoutPreview; @@ -59,8 +59,8 @@ void DoConfig(IContext context) context.PluginManager.AddPlugin(gapsPlugin); // Floating window plugin. - FloatingLayoutPlugin floatingLayoutPlugin = new(context); - context.PluginManager.AddPlugin(floatingLayoutPlugin); + FloatingWindowPlugin floatingWindowPlugin = new(context); + context.PluginManager.AddPlugin(floatingWindowPlugin); // Focus indicator. FocusIndicatorConfig focusIndicatorConfig = new() { Color = new SolidColorBrush(Colors.Red), FadeEnabled = true }; @@ -114,7 +114,7 @@ void DoConfig(IContext context) (id) => SliceLayouts.CreateSecondaryPrimaryLayout(context, sliceLayoutPlugin, id), (id) => new FocusLayoutEngine(id), (id) => new TreeLayoutEngine(context, treeLayoutPlugin, id), - (id) => new FreeLayoutEngine(context, id) + (id) => new FloatingLayoutEngine(context, id) }; } diff --git a/src/Whim/Whim.csproj b/src/Whim/Whim.csproj index dd2771c87..9c138a12a 100644 --- a/src/Whim/Whim.csproj +++ b/src/Whim/Whim.csproj @@ -50,7 +50,7 @@ - +