diff --git a/src/Whim.Bar/BarWindow.xaml.cs b/src/Whim.Bar/BarWindow.xaml.cs index c41a22e9a..2448fcfc2 100644 --- a/src/Whim.Bar/BarWindow.xaml.cs +++ b/src/Whim.Bar/BarWindow.xaml.cs @@ -35,7 +35,7 @@ public BarWindow(IConfigContext configContext, BarConfig barConfig, IMonitor mon x: _monitor.X + leftMargin, y: _monitor.Y + rightMargin, width: _monitor.Width - (leftMargin + rightMargin), - height: _barConfig.Height), WindowState.Normal); + height: _barConfig.Height), WindowSize.Normal); // Workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/3689 Title = "Whim Bar"; diff --git a/src/Whim.CommandPalette/CommandPaletteWindow.xaml.cs b/src/Whim.CommandPalette/CommandPaletteWindow.xaml.cs index d842f4aaf..c538648c8 100644 --- a/src/Whim.CommandPalette/CommandPaletteWindow.xaml.cs +++ b/src/Whim.CommandPalette/CommandPaletteWindow.xaml.cs @@ -108,7 +108,7 @@ public void Activate(IEnumerable<(ICommand, IKeybind?)>? items = null, IMonitor? base.Activate(); TextEntry.Focus(FocusState.Programmatic); Win32Helper.SetWindowPos( - new WindowLocation(_window, windowLocation, WindowState.Normal), + new WindowLocation(_window, windowLocation, WindowSize.Normal), _window.Handle ); _window.FocusForceForeground(); diff --git a/src/Whim.FloatingLayout/FloatingLayoutEngine.cs b/src/Whim.FloatingLayout/FloatingLayoutEngine.cs index 9d06893b4..b95a39d0a 100644 --- a/src/Whim.FloatingLayout/FloatingLayoutEngine.cs +++ b/src/Whim.FloatingLayout/FloatingLayoutEngine.cs @@ -20,7 +20,7 @@ public override IEnumerable DoLayout(ILocation location) // Iterate over all windows in _windowToLocation. foreach ((IWindow window, ILocation loc) in _windowToLocation) { - yield return new WindowLocation(window, location.ToMonitor(loc), WindowState.Normal); + yield return new WindowLocation(window, location.ToMonitor(loc), WindowSize.Normal); } // Iterate over all windows in the inner layout engine. diff --git a/src/Whim.FocusIndicator/FocusIndicatorWindow.xaml.cs b/src/Whim.FocusIndicator/FocusIndicatorWindow.xaml.cs index 394caf1fe..b13ae03ee 100644 --- a/src/Whim.FocusIndicator/FocusIndicatorWindow.xaml.cs +++ b/src/Whim.FocusIndicator/FocusIndicatorWindow.xaml.cs @@ -33,7 +33,7 @@ public void Activate(IWindowLocation windowLocation) ); Win32Helper.SetWindowPos( - new WindowLocation(_window, borderLocation, WindowState.Normal), + new WindowLocation(_window, borderLocation, WindowSize.Normal), windowLocation.Window.Handle ); } diff --git a/src/Whim.TreeLayout.Tests/TestTreeWindowLocations.cs b/src/Whim.TreeLayout.Tests/TestTreeWindowLocations.cs index 07e4f1ad5..81dd5b8d9 100644 --- a/src/Whim.TreeLayout.Tests/TestTreeWindowLocations.cs +++ b/src/Whim.TreeLayout.Tests/TestTreeWindowLocations.cs @@ -40,15 +40,15 @@ public static IWindowLocation[] GetAllWindowLocations(ILocation screen, IWi { return new IWindowLocation[] { - new WindowLocation(leftWindow, Left.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopLeftTopWindow, RightTopLeftTop.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopLeftBottomLeftWindow, RightTopLeftBottomLeft.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopLeftBottomRightTopWindow, RightTopLeftBottomRightTop.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopLeftBottomRightBottomWindow, RightTopLeftBottomRightBottom.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopRight1Window, RightTopRight1.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopRight2Window, RightTopRight2.Scale(screen), WindowState.Normal), - new WindowLocation(rightTopRight3Window, RightTopRight3.Scale(screen), WindowState.Normal), - new WindowLocation(rightBottomWindow, RightBottom.Scale(screen), WindowState.Normal) + new WindowLocation(leftWindow, Left.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopLeftTopWindow, RightTopLeftTop.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopLeftBottomLeftWindow, RightTopLeftBottomLeft.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopLeftBottomRightTopWindow, RightTopLeftBottomRightTop.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopLeftBottomRightBottomWindow, RightTopLeftBottomRightBottom.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopRight1Window, RightTopRight1.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopRight2Window, RightTopRight2.Scale(screen), WindowSize.Normal), + new WindowLocation(rightTopRight3Window, RightTopRight3.Scale(screen), WindowSize.Normal), + new WindowLocation(rightBottomWindow, RightBottom.Scale(screen), WindowSize.Normal) }; } } diff --git a/src/Whim.TreeLayout/TreeLayoutEngineGetWindowLocations.cs b/src/Whim.TreeLayout/TreeLayoutEngineGetWindowLocations.cs index 15539904f..26ab7732f 100644 --- a/src/Whim.TreeLayout/TreeLayoutEngineGetWindowLocations.cs +++ b/src/Whim.TreeLayout/TreeLayoutEngineGetWindowLocations.cs @@ -9,9 +9,9 @@ public class TreeLayoutWindowLocation public ILocation Location { get; } - public WindowState WindowState { get; } + public WindowSize WindowState { get; } - public TreeLayoutWindowLocation(Node node, ILocation location, WindowState windowState) + public TreeLayoutWindowLocation(Node node, ILocation location, WindowSize windowState) { this.Node = node; Location = location; @@ -33,7 +33,7 @@ public static IEnumerable GetWindowLocations(Node node if (node is LeafNode) { yield return new TreeLayoutWindowLocation( - node, location, WindowState.Normal + node, location, WindowSize.Normal ); yield break; diff --git a/src/Whim/Layout/ColumnLayoutEngine.cs b/src/Whim/Layout/ColumnLayoutEngine.cs index 625431ca5..1a887b29c 100644 --- a/src/Whim/Layout/ColumnLayoutEngine.cs +++ b/src/Whim/Layout/ColumnLayoutEngine.cs @@ -45,7 +45,7 @@ public override IEnumerable DoLayout(ILocation location) { yield return new WindowLocation(window, new Location(x, y, width, height), - WindowState.Normal); + WindowSize.Normal); if (LeftToRight) { diff --git a/src/Whim/Native/Win32Helper.cs b/src/Whim/Native/Win32Helper.cs index 12fffa09e..2c76e4a1d 100644 --- a/src/Whim/Native/Win32Helper.cs +++ b/src/Whim/Native/Win32Helper.cs @@ -294,7 +294,7 @@ public static void SetWindowPos(IWindowLocation windowLocation, HWND? hwndInsert ILocation offset = GetWindowOffset(window.Handle); ILocation location = Location.Add(windowLocation.Location, offset); - WindowState windowState = windowLocation.WindowState; + WindowSize windowState = windowLocation.WindowState; SET_WINDOW_POS_FLAGS flags = SET_WINDOW_POS_FLAGS.SWP_FRAMECHANGED | SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE @@ -302,7 +302,7 @@ public static void SetWindowPos(IWindowLocation windowLocation, HWND? hwndInsert | SET_WINDOW_POS_FLAGS.SWP_NOZORDER | SET_WINDOW_POS_FLAGS.SWP_NOOWNERZORDER; - if (windowState == WindowState.Maximized || windowState == WindowState.Minimized) + if (windowState == WindowSize.Maximized || windowState == WindowSize.Minimized) { flags = flags | SET_WINDOW_POS_FLAGS.SWP_NOMOVE | SET_WINDOW_POS_FLAGS.SWP_NOSIZE; } @@ -316,14 +316,14 @@ public static void SetWindowPos(IWindowLocation windowLocation, HWND? hwndInsert location.Height, flags); - if (windowState == WindowState.Maximized) + if (windowState == WindowSize.Maximized) { if (!window.IsMinimized) { MinimizeWindow(window.Handle); } } - else if (windowState == WindowState.Minimized) + else if (windowState == WindowSize.Minimized) { if (!window.IsMaximized) { diff --git a/src/Whim/Window/IWindowLocation.cs b/src/Whim/Window/IWindowLocation.cs index bf14f4975..41d1a941a 100644 --- a/src/Whim/Window/IWindowLocation.cs +++ b/src/Whim/Window/IWindowLocation.cs @@ -10,7 +10,7 @@ public interface IWindowLocation /// /// The state of the window. /// - public WindowState WindowState { get; set; } + public WindowSize WindowState { get; set; } /// /// The window in question. diff --git a/src/Whim/Window/WindowLocation.cs b/src/Whim/Window/WindowLocation.cs index bcc19a6e3..08ddc26ad 100644 --- a/src/Whim/Window/WindowLocation.cs +++ b/src/Whim/Window/WindowLocation.cs @@ -6,11 +6,11 @@ public class WindowLocation : IWindowLocation { public ILocation Location { get; set; } - public WindowState WindowState { get; set; } + public WindowSize WindowState { get; set; } public IWindow Window { get; } - public WindowLocation(IWindow window, ILocation location, WindowState windowState) + public WindowLocation(IWindow window, ILocation location, WindowSize windowState) { Window = window; Location = location; diff --git a/src/Whim/Window/WindowSize.cs b/src/Whim/Window/WindowSize.cs new file mode 100644 index 000000000..9e20a8641 --- /dev/null +++ b/src/Whim/Window/WindowSize.cs @@ -0,0 +1,22 @@ +namespace Whim; + +/// +/// The size of a window. +/// +public enum WindowSize +{ + /// + /// The window is in its normal state. + /// + Normal, + + /// + /// The window is minimized. + /// + Minimized, + + /// + /// The window is maximized. + /// + Maximized, +} diff --git a/src/Whim/Window/WindowState.cs b/src/Whim/Window/WindowState.cs deleted file mode 100644 index 577394214..000000000 --- a/src/Whim/Window/WindowState.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Whim; - -public enum WindowState -{ - Normal, - Minimized, - Maximized, -}