Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat(domain): remove `SizePercentage` from `Container` base class; add property to tiling container types

Lars Berger84f8c402c361
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index cca1cc71..b435532d 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -10,7 +10,6 @@ namespace GlazeWM.Domain.Containers
public virtual int Width { get; set; }
public virtual int X { get; set; }
public virtual int Y { get; set; }
- public double SizePercentage { get; set; } = 1;
public Container Parent { get; set; } = null;
public List<Container> Children { get; set; } = new List<Container>();
diff --git a/GlazeWM.Domain/Containers/SplitContainer.cs b/GlazeWM.Domain/Containers/SplitContainer.cs
index 2b2fadb1..17fb46d4 100644
--- a/GlazeWM.Domain/Containers/SplitContainer.cs
+++ b/GlazeWM.Domain/Containers/SplitContainer.cs
@@ -4,10 +4,14 @@ using Microsoft.Extensions.DependencyInjection;
namespace GlazeWM.Domain.Containers
{
- public class SplitContainer : Container
+ public class SplitContainer : Container, IResizable
{
public Layout Layout { get; set; } = Layout.HORIZONTAL;
+ public double SizePercentage { get; set; } = 1;
+
+ private ContainerService _containerService = ServiceLocator.Provider.GetRequiredService<ContainerService>();
+
public override int Width => _containerService.CalculateWidthOfResizableContainer(this);
public override int Height => _containerService.CalculateHeightOfResizableContainer(this);
@@ -15,7 +19,5 @@ namespace GlazeWM.Domain.Containers
public override int X => _containerService.CalculateXOfResizableContainer(this);
public override int Y => _containerService.CalculateYOfResizableContainer(this);
-
- private ContainerService _containerService = ServiceLocator.Provider.GetRequiredService<ContainerService>();
}
}
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs
index 54263938..0cf1efe9 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs
@@ -28,7 +28,6 @@ namespace GlazeWM.Domain.Windows.EventHandlers
return;
// TODO: Create `MinimizedWindow` instance.
- window.SizePercentage = 1;
_containerService.SplitContainersToRedraw.Add(window.Parent as SplitContainer);
_bus.Invoke(new RedrawContainersCommand());
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs
index 6b46a3cd..9ee49c31 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs
@@ -28,7 +28,6 @@ namespace GlazeWM.Domain.Windows.EventHandlers
return;
// TODO: Create `MinimizedWindow` instance.
- window.SizePercentage = 0;
_containerService.SplitContainersToRedraw.Add(window.Parent as SplitContainer);
_bus.Invoke(new RedrawContainersCommand());
diff --git a/GlazeWM.Domain/Windows/TilingWindow.cs b/GlazeWM.Domain/Windows/TilingWindow.cs
index 5f4fedcd..5c4eb2e6 100644
--- a/GlazeWM.Domain/Windows/TilingWindow.cs
+++ b/GlazeWM.Domain/Windows/TilingWindow.cs
@@ -5,8 +5,10 @@ using Microsoft.Extensions.DependencyInjection;
namespace GlazeWM.Domain.Windows
{
- public sealed class TilingWindow : Window
+ public sealed class TilingWindow : Window, IResizable
{
+ public double SizePercentage { get; set; } = 1;
+
private ContainerService _containerService = ServiceLocator.Provider.GetRequiredService<ContainerService>();
public TilingWindow(IntPtr hwnd) : base(hwnd)