Skip to content

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

style: run style fixes & correct ruleset warnings (#213)

lars-berger308a8ce21eae
diff --git a/.editorconfig b/.editorconfig
index dd2200bd..a7c8feb1 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -182,17 +182,16 @@ dotnet_diagnostic.RCS1135.severity = none
# clarity when a variable is guaranteed to be defined.
dotnet_diagnostic.RCS1202.severity = none
-# TODO: Temporarily disabled rules until upcoming refactors:
+# TODO: Temporarily disabled.
# Disable rule "P/Invoke methods should not be visible".
dotnet_diagnostic.CA1401.severity = none
+# TODO: Temporarily disabled.
# Disable rule "Duplicate enum value".
dotnet_diagnostic.RCS1234.severity = none
dotnet_diagnostic.CA1069.severity = none
-# Disable rule "Identifiers should not contain underscores".
-dotnet_diagnostic.CA1707.severity = none
-
+# TODO: Temporarily disabled.
# Disable rule "Enum should declare explicit values".
dotnet_diagnostic.RCS1161.severity = none
@@ -208,6 +207,16 @@ dotnet_diagnostic.CA1711.severity = none
# Disable rule "Identifiers should not match keywords".
dotnet_diagnostic.CA1716.severity = none
+# Disable rule "Use the LoggerMessage delegates".
+dotnet_diagnostic.CA1848.severity = none
+
+# TODO: Temporarily disabled.
+# Disable rule "Avoid 'StringBuilder' parameters for P/Invokes".
+dotnet_diagnostic.CA1838.severity = none
+
# Add rule exception "Types that own disposable fields should be disposable".
[**/Bus.cs]
dotnet_diagnostic.CA1001.severity = none
+
+[**/*.xaml.cs]
+dotnet_diagnostic.RCS1043.severity = none
diff --git a/.gitignore b/.gitignore
index 6d9dadb2..d65bb0df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-## Ignore Visual Studio temporary files, build results, and
+## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
diff --git a/GlazeWM.Bar/BarService.cs b/GlazeWM.Bar/BarService.cs
index f1142b48..205e7ab1 100644
--- a/GlazeWM.Bar/BarService.cs
+++ b/GlazeWM.Bar/BarService.cs
@@ -1,14 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reactive.Linq;
+using System.Threading;
+using System.Windows;
using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.Monitors.Events;
using GlazeWM.Domain.UserConfigs.Events;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.Commands;
-using System.Reactive.Linq;
-using System;
-using System.Threading;
-using System.Linq;
-using System.Windows;
-using System.Collections.Generic;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Bar
diff --git a/GlazeWM.Bar/BarViewModel.cs b/GlazeWM.Bar/BarViewModel.cs
index 6b6253ed..a05d105f 100644
--- a/GlazeWM.Bar/BarViewModel.cs
+++ b/GlazeWM.Bar/BarViewModel.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Windows.Threading;
using GlazeWM.Bar.Common;
diff --git a/GlazeWM.Bar/Components/BatteryComponent.xaml b/GlazeWM.Bar/Components/BatteryComponent.xaml
index afee2a5d..3b5f0d81 100644
--- a/GlazeWM.Bar/Components/BatteryComponent.xaml
+++ b/GlazeWM.Bar/Components/BatteryComponent.xaml
@@ -1,4 +1,4 @@
-<UserControl
+<UserControl
x:Class="GlazeWM.Bar.Components.BatteryComponent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GlazeWM.Bar.Components"
mc:Ignorable="d">
- <TextBlock
+ <TextBlock
VerticalAlignment="Center"
Foreground="{Binding Foreground}"
FontFamily="{Binding FontFamily}"
diff --git a/GlazeWM.Bar/Components/BatteryComponent.xaml.cs b/GlazeWM.Bar/Components/BatteryComponent.xaml.cs
index 14f94f65..a10412b2 100644
--- a/GlazeWM.Bar/Components/BatteryComponent.xaml.cs
+++ b/GlazeWM.Bar/Components/BatteryComponent.xaml.cs
@@ -1,4 +1,4 @@
-using System.Windows.Controls;
+using System.Windows.Controls;
namespace GlazeWM.Bar.Components
{
diff --git a/GlazeWM.Bar/Components/BatteryComponentViewModel.cs b/GlazeWM.Bar/Components/BatteryComponentViewModel.cs
index c6b40925..6d74297e 100644
--- a/GlazeWM.Bar/Components/BatteryComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/BatteryComponentViewModel.cs
@@ -1,4 +1,5 @@
-using System;
+using System;
+using System.Globalization;
using System.Reactive.Linq;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Infrastructure.WindowsApi;
@@ -7,7 +8,6 @@ namespace GlazeWM.Bar.Components
{
public class BatteryComponentViewModel : ComponentViewModel
{
-
private readonly BatteryComponentConfig _batteryComponentConfig;
/// <summary>
@@ -17,8 +17,8 @@ namespace GlazeWM.Bar.Components
private string FormatLabel()
{
- WindowsApiService.GetSystemPowerStatus(out WindowsApiService.SYSTEM_POWER_STATUS ps);
- var batteryLevel = ps.BatteryLifePercent.ToString();
+ WindowsApiService.GetSystemPowerStatus(out var ps);
+ var batteryLevel = ps.BatteryLifePercent.ToString(CultureInfo.InvariantCulture);
// display the battery level as a 100% if no dedicated battery is available on the device
if (ps.BatteryFlag == 128)
@@ -50,5 +50,4 @@ namespace GlazeWM.Bar.Components
.Subscribe(_ => OnPropertyChanged(nameof(FormattedPowerStatus)));
}
}
-
}
diff --git a/GlazeWM.Bar/Components/BindingModeComponentViewModel.cs b/GlazeWM.Bar/Components/BindingModeComponentViewModel.cs
index ced8d041..d2998e76 100644
--- a/GlazeWM.Bar/Components/BindingModeComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/BindingModeComponentViewModel.cs
@@ -1,8 +1,8 @@
using System;
using System.Reactive.Linq;
using System.Windows.Threading;
+using GlazeWM.Domain.Common.Events;
using GlazeWM.Domain.Containers;
-using GlazeWM.Domain.Monitors.Events;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Infrastructure;
using GlazeWM.Infrastructure.Bussing;
diff --git a/GlazeWM.Bar/Components/ClockComponentViewModel.cs b/GlazeWM.Bar/Components/ClockComponentViewModel.cs
index 5dc149b2..05b2bcae 100644
--- a/GlazeWM.Bar/Components/ClockComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/ClockComponentViewModel.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Globalization;
using System.Reactive.Linq;
using System.Text;
@@ -9,18 +9,17 @@ namespace GlazeWM.Bar.Components
public class ClockComponentViewModel : ComponentViewModel
{
private ClockComponentConfig _config => _componentConfig as ClockComponentConfig;
- private string _timeFormatting => formatCalendarWeek(_config.TimeFormatting);
+ private string _timeFormatting => FormatCalendarWeek(_config.TimeFormatting);
/// <summary>
/// Format the current time with the user's formatting config.
/// </summary>
public string FormattedTime => DateTime.Now.ToString(_timeFormatting, CultureInfo.InvariantCulture);
-
- private String formatCalendarWeek(string timeFormat)
+ private static string FormatCalendarWeek(string timeFormat)
{
-
- if (!timeFormat.Contains('w')) return timeFormat;
+ if (!timeFormat.Contains('w'))
+ return timeFormat;
var now = DateTime.Now;
var i = 0;
@@ -32,32 +31,30 @@ namespace GlazeWM.Bar.Components
switch (timeFormat[i])
{
case '\\':
- {
- result.Append(timeFormat[i]);
- result.Append(nextChar);
- i = i + 2;
- break;
- }
+ result.Append(timeFormat[i])
+ .Append(nextChar);
+ i += 2;
+ break;
+
case 'w':
+ if (nextChar.Equals("w", StringComparison.Ordinal))
{
- if (nextChar.Equals("w"))
- {
- i = i + 2;
- result.Append(ISOWeek.GetWeekOfYear(now).ToString("00"));
- }
- else
- {
- i++;
- result.Append(ISOWeek.GetWeekOfYear(now).ToString());
- }
- break;
+ i += 2;
+ result.Append(
+ ISOWeek.GetWeekOfYear(now).ToString("00", CultureInfo.InvariantCulture)
+ );
}
- default:
+ else
{
- result.Append(timeFormat[i]);
i++;
- break;
+ result.Append(ISOWeek.GetWeekOfYear(now));
}
+ break;
+
+ default:
+ result.Append(timeFormat[i]);
+ i++;
+ break;
}
}
return result.ToString();
diff --git a/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs b/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs
index dd6f93a7..25b4376d 100644
--- a/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs
@@ -31,7 +31,7 @@ namespace GlazeWM.Bar.Components
(_containerService.FocusedContainer.Parent as SplitContainer)?.Layout;
public string TilingDirectionString =>
- _tilingDirection == Layout.VERTICAL ? TextVertical : TextHorizontal;
+ _tilingDirection == Layout.Vertical ? TextVertical : TextHorizontal;
public TilingDirectionComponentViewModel(
BarViewModel parentViewModel,
diff --git a/GlazeWM.Bar/Components/WindowTitleComponentViewModel.cs b/GlazeWM.Bar/Components/WindowTitleComponentViewModel.cs
index 6f4a473e..dd387f1e 100644
--- a/GlazeWM.Bar/Components/WindowTitleComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/WindowTitleComponentViewModel.cs
@@ -30,7 +30,7 @@ namespace GlazeWM.Bar.Components
BarViewModel parentViewModel,
WindowTitleComponentConfig config) : base(parentViewModel, config)
{
- Action<IntPtr> processTitleChange = (windowHdl) =>
+ void processTitleChange(IntPtr windowHdl)
{
var focusedWindow = _containerService.FocusedContainer as Window;
@@ -38,7 +38,7 @@ namespace GlazeWM.Bar.Components
return;
FocusedWindowTitle = focusedWindow?.Title ?? string.Empty;
- };
+ }
_bus.Events.Where(
(@event) => @event is WindowFocusedEvent or WindowTitleChangedEvent
diff --git a/GlazeWM.Bar/DependencyInjection.cs b/GlazeWM.Bar/DependencyInjection.cs
index 5e693fb4..d69bb194 100644
--- a/GlazeWM.Bar/DependencyInjection.cs
+++ b/GlazeWM.Bar/DependencyInjection.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection;
namespace GlazeWM.Bar
{
diff --git a/GlazeWM.Bar/GlazeWM.Bar.csproj b/GlazeWM.Bar/GlazeWM.Bar.csproj
index 55f02be0..cf12d9f6 100644
--- a/GlazeWM.Bar/GlazeWM.Bar.csproj
+++ b/GlazeWM.Bar/GlazeWM.Bar.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
diff --git a/GlazeWM.Bar/MainWindow.xaml b/GlazeWM.Bar/MainWindow.xaml
index e477c416..55966426 100644
--- a/GlazeWM.Bar/MainWindow.xaml
+++ b/GlazeWM.Bar/MainWindow.xaml
@@ -1,4 +1,4 @@
-<Window
+<Window
x:Class="GlazeWM.Bar.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
diff --git a/GlazeWM.Bar/MainWindow.xaml.cs b/GlazeWM.Bar/MainWindow.xaml.cs
index 1af1acdf..7b9e879d 100644
--- a/GlazeWM.Bar/MainWindow.xaml.cs
+++ b/GlazeWM.Bar/MainWindow.xaml.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Interop;
@@ -52,9 +52,9 @@ namespace GlazeWM.Bar
/// </summary>
private static void HideFromTaskSwitcher(IntPtr windowHandle)
{
- var exstyle = (int)GetWindowLongPtr(windowHandle, GWL_EXSTYLE);
- exstyle |= (int)WS_EX.WS_EX_TOOLWINDOW;
- SetWindowLongPtr(windowHandle, GWL_EXSTYLE, (IntPtr)exstyle);
+ var exstyle = (int)GetWindowLongPtr(windowHandle, GWLEXSTYLE);
+ exstyle |= (int)WindowStylesEx.ToolWindow;
+ SetWindowLongPtr(windowHandle, GWLEXSTYLE, (IntPtr)exstyle);
}
/// <summary>
diff --git a/GlazeWM.Bar/XamlHelper.cs b/GlazeWM.Bar/XamlHelper.cs
index 2f6570c0..fe90be4c 100644
--- a/GlazeWM.Bar/XamlHelper.cs
+++ b/GlazeWM.Bar/XamlHelper.cs
@@ -22,7 +22,7 @@ namespace GlazeWM.Bar
/// </summary>
public static string FormatColor(string color)
{
- var isHexColor = color.StartsWith("#");
+ var isHexColor = color.StartsWith("#", StringComparison.InvariantCulture);
if (!isHexColor)
return color;
diff --git a/GlazeWM.Bootstrapper/GlazeWM.Bootstrapper.csproj b/GlazeWM.Bootstrapper/GlazeWM.Bootstrapper.csproj
index ac74e84d..aa57abf6 100644
--- a/GlazeWM.Bootstrapper/GlazeWM.Bootstrapper.csproj
+++ b/GlazeWM.Bootstrapper/GlazeWM.Bootstrapper.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
diff --git a/GlazeWM.Bootstrapper/Program.cs b/GlazeWM.Bootstrapper/Program.cs
index 4c35bab0..45020cb7 100644
--- a/GlazeWM.Bootstrapper/Program.cs
+++ b/GlazeWM.Bootstrapper/Program.cs
@@ -1,3 +1,9 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Text.Json.Serialization;
+using System.Threading;
using GlazeWM.Bar;
using GlazeWM.Domain;
using GlazeWM.Domain.Containers;
@@ -5,17 +11,11 @@ using GlazeWM.Infrastructure;
using GlazeWM.Infrastructure.Exceptions;
using GlazeWM.Infrastructure.Logging;
using GlazeWM.Infrastructure.Serialization;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Text.Json.Serialization;
-using System.Threading;
-using Microsoft.Extensions.Configuration;
namespace GlazeWM.Bootstrapper
{
diff --git a/GlazeWM.Bootstrapper/Startup.cs b/GlazeWM.Bootstrapper/Startup.cs
index 9491f39e..e604b51a 100644
--- a/GlazeWM.Bootstrapper/Startup.cs
+++ b/GlazeWM.Bootstrapper/Startup.cs
@@ -1,3 +1,8 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reactive.Linq;
+using System.Windows.Forms;
using GlazeWM.Bar;
using GlazeWM.Domain.Common.Commands;
using GlazeWM.Domain.UserConfigs.Commands;
@@ -6,16 +11,11 @@ using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.Commands;
using GlazeWM.Infrastructure.Common.Events;
using GlazeWM.Infrastructure.WindowsApi;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Linq;
-using System.Windows.Forms;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Bootstrapper
{
- internal class Startup
+ internal sealed class Startup
{
private readonly BarService _barService;
private readonly Bus _bus;
@@ -44,7 +44,7 @@ namespace GlazeWM.Bootstrapper
try
{
// Set the process-default DPI awareness.
- _ = SetProcessDpiAwarenessContext(DpiAwarenessContext.Context_PerMonitorAwareV2);
+ _ = SetProcessDpiAwarenessContext(DpiAwarenessContext.PerMonitorAwareV2);
_bus.Events.OfType<ApplicationExitingEvent>()
.Subscribe(_ => OnApplicationExit());
diff --git a/GlazeWM.Domain/Common/CommandHandlers/ExecProcessHandler.cs b/GlazeWM.Domain/Common/CommandHandlers/ExecProcessHandler.cs
index cdb34963..787cd288 100644
--- a/GlazeWM.Domain/Common/CommandHandlers/ExecProcessHandler.cs
+++ b/GlazeWM.Domain/Common/CommandHandlers/ExecProcessHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Diagnostics;
using System.Windows.Forms;
using GlazeWM.Domain.Common.Commands;
diff --git a/GlazeWM.Domain/Common/CommandHandlers/PopulateInitialStateHandler.cs b/GlazeWM.Domain/Common/CommandHandlers/PopulateInitialStateHandler.cs
index 8b1ec26e..3b32f5ee 100644
--- a/GlazeWM.Domain/Common/CommandHandlers/PopulateInitialStateHandler.cs
+++ b/GlazeWM.Domain/Common/CommandHandlers/PopulateInitialStateHandler.cs
@@ -14,7 +14,7 @@ using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Common.CommandHandlers
{
- internal class PopulateInitialStateHandler : ICommandHandler<PopulateInitialStateCommand>
+ internal sealed class PopulateInitialStateHandler : ICommandHandler<PopulateInitialStateCommand>
{
private readonly Bus _bus;
private readonly MonitorService _monitorService;
diff --git a/GlazeWM.Domain/Common/CommandHandlers/SetBindingModeHandler.cs b/GlazeWM.Domain/Common/CommandHandlers/SetBindingModeHandler.cs
index 3bbade21..ecaff6af 100644
--- a/GlazeWM.Domain/Common/CommandHandlers/SetBindingModeHandler.cs
+++ b/GlazeWM.Domain/Common/CommandHandlers/SetBindingModeHandler.cs
@@ -1,6 +1,6 @@
-using GlazeWM.Domain.Common.Commands;
+using GlazeWM.Domain.Common.Commands;
+using GlazeWM.Domain.Common.Events;
using GlazeWM.Domain.Containers;
-using GlazeWM.Domain.Monitors.Events;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.UserConfigs.Commands;
using GlazeWM.Infrastructure.Bussing;
diff --git a/GlazeWM.Domain/Common/Commands/ExecProcessCommand.cs b/GlazeWM.Domain/Common/Commands/ExecProcessCommand.cs
index 101a5002..4ac16959 100644
--- a/GlazeWM.Domain/Common/Commands/ExecProcessCommand.cs
+++ b/GlazeWM.Domain/Common/Commands/ExecProcessCommand.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Common.Commands
diff --git a/GlazeWM.Domain/Common/Enums/Direction.cs b/GlazeWM.Domain/Common/Enums/Direction.cs
index 50d316bf..4faf023b 100644
--- a/GlazeWM.Domain/Common/Enums/Direction.cs
+++ b/GlazeWM.Domain/Common/Enums/Direction.cs
@@ -1,13 +1,13 @@
-using System;
+using System;
namespace GlazeWM.Domain.Common.Enums
{
public enum Direction
{
- UP,
- DOWN,
- LEFT,
- RIGHT,
+ Up,
+ Down,
+ Left,
+ Right,
}
public static class DirectionExtensions
@@ -20,10 +20,10 @@ namespace GlazeWM.Domain.Common.Enums
{
return direction switch
{
- Direction.UP => Direction.DOWN,
- Direction.DOWN => Direction.UP,
- Direction.LEFT => Direction.RIGHT,
- Direction.RIGHT => Direction.LEFT,
+ Direction.Up => Direction.Down,
+ Direction.Down => Direction.Up,
+ Direction.Left => Direction.Right,
+ Direction.Right => Direction.Left,
_ => throw new ArgumentOutOfRangeException(nameof(direction)),
};
}
@@ -34,9 +34,9 @@ namespace GlazeWM.Domain.Common.Enums
/// </summary>
public static Layout GetCorrespondingLayout(this Direction direction)
{
- return (direction is Direction.LEFT or Direction.RIGHT)
- ? Layout.HORIZONTAL
- : Layout.VERTICAL;
+ return (direction is Direction.Left or Direction.Right)
+ ? Layout.Horizontal
+ : Layout.Vertical;
}
}
}
diff --git a/GlazeWM.Domain/Common/Enums/FocusMode.cs b/GlazeWM.Domain/Common/Enums/FocusMode.cs
index 3b9e9d94..528f17f7 100644
--- a/GlazeWM.Domain/Common/Enums/FocusMode.cs
+++ b/GlazeWM.Domain/Common/Enums/FocusMode.cs
@@ -1,8 +1,8 @@
-namespace GlazeWM.Domain.Common.Enums
+namespace GlazeWM.Domain.Common.Enums
{
public enum FocusMode
{
- TILING,
- FLOATING,
+ Tiling,
+ Floating,
}
}
diff --git a/GlazeWM.Domain/Common/Enums/Layout.cs b/GlazeWM.Domain/Common/Enums/Layout.cs
index 48beab21..d14aa90a 100644
--- a/GlazeWM.Domain/Common/Enums/Layout.cs
+++ b/GlazeWM.Domain/Common/Enums/Layout.cs
@@ -1,8 +1,8 @@
-namespace GlazeWM.Domain.Common.Enums
+namespace GlazeWM.Domain.Common.Enums
{
public enum Layout
{
- VERTICAL,
- HORIZONTAL,
+ Vertical,
+ Horizontal,
}
}
diff --git a/GlazeWM.Domain/Common/Enums/ResizeDimension.cs b/GlazeWM.Domain/Common/Enums/ResizeDimension.cs
index c80e45c9..0fae62eb 100644
--- a/GlazeWM.Domain/Common/Enums/ResizeDimension.cs
+++ b/GlazeWM.Domain/Common/Enums/ResizeDimension.cs
@@ -1,8 +1,8 @@
-namespace GlazeWM.Domain.Common.Enums
+namespace GlazeWM.Domain.Common.Enums
{
public enum ResizeDimension
{
- WIDTH,
- HEIGHT,
+ Width,
+ Height,
}
}
diff --git a/GlazeWM.Domain/Common/Enums/Sequence.cs b/GlazeWM.Domain/Common/Enums/Sequence.cs
index 8733ea76..ea29af0d 100644
--- a/GlazeWM.Domain/Common/Enums/Sequence.cs
+++ b/GlazeWM.Domain/Common/Enums/Sequence.cs
@@ -1,11 +1,11 @@
-namespace GlazeWM.Domain.Common.Enums
+namespace GlazeWM.Domain.Common.Enums
{
/// <summary>
/// Used to represent a given order (eg. previous/next workspace).
/// </summary>
public enum Sequence
{
- PREVIOUS,
- NEXT
+ Previous,
+ Next
}
}
diff --git a/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs b/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs
index 2e6b2e94..82b5a4ee 100644
--- a/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs
+++ b/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs
@@ -1,6 +1,6 @@
using GlazeWM.Infrastructure.Bussing;
-namespace GlazeWM.Domain.Monitors.Events
+namespace GlazeWM.Domain.Common.Events
{
public class BindingModeChangedEvent : Event
{
diff --git a/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs b/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs
index 8c7c9f76..c1fa696f 100644
--- a/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs
+++ b/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Windows;
+using GlazeWM.Domain.Windows;
using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Common.Utils
@@ -8,10 +8,14 @@ namespace GlazeWM.Domain.Common.Utils
/// <summary>
/// Extension method for consistently formatting window event logs.
/// </summary>
- public static void LogWindowEvent<T>(this ILogger<T> logger, string message, Window window)
+ public static void LogWindowEvent<T>(
+ this ILogger<T> logger,
+ string message,
+ Window window)
{
logger.LogDebug(
- $"{message}: {{processName}} {{className}}",
+ "{Message}: {ProcessName} {ClassName}",
+ message,
window.ProcessName,
window.ClassName
);
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs
index 93a1a9fd..649968dd 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs
@@ -5,7 +5,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class AttachAndResizeContainerHandler : ICommandHandler<AttachAndResizeContainerCommand>
+ internal sealed class AttachAndResizeContainerHandler : ICommandHandler<AttachAndResizeContainerCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs
index 3343f587..bfd2b855 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs
@@ -1,10 +1,10 @@
-using System;
+using System;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class AttachContainerHandler : ICommandHandler<AttachContainerCommand>
+ internal sealed class AttachContainerHandler : ICommandHandler<AttachContainerCommand>
{
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnRectHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnRectHandler.cs
index e672a1cf..054b2a9a 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnRectHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnRectHandler.cs
@@ -1,13 +1,11 @@
-using GlazeWM.Domain.Containers.Commands;
+using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.UserConfigs;
-
using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Infrastructure.WindowsApi;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class CenterCursorOnRectHandler : ICommandHandler<CenterCursorOnRectCommand>
+ internal sealed class CenterCursorOnRectHandler : ICommandHandler<CenterCursorOnRectCommand>
{
private readonly UserConfigService _userConfigService;
@@ -18,16 +16,19 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
public CommandResponse Handle(CenterCursorOnRectCommand command)
{
- var enabled = _userConfigService.GeneralConfig.CursorFollowsFocus;
- if (!enabled)
+ var isEnabled = _userConfigService.GeneralConfig.CursorFollowsFocus;
+
+ if (!isEnabled)
return CommandResponse.Ok;
- Rect TargetRect = command.TargetRect;
+ var targetRect = command.TargetRect;
+
+ // Calculate center point of focused window.
+ var centerX = targetRect.X + (targetRect.Width / 2);
+ var centerY = targetRect.Y + (targetRect.Height / 2);
- // Calculate center point of focused window
- var centerX = TargetRect.X + (TargetRect.Width / 2);
- var centerY = TargetRect.Y + (TargetRect.Height / 2);
SetCursorPos(centerX, centerY);
+
return CommandResponse.Ok;
}
}
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs
index 7e55f4ce..0e7526f1 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Containers.Events;
@@ -8,7 +8,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class ChangeContainerLayoutHandler : ICommandHandler<ChangeContainerLayoutCommand>
+ internal sealed class ChangeContainerLayoutHandler : ICommandHandler<ChangeContainerLayoutCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs
index 7cead51a..88c5eb37 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Workspaces;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class DetachAndResizeContainerHandler : ICommandHandler<DetachAndResizeContainerCommand>
+ internal sealed class DetachAndResizeContainerHandler : ICommandHandler<DetachAndResizeContainerCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs
index b14e34bb..26960cc2 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs
@@ -1,11 +1,11 @@
-using System;
+using System;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Workspaces;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class DetachContainerHandler : ICommandHandler<DetachContainerCommand>
+ internal sealed class DetachContainerHandler : ICommandHandler<DetachContainerCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs
index 42f7cf04..b57cb876 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs
@@ -1,11 +1,11 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Utils;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class FlattenSplitContainerHandler : ICommandHandler<FlattenSplitContainerCommand>
+ internal sealed class FlattenSplitContainerHandler : ICommandHandler<FlattenSplitContainerCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/FocusInDirectionHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/FocusInDirectionHandler.cs
index f8f835f5..48351c48 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/FocusInDirectionHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/FocusInDirectionHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Monitors;
@@ -8,7 +8,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class FocusInDirectionHandler : ICommandHandler<FocusInDirectionCommand>
+ internal sealed class FocusInDirectionHandler : ICommandHandler<FocusInDirectionCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
@@ -49,10 +49,10 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
private static Container GetFocusTargetFromFloating(Container focusedContainer, Direction direction)
{
// Cannot focus vertically from a floating window.
- if (direction is Direction.UP or Direction.DOWN)
+ if (direction is Direction.Up or Direction.Down)
return null;
- var focusTarget = direction is Direction.RIGHT
+ var focusTarget = direction is Direction.Right
? focusedContainer.NextSiblingOfType<FloatingWindow>()
: focusedContainer.PreviousSiblingOfType<FloatingWindow>();
@@ -60,7 +60,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
return focusTarget;
// Wrap if next/previous floating window is not found.
- return direction is Direction.RIGHT
+ return direction is Direction.Right
? focusedContainer.SelfAndSiblingsOfType<FloatingWindow>().FirstOrDefault()
: focusedContainer.SelfAndSiblingsOfType<FloatingWindow>().LastOrDefault();
}
@@ -100,7 +100,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
continue;
}
- var focusTarget = direction is Direction.UP or Direction.LEFT
+ var focusTarget = direction is Direction.Up or Direction.Left
? focusReference.PreviousSiblingOfType<IResizable>()
: focusReference.NextSiblingOfType<IResizable>();
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs
index ee6ceec5..d02498d0 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Infrastructure.Bussing;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Utils;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class MoveContainerWithinTreeHandler : ICommandHandler<MoveContainerWithinTreeCommand>
+ internal sealed class MoveContainerWithinTreeHandler : ICommandHandler<MoveContainerWithinTreeCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
index 694f58f0..aa4f33c7 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.UserConfigs;
@@ -8,7 +8,7 @@ using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class RedrawContainersHandler : ICommandHandler<RedrawContainersCommand>
+ internal sealed class RedrawContainersHandler : ICommandHandler<RedrawContainersCommand>
{
private readonly ContainerService _containerService;
private readonly UserConfigService _userConfigService;
@@ -35,13 +35,13 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
.Where(
(window) =>
window is not MinimizedWindow &&
- window.HasWindowStyle(WS.WS_MAXIMIZE | WS.WS_MINIMIZE)
+ window.HasWindowStyle(WindowStyles.Maximize | WindowStyles.Minimize)
)
.ToList();
// Restore minimized/maximized windows. Needed to be able to move and resize them.
foreach (var window in windowsToRestore)
- ShowWindow(window.Handle, ShowWindowCommands.RESTORE);
+ ShowWindow(window.Handle, ShowWindowFlags.Restore);
foreach (var window in windowsToRedraw)
{
@@ -65,16 +65,16 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
private void SetWindowPosition(Window window)
{
var defaultFlags =
- SWP.SWP_FRAMECHANGED |
- SWP.SWP_NOACTIVATE |
- SWP.SWP_NOCOPYBITS |
- SWP.SWP_NOSENDCHANGING;
+ SetWindowPosFlags.FrameChanged |
+ SetWindowPosFlags.NoActivate |
+ SetWindowPosFlags.NoCopyBits |
+ SetWindowPosFlags.NoSendChanging;
// Show or hide the window depending on whether the workspace is displayed.
if (window.IsDisplayed)
- defaultFlags |= SWP.SWP_SHOWWINDOW;
+ defaultFlags |= SetWindowPosFlags.ShowWindow;
else
- defaultFlags |= SWP.SWP_HIDEWINDOW;
+ defaultFlags |= SetWindowPosFlags.HideWindow;
if (window is TilingWindow)
{
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs
index d6aec785..b49dd298 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Infrastructure.Bussing;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Utils;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class ReplaceContainerHandler : ICommandHandler<ReplaceContainerCommand>
+ internal sealed class ReplaceContainerHandler : ICommandHandler<ReplaceContainerCommand>
{
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/ResizeContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/ResizeContainerHandler.cs
index 33729419..bc288642 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/ResizeContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/ResizeContainerHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using GlazeWM.Domain.Containers.Commands;
@@ -7,7 +7,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class ResizeContainerHandler : ICommandHandler<ResizeContainerCommand>
+ internal sealed class ResizeContainerHandler : ICommandHandler<ResizeContainerCommand>
{
private const double MIN_SIZE_PERCENTAGE = 0.01;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/SetFocusedDescendantHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/SetFocusedDescendantHandler.cs
index 356eea61..ca37347a 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/SetFocusedDescendantHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/SetFocusedDescendantHandler.cs
@@ -1,10 +1,10 @@
-using GlazeWM.Domain.Containers.Commands;
+using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Utils;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class SetFocusedDescendantHandler : ICommandHandler<SetFocusedDescendantCommand>
+ internal sealed class SetFocusedDescendantHandler : ICommandHandler<SetFocusedDescendantCommand>
{
public CommandResponse Handle(SetFocusedDescendantCommand command)
{
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/SetNativeFocusHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/SetNativeFocusHandler.cs
index 54653a26..15dafce1 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/SetNativeFocusHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/SetNativeFocusHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Containers.Events;
using GlazeWM.Domain.Windows;
@@ -8,7 +8,7 @@ using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class SetNativeFocusHandler : ICommandHandler<SetNativeFocusCommand>
+ internal sealed class SetNativeFocusHandler : ICommandHandler<SetNativeFocusCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/ToggleFocusModeHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/ToggleFocusModeHandler.cs
index 412f7234..366c6b61 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/ToggleFocusModeHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/ToggleFocusModeHandler.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows;
using GlazeWM.Domain.Workspaces;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.CommandHandlers
{
- internal class ToggleFocusModeHandler : ICommandHandler<ToggleFocusModeCommand>
+ internal sealed class ToggleFocusModeHandler : ICommandHandler<ToggleFocusModeCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
@@ -25,9 +25,9 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
public CommandResponse Handle(ToggleFocusModeCommand command)
{
var currentFocusMode = _containerService.FocusMode;
- var targetFocusMode = currentFocusMode == FocusMode.TILING
- ? FocusMode.FLOATING
- : FocusMode.TILING;
+ var targetFocusMode = currentFocusMode == FocusMode.Tiling
+ ? FocusMode.Floating
+ : FocusMode.Tiling;
var windowToFocus = GetWindowToFocus(targetFocusMode);
@@ -43,7 +43,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
{
var focusedWorkspace = _workspaceService.GetFocusedWorkspace();
- if (targetFocusMode == FocusMode.FLOATING)
+ if (targetFocusMode == FocusMode.Floating)
// Get the last focused tiling window within the workspace.
return focusedWorkspace.LastFocusedDescendantOfType<FloatingWindow>() as Window;
diff --git a/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs
index 51f9f351..bc5c310a 100644
--- a/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs
index a4f3ac0a..56fc6ae7 100644
--- a/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/CenterCursorOnRectCommand.cs b/GlazeWM.Domain/Containers/Commands/CenterCursorOnRectCommand.cs
index b7004783..ad3505e8 100644
--- a/GlazeWM.Domain/Containers/Commands/CenterCursorOnRectCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/CenterCursorOnRectCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Containers.Commands
diff --git a/GlazeWM.Domain/Containers/Commands/ChangeContainerLayoutCommand.cs b/GlazeWM.Domain/Containers/Commands/ChangeContainerLayoutCommand.cs
index b9fd60f6..cdcfa450 100644
--- a/GlazeWM.Domain/Containers/Commands/ChangeContainerLayoutCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/ChangeContainerLayoutCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
diff --git a/GlazeWM.Domain/Containers/Commands/DetachAndResizeContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/DetachAndResizeContainerCommand.cs
index 90ed5671..0233a4e1 100644
--- a/GlazeWM.Domain/Containers/Commands/DetachAndResizeContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/DetachAndResizeContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/DetachContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/DetachContainerCommand.cs
index 12aea668..a67a341b 100644
--- a/GlazeWM.Domain/Containers/Commands/DetachContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/DetachContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/FlattenSplitContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/FlattenSplitContainerCommand.cs
index 6f92198a..035e6aae 100644
--- a/GlazeWM.Domain/Containers/Commands/FlattenSplitContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/FlattenSplitContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/FocusInDirectionCommand.cs b/GlazeWM.Domain/Containers/Commands/FocusInDirectionCommand.cs
index 1eea9253..d437caf5 100644
--- a/GlazeWM.Domain/Containers/Commands/FocusInDirectionCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/FocusInDirectionCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
diff --git a/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs b/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs
index 40227737..975e633c 100644
--- a/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/RedrawContainersCommand.cs b/GlazeWM.Domain/Containers/Commands/RedrawContainersCommand.cs
index 2a70c3dc..ebfd5d30 100644
--- a/GlazeWM.Domain/Containers/Commands/RedrawContainersCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/RedrawContainersCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs
index 290fe6e2..9fd5db6e 100644
--- a/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/ResizeContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/ResizeContainerCommand.cs
index e5104af4..a49c9a51 100644
--- a/GlazeWM.Domain/Containers/Commands/ResizeContainerCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/ResizeContainerCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/SetFocusedDescendantCommand.cs b/GlazeWM.Domain/Containers/Commands/SetFocusedDescendantCommand.cs
index 2a68f1b0..ad839d14 100644
--- a/GlazeWM.Domain/Containers/Commands/SetFocusedDescendantCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/SetFocusedDescendantCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/SetNativeFocusCommand.cs b/GlazeWM.Domain/Containers/Commands/SetNativeFocusCommand.cs
index 968f6e82..d5a84789 100644
--- a/GlazeWM.Domain/Containers/Commands/SetNativeFocusCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/SetNativeFocusCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Commands/ToggleFocusModeCommand.cs b/GlazeWM.Domain/Containers/Commands/ToggleFocusModeCommand.cs
index e7206c1c..1fe2e2b7 100644
--- a/GlazeWM.Domain/Containers/Commands/ToggleFocusModeCommand.cs
+++ b/GlazeWM.Domain/Containers/Commands/ToggleFocusModeCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Commands
{
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index cff503e1..18cf5220 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using GlazeWM.Infrastructure.WindowsApi;
diff --git a/GlazeWM.Domain/Containers/ContainerService.cs b/GlazeWM.Domain/Containers/ContainerService.cs
index b7f7e21e..8832432c 100644
--- a/GlazeWM.Domain/Containers/ContainerService.cs
+++ b/GlazeWM.Domain/Containers/ContainerService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using GlazeWM.Domain.Common.Enums;
@@ -31,7 +31,7 @@ namespace GlazeWM.Domain.Containers
/// Whether a tiling or floating container is currently focused.
/// </summary>
public FocusMode FocusMode => FocusedContainer is FloatingWindow ?
- FocusMode.FLOATING : FocusMode.TILING;
+ FocusMode.Floating : FocusMode.Tiling;
/// <summary>
/// Name of the currently active binding mode (if one is active).
@@ -58,7 +58,7 @@ namespace GlazeWM.Domain.Containers
{
var parent = container.Parent as SplitContainer;
- if (parent.Layout == Layout.VERTICAL)
+ if (parent.Layout == Layout.Vertical)
return parent.Width;
var innerGap = _userConfigService.GapsConfig.InnerGap;
@@ -76,7 +76,7 @@ namespace GlazeWM.Domain.Containers
{
var parent = container.Parent as SplitContainer;
- if (parent.Layout == Layout.HORIZONTAL)
+ if (parent.Layout == Layout.Horizontal)
return parent.Height;
var innerGap = _userConfigService.GapsConfig.InnerGap;
@@ -96,7 +96,7 @@ namespace GlazeWM.Domain.Containers
var isFirstOfType = container.SelfAndSiblingsOfType<IResizable>().First() == container;
- if (parent.Layout == Layout.VERTICAL || isFirstOfType)
+ if (parent.Layout == Layout.Vertical || isFirstOfType)
return parent.X;
var innerGap = _userConfigService.GapsConfig.InnerGap;
@@ -116,7 +116,7 @@ namespace GlazeWM.Domain.Containers
var isFirstOfType = container.SelfAndSiblingsOfType<IResizable>().First() == container;
- if (parent.Layout == Layout.HORIZONTAL || isFirstOfType)
+ if (parent.Layout == Layout.Horizontal || isFirstOfType)
return parent.Y;
var innerGap = _userConfigService.GapsConfig.InnerGap;
@@ -147,7 +147,7 @@ namespace GlazeWM.Domain.Containers
originContainer.LastFocusedChildOfType<IResizable>(),
direction
);
- else if (direction is Direction.UP or Direction.LEFT)
+ else if (direction is Direction.Up or Direction.Left)
return GetDescendantInDirection(
originContainer.ChildrenOfType<IResizable>().First(),
direction
diff --git a/GlazeWM.Domain/Containers/Events/FocusChangedEvent.cs b/GlazeWM.Domain/Containers/Events/FocusChangedEvent.cs
index 071f4f9a..0e9d59aa 100644
--- a/GlazeWM.Domain/Containers/Events/FocusChangedEvent.cs
+++ b/GlazeWM.Domain/Containers/Events/FocusChangedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Events
{
diff --git a/GlazeWM.Domain/Containers/Events/LayoutChangedEvent.cs b/GlazeWM.Domain/Containers/Events/LayoutChangedEvent.cs
index 612aa0f5..4f9091e6 100644
--- a/GlazeWM.Domain/Containers/Events/LayoutChangedEvent.cs
+++ b/GlazeWM.Domain/Containers/Events/LayoutChangedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Containers.Events
diff --git a/GlazeWM.Domain/Containers/IResizable.cs b/GlazeWM.Domain/Containers/IResizable.cs
index 42003040..4a3cd9b1 100644
--- a/GlazeWM.Domain/Containers/IResizable.cs
+++ b/GlazeWM.Domain/Containers/IResizable.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Domain.Containers
+namespace GlazeWM.Domain.Containers
{
public interface IResizable
{
diff --git a/GlazeWM.Domain/Containers/JsonContainerConverter.cs b/GlazeWM.Domain/Containers/JsonContainerConverter.cs
index ce9c0762..911888b9 100644
--- a/GlazeWM.Domain/Containers/JsonContainerConverter.cs
+++ b/GlazeWM.Domain/Containers/JsonContainerConverter.cs
@@ -1,4 +1,5 @@
using System;
+using System.Globalization;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
@@ -112,56 +113,74 @@ namespace GlazeWM.Domain.Containers
var focusIndex = value is RootContainer ? 0 : value.FocusIndex;
writer.WriteNumber("FocusIndex", focusIndex);
+ WriteContainerValue(writer, value);
+
+ // Recursively serialize child containers.
+ writer.WriteStartArray("Children");
+ foreach (var child in value.Children)
+ Write(writer, child, options);
+
+ writer.WriteEndArray();
+ writer.WriteEndObject();
+ }
+
+ private static void WriteContainerValue(
+ Utf8JsonWriter writer,
+ Container value)
+ {
switch (value)
{
case Monitor:
var monitor = value as Monitor;
writer.WriteString("DeviceName", monitor.DeviceName);
- break;
+ return;
case Workspace:
var workspace = value as Workspace;
writer.WriteString("Name", workspace.Name);
- break;
+ return;
case SplitContainer:
var splitContainer = value as SplitContainer;
writer.WriteString("Layout", splitContainer.Layout.ToString());
writer.WriteNumber("SizePercentage", splitContainer.SizePercentage);
- break;
+ return;
case MinimizedWindow:
var minimizedWindow = value as MinimizedWindow;
- writer.WriteString("Handle", minimizedWindow.Handle.ToString("x"));
+ writer.WriteString(
+ "Handle",
+ minimizedWindow.Handle.ToString("x", CultureInfo.InvariantCulture)
+ );
writer.WritePropertyName("FloatingPlacement");
JsonSerializer.Serialize(writer, minimizedWindow.FloatingPlacement);
writer.WritePropertyName("BorderDelta");
JsonSerializer.Serialize(writer, minimizedWindow.BorderDelta);
writer.WriteString("PreviousState", minimizedWindow.PreviousState.ToString());
- break;
+ return;
case FloatingWindow:
var floatingWindow = value as FloatingWindow;
- writer.WriteString("Handle", floatingWindow.Handle.ToString("x"));
+ writer.WriteString(
+ "Handle",
+ floatingWindow.Handle.ToString("x", CultureInfo.InvariantCulture)
+ );
writer.WritePropertyName("FloatingPlacement");
JsonSerializer.Serialize(writer, floatingWindow.FloatingPlacement);
writer.WritePropertyName("BorderDelta");
JsonSerializer.Serialize(writer, floatingWindow.BorderDelta);
- break;
+ return;
case TilingWindow:
var tilingWindow = value as TilingWindow;
- writer.WriteString("Handle", tilingWindow.Handle.ToString("x"));
+ writer.WriteString(
+ "Handle",
+ tilingWindow.Handle.ToString("x", CultureInfo.InvariantCulture)
+ );
writer.WritePropertyName("FloatingPlacement");
JsonSerializer.Serialize(writer, tilingWindow.FloatingPlacement);
writer.WritePropertyName("BorderDelta");
JsonSerializer.Serialize(writer, tilingWindow.BorderDelta);
writer.WriteNumber("SizePercentage", tilingWindow.SizePercentage);
- break;
+ return;
+ default:
+ return;
}
-
- // Recursively serialize child containers.
- writer.WriteStartArray("Children");
- foreach (var child in value.Children)
- Write(writer, child, options);
-
- writer.WriteEndArray();
- writer.WriteEndObject();
}
}
}
diff --git a/GlazeWM.Domain/Containers/RootContainer.cs b/GlazeWM.Domain/Containers/RootContainer.cs
index d83df3b2..10b21bd2 100644
--- a/GlazeWM.Domain/Containers/RootContainer.cs
+++ b/GlazeWM.Domain/Containers/RootContainer.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
namespace GlazeWM.Domain.Containers
{
diff --git a/GlazeWM.Domain/Containers/SplitContainer.cs b/GlazeWM.Domain/Containers/SplitContainer.cs
index 916c8890..b7a86bb4 100644
--- a/GlazeWM.Domain/Containers/SplitContainer.cs
+++ b/GlazeWM.Domain/Containers/SplitContainer.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure;
@@ -7,7 +7,7 @@ namespace GlazeWM.Domain.Containers
public class SplitContainer : Container, IResizable
{
public override string Id { get; init; } = $"SPLIT/{new Guid()}";
- public Layout Layout { get; set; } = Layout.HORIZONTAL;
+ public Layout Layout { get; set; } = Layout.Horizontal;
public double SizePercentage { get; set; } = 1;
diff --git a/GlazeWM.Domain/DependencyInjection.cs b/GlazeWM.Domain/DependencyInjection.cs
index c9329cab..ef87a872 100644
--- a/GlazeWM.Domain/DependencyInjection.cs
+++ b/GlazeWM.Domain/DependencyInjection.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.CommandHandlers;
+using GlazeWM.Domain.Common.CommandHandlers;
using GlazeWM.Domain.Common.Commands;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.CommandHandlers;
diff --git a/GlazeWM.Domain/GlazeWM.Domain.csproj b/GlazeWM.Domain/GlazeWM.Domain.csproj
index bb13c5c1..ac29980f 100644
--- a/GlazeWM.Domain/GlazeWM.Domain.csproj
+++ b/GlazeWM.Domain/GlazeWM.Domain.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
diff --git a/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs b/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs
index a4191631..48c3190d 100644
--- a/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs
+++ b/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Monitors.Commands;
using GlazeWM.Domain.Monitors.Events;
@@ -9,7 +9,7 @@ using GlazeWM.Infrastructure.Exceptions;
namespace GlazeWM.Domain.Monitors.CommandHandlers
{
- internal class AddMonitorHandler : ICommandHandler<AddMonitorCommand>
+ internal sealed class AddMonitorHandler : ICommandHandler<AddMonitorCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Monitors/CommandHandlers/RefreshMonitorStateHandler.cs b/GlazeWM.Domain/Monitors/CommandHandlers/RefreshMonitorStateHandler.cs
index ccf9c61c..8d66672c 100644
--- a/GlazeWM.Domain/Monitors/CommandHandlers/RefreshMonitorStateHandler.cs
+++ b/GlazeWM.Domain/Monitors/CommandHandlers/RefreshMonitorStateHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using System.Windows.Forms;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
@@ -10,7 +10,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.CommandHandlers
{
- internal class RefreshMonitorStateHandler : ICommandHandler<RefreshMonitorStateCommand>
+ internal sealed class RefreshMonitorStateHandler : ICommandHandler<RefreshMonitorStateCommand>
{
private readonly Bus _bus;
private readonly MonitorService _monitorService;
diff --git a/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs b/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs
index 550243fc..dbce8e4f 100644
--- a/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs
+++ b/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Monitors.Commands;
using GlazeWM.Domain.Monitors.Events;
@@ -8,7 +8,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.CommandHandlers
{
- internal class RemoveMonitorHandler : ICommandHandler<RemoveMonitorCommand>
+ internal sealed class RemoveMonitorHandler : ICommandHandler<RemoveMonitorCommand>
{
private readonly Bus _bus;
private readonly MonitorService _monitorService;
diff --git a/GlazeWM.Domain/Monitors/Commands/AddMonitorCommand.cs b/GlazeWM.Domain/Monitors/Commands/AddMonitorCommand.cs
index 15956962..496d0586 100644
--- a/GlazeWM.Domain/Monitors/Commands/AddMonitorCommand.cs
+++ b/GlazeWM.Domain/Monitors/Commands/AddMonitorCommand.cs
@@ -1,5 +1,5 @@
-using GlazeWM.Infrastructure.Bussing;
using System.Windows.Forms;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Commands
{
diff --git a/GlazeWM.Domain/Monitors/Commands/RefreshMonitorStateCommand.cs b/GlazeWM.Domain/Monitors/Commands/RefreshMonitorStateCommand.cs
index e94f48fe..6114db31 100644
--- a/GlazeWM.Domain/Monitors/Commands/RefreshMonitorStateCommand.cs
+++ b/GlazeWM.Domain/Monitors/Commands/RefreshMonitorStateCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Commands
{
diff --git a/GlazeWM.Domain/Monitors/Commands/RemoveMonitorCommand.cs b/GlazeWM.Domain/Monitors/Commands/RemoveMonitorCommand.cs
index 5f80c121..92094058 100644
--- a/GlazeWM.Domain/Monitors/Commands/RemoveMonitorCommand.cs
+++ b/GlazeWM.Domain/Monitors/Commands/RemoveMonitorCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Commands
{
diff --git a/GlazeWM.Domain/Monitors/EventHandlers/DisplaySettingsChangedHandler.cs b/GlazeWM.Domain/Monitors/EventHandlers/DisplaySettingsChangedHandler.cs
index fa87075f..26fc7684 100644
--- a/GlazeWM.Domain/Monitors/EventHandlers/DisplaySettingsChangedHandler.cs
+++ b/GlazeWM.Domain/Monitors/EventHandlers/DisplaySettingsChangedHandler.cs
@@ -1,10 +1,10 @@
-using GlazeWM.Domain.Monitors.Commands;
+using GlazeWM.Domain.Monitors.Commands;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.Events;
namespace GlazeWM.Domain.Monitors.EventHandlers
{
- internal class DisplaySettingsChangedHandler : IEventHandler<DisplaySettingsChangedEvent>
+ internal sealed class DisplaySettingsChangedHandler : IEventHandler<DisplaySettingsChangedEvent>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Monitors/Events/MonitorAddedEvent.cs b/GlazeWM.Domain/Monitors/Events/MonitorAddedEvent.cs
index 3c4c2397..37251d0d 100644
--- a/GlazeWM.Domain/Monitors/Events/MonitorAddedEvent.cs
+++ b/GlazeWM.Domain/Monitors/Events/MonitorAddedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Events
{
diff --git a/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs b/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs
index 5d7debab..82e44153 100644
--- a/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs
+++ b/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Events
{
diff --git a/GlazeWM.Domain/Monitors/Events/WorkingAreaResizedEvent.cs b/GlazeWM.Domain/Monitors/Events/WorkingAreaResizedEvent.cs
index 01295805..d7114466 100644
--- a/GlazeWM.Domain/Monitors/Events/WorkingAreaResizedEvent.cs
+++ b/GlazeWM.Domain/Monitors/Events/WorkingAreaResizedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Events
{
diff --git a/GlazeWM.Domain/Monitors/Monitor.cs b/GlazeWM.Domain/Monitors/Monitor.cs
index e6a2d5fc..243b1e12 100644
--- a/GlazeWM.Domain/Monitors/Monitor.cs
+++ b/GlazeWM.Domain/Monitors/Monitor.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Workspaces;
namespace GlazeWM.Domain.Monitors
diff --git a/GlazeWM.Domain/Monitors/MonitorService.cs b/GlazeWM.Domain/Monitors/MonitorService.cs
index 636ce6d5..fd0e0bd4 100644
--- a/GlazeWM.Domain/Monitors/MonitorService.cs
+++ b/GlazeWM.Domain/Monitors/MonitorService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
@@ -62,7 +62,7 @@ namespace GlazeWM.Domain.Monitors
// Get a handle to the monitor.
// TODO: Consider adding a `Monitor` getter for a monitor's handle.
- var monitorHandle = MonitorFromPoint(point, MonitorFromPointFlags.MONITOR_DEFAULTTONEAREST);
+ var monitorHandle = MonitorFromPoint(point, MonitorFromPointFlags.DefaultToNearest);
_ = GetDpiForMonitor(monitorHandle, DpiType.Effective, out var dpiX, out _);
// DPI X and Y should be equivalent, so it's arbitrary which to return.
@@ -96,8 +96,8 @@ namespace GlazeWM.Domain.Monitors
{
// Check whether the monitor is to the right/left of the origin monitor.
if (
- (direction == Direction.RIGHT && monitor.X > originMonitor.X) ||
- (direction == Direction.LEFT && monitor.X < originMonitor.X))
+ (direction == Direction.Right && monitor.X > originMonitor.X) ||
+ (direction == Direction.Left && monitor.X < originMonitor.X))
{
// Check whether the y-coordinate overlaps with the y-coordinate of the origin monitor.
if (
@@ -108,8 +108,8 @@ namespace GlazeWM.Domain.Monitors
}
// Check whether the monitor is below/above the origin monitor.
else if (
- (direction == Direction.DOWN && monitor.Y > originMonitor.Y) ||
- (direction == Direction.UP && monitor.Y < originMonitor.Y))
+ (direction == Direction.Down && monitor.Y > originMonitor.Y) ||
+ (direction == Direction.Up && monitor.Y < originMonitor.Y))
{
// Check whether the x-coordinate overlaps with the x-coordinate of the origin monitor.
if (
@@ -126,10 +126,10 @@ namespace GlazeWM.Domain.Monitors
// is closer.
if (
monitorInDirection == null ||
- (direction == Direction.RIGHT && monitor.X < monitorInDirection.X) ||
- (direction == Direction.LEFT && monitor.X > monitorInDirection.X) ||
- (direction == Direction.DOWN && monitor.Y < monitorInDirection.Y) ||
- (direction == Direction.UP && monitor.Y > monitorInDirection.Y)
+ (direction == Direction.Right && monitor.X < monitorInDirection.X) ||
+ (direction == Direction.Left && monitor.X > monitorInDirection.X) ||
+ (direction == Direction.Down && monitor.Y < monitorInDirection.Y) ||
+ (direction == Direction.Up && monitor.Y > monitorInDirection.Y)
)
monitorInDirection = monitor;
}
diff --git a/GlazeWM.Domain/UserConfigs/BarComponentConfigConverter.cs b/GlazeWM.Domain/UserConfigs/BarComponentConfigConverter.cs
index 50bd975a..71d7e530 100644
--- a/GlazeWM.Domain/UserConfigs/BarComponentConfigConverter.cs
+++ b/GlazeWM.Domain/UserConfigs/BarComponentConfigConverter.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Text.Json;
using System.Text.Json.Serialization;
diff --git a/GlazeWM.Domain/UserConfigs/BarPosition.cs b/GlazeWM.Domain/UserConfigs/BarPosition.cs
index 50cf7cd4..f053fab1 100644
--- a/GlazeWM.Domain/UserConfigs/BarPosition.cs
+++ b/GlazeWM.Domain/UserConfigs/BarPosition.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Domain.UserConfigs
+namespace GlazeWM.Domain.UserConfigs
{
public enum BarPosition
{
diff --git a/GlazeWM.Domain/UserConfigs/BatteryComponentConfig.cs b/GlazeWM.Domain/UserConfigs/BatteryComponentConfig.cs
index b033c6e6..e5b99bfb 100644
--- a/GlazeWM.Domain/UserConfigs/BatteryComponentConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/BatteryComponentConfig.cs
@@ -1,14 +1,18 @@
-namespace GlazeWM.Domain.UserConfigs
+namespace GlazeWM.Domain.UserConfigs
{
/// <summary>
+ /// <para>
/// A component to display information about the battery of the device, namely the battery level and
/// whether the device is connected to power or is in power saving mode.
- ///
+ /// </para>
+ /// <para>
/// There are 3 labels that are used depending on the situation, and the variable
/// <c>{battery_level}</c> is replaced with the current battery level of the device.
- ///
+ /// </para>
+ /// <para>
/// When the device does not have a dedicated battery, the battery level is displayed
/// as 100% at all times.
+ /// </para>
/// </summary>
public class BatteryComponentConfig : BarComponentConfig
{
diff --git a/GlazeWM.Domain/UserConfigs/BindingMode.cs b/GlazeWM.Domain/UserConfigs/BindingMode.cs
index 5f37b8e0..b0256b44 100644
--- a/GlazeWM.Domain/UserConfigs/BindingMode.cs
+++ b/GlazeWM.Domain/UserConfigs/BindingMode.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace GlazeWM.Domain.UserConfigs
{
diff --git a/GlazeWM.Domain/UserConfigs/ClockComponentConfig.cs b/GlazeWM.Domain/UserConfigs/ClockComponentConfig.cs
index a6a31b5f..5b4f5dc6 100644
--- a/GlazeWM.Domain/UserConfigs/ClockComponentConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/ClockComponentConfig.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Globalization;
-
namespace GlazeWM.Domain.UserConfigs
{
public class ClockComponentConfig : BarComponentConfig
diff --git a/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs b/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs
index d8548859..ddd422f4 100644
--- a/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandHandlers/EvaluateUserConfigHandler.cs
@@ -1,8 +1,3 @@
-using GlazeWM.Domain.UserConfigs.Commands;
-using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Infrastructure.Exceptions;
-using GlazeWM.Infrastructure.Serialization;
-using GlazeWM.Infrastructure.Utils;
using System;
using System.Collections.Generic;
using System.IO;
@@ -11,10 +6,15 @@ using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Windows.Forms;
+using GlazeWM.Domain.UserConfigs.Commands;
+using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Exceptions;
+using GlazeWM.Infrastructure.Serialization;
+using GlazeWM.Infrastructure.Utils;
namespace GlazeWM.Domain.UserConfigs.CommandHandlers
{
- internal class EvaluateUserConfigHandler : ICommandHandler<EvaluateUserConfigCommand>
+ internal sealed class EvaluateUserConfigHandler : ICommandHandler<EvaluateUserConfigCommand>
{
private readonly Bus _bus;
private readonly UserConfigService _userConfigService;
diff --git a/GlazeWM.Domain/UserConfigs/CommandHandlers/RegisterKeybindingsHandler.cs b/GlazeWM.Domain/UserConfigs/CommandHandlers/RegisterKeybindingsHandler.cs
index bb29c7c9..ebd239ad 100644
--- a/GlazeWM.Domain/UserConfigs/CommandHandlers/RegisterKeybindingsHandler.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandHandlers/RegisterKeybindingsHandler.cs
@@ -9,7 +9,7 @@ using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.UserConfigs.CommandHandlers
{
- internal class RegisterKeybindingsHandler : ICommandHandler<RegisterKeybindingsCommand>
+ internal sealed class RegisterKeybindingsHandler : ICommandHandler<RegisterKeybindingsCommand>
{
private readonly Bus _bus;
private readonly CommandParsingService _commandParsingService;
diff --git a/GlazeWM.Domain/UserConfigs/CommandHandlers/ReloadUserConfigHandler.cs b/GlazeWM.Domain/UserConfigs/CommandHandlers/ReloadUserConfigHandler.cs
index 7241d2aa..21330a76 100644
--- a/GlazeWM.Domain/UserConfigs/CommandHandlers/ReloadUserConfigHandler.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandHandlers/ReloadUserConfigHandler.cs
@@ -9,7 +9,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.UserConfigs.CommandHandlers
{
- internal class ReloadUserConfigHandler : ICommandHandler<ReloadUserConfigCommand>
+ internal sealed class ReloadUserConfigHandler : ICommandHandler<ReloadUserConfigCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
index 320e9f5a..8384b58e 100644
--- a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
@@ -103,8 +103,8 @@ namespace GlazeWM.Domain.UserConfigs
{
"direction" => commandParts[2] switch
{
- "vertical" => new ChangeContainerLayoutCommand(subjectContainer, Layout.VERTICAL),
- "horizontal" => new ChangeContainerLayoutCommand(subjectContainer, Layout.HORIZONTAL),
+ "vertical" => new ChangeContainerLayoutCommand(subjectContainer, Layout.Vertical),
+ "horizontal" => new ChangeContainerLayoutCommand(subjectContainer, Layout.Horizontal),
_ => throw new ArgumentException(null, nameof(commandParts)),
},
_ => throw new ArgumentException(null, nameof(commandParts)),
@@ -115,8 +115,8 @@ namespace GlazeWM.Domain.UserConfigs
{
return commandParts[1] switch
{
- "vertical" => new ChangeContainerLayoutCommand(subjectContainer, Layout.VERTICAL),
- "horizontal" => new ChangeContainerLayoutCommand(subjectContainer, Layout.HORIZONTAL),
+ "vertical" => new ChangeContainerLayoutCommand(subjectContainer, Layout.Vertical),
+ "horizontal" => new ChangeContainerLayoutCommand(subjectContainer, Layout.Horizontal),
_ => throw new ArgumentException(null, nameof(commandParts)),
};
}
@@ -125,10 +125,10 @@ namespace GlazeWM.Domain.UserConfigs
{
return commandParts[1] switch
{
- "left" => new FocusInDirectionCommand(Direction.LEFT),
- "right" => new FocusInDirectionCommand(Direction.RIGHT),
- "up" => new FocusInDirectionCommand(Direction.UP),
- "down" => new FocusInDirectionCommand(Direction.DOWN),
+ "left" => new FocusInDirectionCommand(Direction.Left),
+ "right" => new FocusInDirectionCommand(Direction.Right),
+ "up" => new FocusInDirectionCommand(Direction.Up),
+ "down" => new FocusInDirectionCommand(Direction.Down),
"workspace" => ParseFocusWorkspaceCommand(commandParts),
_ => throw new ArgumentException(null, nameof(commandParts)),
};
@@ -139,8 +139,8 @@ namespace GlazeWM.Domain.UserConfigs
return commandParts[2] switch
{
"recent" => new FocusWorkspaceRecentCommand(),
- "prev" => new FocusWorkspaceSequenceCommand(Sequence.PREVIOUS),
- "next" => new FocusWorkspaceSequenceCommand(Sequence.NEXT),
+ "prev" => new FocusWorkspaceSequenceCommand(Sequence.Previous),
+ "next" => new FocusWorkspaceSequenceCommand(Sequence.Next),
_ when IsValidWorkspace(commandParts[2]) => new FocusWorkspaceCommand(commandParts[2]),
_ => throw new ArgumentException(null, nameof(commandParts)),
};
@@ -151,16 +151,16 @@ namespace GlazeWM.Domain.UserConfigs
return commandParts[1] switch
{
"left" => subjectContainer is Window
- ? new MoveWindowCommand(subjectContainer as Window, Direction.LEFT)
+ ? new MoveWindowCommand(subjectContainer as Window, Direction.Left)
: new NoopCommand(),
"right" => subjectContainer is Window
- ? new MoveWindowCommand(subjectContainer as Window, Direction.RIGHT)
+ ? new MoveWindowCommand(subjectContainer as Window, Direction.Right)
: new NoopCommand(),
"up" => subjectContainer is Window
- ? new MoveWindowCommand(subjectContainer as Window, Direction.UP)
+ ? new MoveWindowCommand(subjectContainer as Window, Direction.Up)
: new NoopCommand(),
"down" => subjectContainer is Window
- ? new MoveWindowCommand(subjectContainer as Window, Direction.DOWN)
+ ? new MoveWindowCommand(subjectContainer as Window, Direction.Down)
: new NoopCommand(),
"to" when IsValidWorkspace(commandParts[3]) => subjectContainer is Window
? new MoveWindowToWorkspaceCommand(subjectContainer as Window, commandParts[3])
@@ -174,10 +174,10 @@ namespace GlazeWM.Domain.UserConfigs
{
return commandParts[2] switch
{
- "left" => new MoveWorkspaceInDirectionCommand(Direction.LEFT),
- "right" => new MoveWorkspaceInDirectionCommand(Direction.RIGHT),
- "up" => new MoveWorkspaceInDirectionCommand(Direction.UP),
- "down" => new MoveWorkspaceInDirectionCommand(Direction.DOWN),
+ "left" => new MoveWorkspaceInDirectionCommand(Direction.Left),
+ "right" => new MoveWorkspaceInDirectionCommand(Direction.Right),
+ "up" => new MoveWorkspaceInDirectionCommand(Direction.Up),
+ "down" => new MoveWorkspaceInDirectionCommand(Direction.Down),
_ => throw new ArgumentException(null, nameof(commandParts)),
};
}
@@ -187,10 +187,10 @@ namespace GlazeWM.Domain.UserConfigs
return commandParts[1] switch
{
"height" => subjectContainer is Window
- ? new ResizeWindowCommand(subjectContainer as Window, ResizeDimension.HEIGHT, commandParts[2])
+ ? new ResizeWindowCommand(subjectContainer as Window, ResizeDimension.Height, commandParts[2])
: new NoopCommand(),
"width" => subjectContainer is Window
- ? new ResizeWindowCommand(subjectContainer as Window, ResizeDimension.WIDTH, commandParts[2])
+ ? new ResizeWindowCommand(subjectContainer as Window, ResizeDimension.Width, commandParts[2])
: new NoopCommand(),
"borders" => subjectContainer is Window
? new ResizeWindowBordersCommand(
@@ -291,7 +291,10 @@ namespace GlazeWM.Domain.UserConfigs
public static string ExtractProcessName(string processNameAndArgs)
{
- var hasSingleQuotes = processNameAndArgs.StartsWith("'");
+ var hasSingleQuotes = processNameAndArgs.StartsWith(
+ "'",
+ StringComparison.InvariantCulture
+ );
return hasSingleQuotes
? processNameAndArgs.Split("'")[1]
@@ -300,7 +303,10 @@ namespace GlazeWM.Domain.UserConfigs
public static List<string> ExtractProcessArgs(string processNameAndArgs)
{
- var hasSingleQuotes = processNameAndArgs.StartsWith("'");
+ var hasSingleQuotes = processNameAndArgs.StartsWith(
+ "'",
+ StringComparison.InvariantCulture
+ );
var args = hasSingleQuotes
? processNameAndArgs.Split("'")[2..]
diff --git a/GlazeWM.Domain/UserConfigs/Commands/EvaluateUserConfigCommand.cs b/GlazeWM.Domain/UserConfigs/Commands/EvaluateUserConfigCommand.cs
index 4dcb7299..bbce7177 100644
--- a/GlazeWM.Domain/UserConfigs/Commands/EvaluateUserConfigCommand.cs
+++ b/GlazeWM.Domain/UserConfigs/Commands/EvaluateUserConfigCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.UserConfigs.Commands
{
diff --git a/GlazeWM.Domain/UserConfigs/Commands/RegisterKeybindingsCommand.cs b/GlazeWM.Domain/UserConfigs/Commands/RegisterKeybindingsCommand.cs
index 5ea34bbe..0bfedcf6 100644
--- a/GlazeWM.Domain/UserConfigs/Commands/RegisterKeybindingsCommand.cs
+++ b/GlazeWM.Domain/UserConfigs/Commands/RegisterKeybindingsCommand.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.UserConfigs.Commands
diff --git a/GlazeWM.Domain/UserConfigs/Commands/ReloadUserConfigCommand.cs b/GlazeWM.Domain/UserConfigs/Commands/ReloadUserConfigCommand.cs
index 4a10a237..f9dd71c2 100644
--- a/GlazeWM.Domain/UserConfigs/Commands/ReloadUserConfigCommand.cs
+++ b/GlazeWM.Domain/UserConfigs/Commands/ReloadUserConfigCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.UserConfigs.Commands
{
diff --git a/GlazeWM.Domain/UserConfigs/Events/UserConfigReloadedEvent.cs b/GlazeWM.Domain/UserConfigs/Events/UserConfigReloadedEvent.cs
index c9ccd36c..d14a1f6a 100644
--- a/GlazeWM.Domain/UserConfigs/Events/UserConfigReloadedEvent.cs
+++ b/GlazeWM.Domain/UserConfigs/Events/UserConfigReloadedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.UserConfigs.Events
{
diff --git a/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs b/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs
index c892fb5f..9065e067 100644
--- a/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs
@@ -6,7 +6,7 @@ namespace GlazeWM.Domain.UserConfigs
/// Text to display in vertical mode.
/// </summary>
public string TextVertical { get; set; } = "vertical";
-
+
/// <summary>
/// Text to display horizontal mode.
/// </summary>
diff --git a/GlazeWM.Domain/UserConfigs/UserConfig.cs b/GlazeWM.Domain/UserConfigs/UserConfig.cs
index a44bc995..d3ab3480 100644
--- a/GlazeWM.Domain/UserConfigs/UserConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/UserConfig.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace GlazeWM.Domain.UserConfigs
{
diff --git a/GlazeWM.Domain/UserConfigs/UserConfigService.cs b/GlazeWM.Domain/UserConfigs/UserConfigService.cs
index 67463c3f..61d1deaf 100644
--- a/GlazeWM.Domain/UserConfigs/UserConfigService.cs
+++ b/GlazeWM.Domain/UserConfigs/UserConfigService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
diff --git a/GlazeWM.Domain/UserConfigs/WindowRuleConfig.cs b/GlazeWM.Domain/UserConfigs/WindowRuleConfig.cs
index aaaaa4c9..b36c9078 100644
--- a/GlazeWM.Domain/UserConfigs/WindowRuleConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/WindowRuleConfig.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
@@ -33,7 +34,9 @@ namespace GlazeWM.Domain.UserConfigs
if (string.IsNullOrWhiteSpace(input))
return null;
- var isRegexLiteral = input.StartsWith("/") && input.EndsWith("/");
+ var isRegexLiteral =
+ input.StartsWith("/", StringComparison.InvariantCulture) &&
+ input.EndsWith("/", StringComparison.InvariantCulture);
// Allow user to pass a string that should be interpreted as regex (eg. "/steam/").
if (isRegexLiteral)
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/CloseWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/CloseWindowHandler.cs
index a0ba8c42..66b2bea1 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/CloseWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/CloseWindowHandler.cs
@@ -1,17 +1,17 @@
-using System;
+using System;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class CloseWindowHandler : ICommandHandler<CloseWindowCommand>
+ internal sealed class CloseWindowHandler : ICommandHandler<CloseWindowCommand>
{
public CommandResponse Handle(CloseWindowCommand command)
{
var windowToClose = command.WindowToClose;
- SendMessage(windowToClose.Handle, SendMessageType.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
+ SendMessage(windowToClose.Handle, SendMessageType.Close, IntPtr.Zero, IntPtr.Zero);
return CommandResponse.Ok;
}
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/IgnoreWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/IgnoreWindowHandler.cs
index 91517a01..b9784974 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/IgnoreWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/IgnoreWindowHandler.cs
@@ -1,11 +1,11 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class IgnoreWindowHandler : ICommandHandler<IgnoreWindowCommand>
+ internal sealed class IgnoreWindowHandler : ICommandHandler<IgnoreWindowCommand>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ManageWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ManageWindowHandler.cs
index 8386564f..df90c01d 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/ManageWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/ManageWindowHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Domain.Common.Utils;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
@@ -13,7 +13,7 @@ using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class ManageWindowHandler : ICommandHandler<ManageWindowCommand>
+ internal sealed class ManageWindowHandler : ICommandHandler<ManageWindowCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
@@ -35,9 +35,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
_logger = logger;
_monitorService = monitorService;
_windowService = windowService;
-
_userConfigService = userConfigService;
-
}
public CommandResponse Handle(ManageWindowCommand command)
@@ -103,43 +101,43 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
var defaultBorderDelta = new RectDelta(7, 0, 7, 7);
var windowType = GetWindowTypeToCreate(windowHandle);
- var isResizable = WindowService.HandleHasWindowStyle(windowHandle, WS.WS_THICKFRAME);
+ var isResizable = WindowService.HandleHasWindowStyle(windowHandle, WindowStyles.ThickFrame);
// TODO: Handle initialization of maximized and fullscreen windows.
return windowType switch
{
- WindowType.MINIMIZED => new MinimizedWindow(
+ WindowType.Minimized => new MinimizedWindow(
windowHandle,
floatingPlacement,
defaultBorderDelta,
- isResizable ? WindowType.TILING : WindowType.FLOATING
+ isResizable ? WindowType.Tiling : WindowType.Floating
),
- WindowType.FLOATING => new FloatingWindow(
+ WindowType.Floating => new FloatingWindow(
windowHandle,
floatingPlacement,
defaultBorderDelta
),
- WindowType.TILING => new TilingWindow(
+ WindowType.Tiling => new TilingWindow(
windowHandle,
floatingPlacement,
defaultBorderDelta
),
- WindowType.MAXIMIZED => throw new ArgumentException(null, nameof(windowHandle)),
- WindowType.FULLSCREEN => throw new ArgumentException(null, nameof(windowHandle)),
+ WindowType.Maximized => throw new ArgumentException(null, nameof(windowHandle)),
+ WindowType.Fullscreen => throw new ArgumentException(null, nameof(windowHandle)),
_ => throw new ArgumentException(null, nameof(windowHandle)),
};
}
private static WindowType GetWindowTypeToCreate(IntPtr windowHandle)
{
- if (WindowService.HandleHasWindowStyle(windowHandle, WS.WS_MINIMIZE))
- return WindowType.MINIMIZED;
+ if (WindowService.HandleHasWindowStyle(windowHandle, WindowStyles.Minimize))
+ return WindowType.Minimized;
// Initialize windows that can't be resized as floating.
- if (!WindowService.HandleHasWindowStyle(windowHandle, WS.WS_THICKFRAME))
- return WindowType.FLOATING;
+ if (!WindowService.HandleHasWindowStyle(windowHandle, WindowStyles.ThickFrame))
+ return WindowType.Floating;
- return WindowType.TILING;
+ return WindowType.Tiling;
}
private (SplitContainer targetParent, int targetIndex) GetInsertionTarget()
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/MoveWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/MoveWindowHandler.cs
index e48e858e..4d4252e8 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/MoveWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/MoveWindowHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
@@ -10,7 +10,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class MoveWindowHandler : ICommandHandler<MoveWindowCommand>
+ internal sealed class MoveWindowHandler : ICommandHandler<MoveWindowCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
@@ -75,7 +75,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
/// </summary>
private static bool HasSiblingInDirection(Window windowToMove, Direction direction)
{
- if (direction is Direction.UP or Direction.LEFT)
+ if (direction is Direction.Up or Direction.Left)
return windowToMove != windowToMove.SelfAndSiblingsOfType<IResizable>().First();
return windowToMove != windowToMove.SelfAndSiblingsOfType<IResizable>().Last();
@@ -83,14 +83,14 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
private void SwapSiblingContainers(Window windowToMove, Direction direction)
{
- var siblingInDirection = direction is Direction.UP or Direction.LEFT
+ var siblingInDirection = direction is Direction.Up or Direction.Left
? windowToMove.PreviousSiblingOfType<IResizable>()
: windowToMove.NextSiblingOfType<IResizable>();
// Swap the window with sibling in given direction.
if (siblingInDirection is Window)
{
- var targetIndex = direction is Direction.UP or Direction.LEFT ?
+ var targetIndex = direction is Direction.Up or Direction.Left ?
siblingInDirection.Index : siblingInDirection.Index + 1;
_bus.Invoke(
@@ -116,8 +116,8 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
var layoutForDirection = direction.GetCorrespondingLayout();
var shouldInsertAfter =
targetParent.Layout != layoutForDirection ||
- direction == Direction.UP ||
- direction == Direction.LEFT;
+ direction == Direction.Up ||
+ direction == Direction.Left;
var insertionIndex = shouldInsertAfter ? targetDescendant.Index + 1 : targetDescendant.Index;
_bus.Invoke(
@@ -145,7 +145,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
windowToMove.FloatingPlacement.TranslateToCenter(workspaceInDirection.ToRect());
// TODO: Descend into container if possible.
- if (direction is Direction.UP or Direction.LEFT)
+ if (direction is Direction.Up or Direction.Left)
_bus.Invoke(new MoveContainerWithinTreeCommand(windowToMove, workspaceInDirection, true));
else
_bus.Invoke(new MoveContainerWithinTreeCommand(windowToMove, workspaceInDirection, 0, true));
@@ -180,7 +180,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
var insertionReference = windowToMove.Ancestors
.FirstOrDefault(container => container.Parent == ancestorWithLayout);
- var insertionReferenceSibling = direction is Direction.UP or Direction.LEFT
+ var insertionReferenceSibling = direction is Direction.Up or Direction.Left
? insertionReference.PreviousSiblingOfType<IResizable>()
: insertionReference.NextSiblingOfType<IResizable>();
@@ -196,8 +196,8 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
var layoutForDirection = direction.GetCorrespondingLayout();
var shouldInsertAfter =
targetParent.Layout != layoutForDirection ||
- direction == Direction.UP ||
- direction == Direction.LEFT;
+ direction == Direction.Up ||
+ direction == Direction.Left;
var insertionIndex = shouldInsertAfter
? targetDescendant.Index + 1
@@ -208,7 +208,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
else
{
// Move the window into the container above.
- var insertionIndex = (direction is Direction.UP or Direction.LEFT) ?
+ var insertionIndex = (direction is Direction.Up or Direction.Left) ?
insertionReference.Index : insertionReference.Index + 1;
_bus.Invoke(new MoveContainerWithinTreeCommand(windowToMove, ancestorWithLayout, insertionIndex, true));
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowBordersHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowBordersHandler.cs
index 3f66fc8a..50b340f7 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowBordersHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowBordersHandler.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class ResizeWindowBordersHandler : ICommandHandler<ResizeWindowBordersCommand>
+ internal sealed class ResizeWindowBordersHandler : ICommandHandler<ResizeWindowBordersCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowHandler.cs
index fea49d54..5d1061a2 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/ResizeWindowHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
@@ -12,7 +12,7 @@ using GlazeWM.Infrastructure.Exceptions;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class ResizeWindowHandler : ICommandHandler<ResizeWindowCommand>
+ internal sealed class ResizeWindowHandler : ICommandHandler<ResizeWindowCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
@@ -67,8 +67,8 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
// Whether the resize is in the inverse direction of its layout.
var isInverseResize =
- (layout == Layout.HORIZONTAL && dimensionToResize == ResizeDimension.HEIGHT) ||
- (layout == Layout.VERTICAL && dimensionToResize == ResizeDimension.WIDTH);
+ (layout == Layout.Horizontal && dimensionToResize == ResizeDimension.Height) ||
+ (layout == Layout.Vertical && dimensionToResize == ResizeDimension.Width);
var hasResizableSiblings = windowToResize.SiblingsOfType<IResizable>().Any();
@@ -112,7 +112,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
var resizableLength = containerToResize.SelfAndSiblingsOfType<IResizable>().Aggregate(
1.0,
(sum, container) =>
- dimensionToResize == ResizeDimension.WIDTH
+ dimensionToResize == ResizeDimension.Width
? sum + container.Width
: sum + container.Height
);
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/RunWindowRulesHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/RunWindowRulesHandler.cs
index a48916ac..db91765a 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/RunWindowRulesHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/RunWindowRulesHandler.cs
@@ -1,11 +1,11 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class RunWindowRulesHandler : ICommandHandler<RunWindowRulesCommand>
+ internal sealed class RunWindowRulesHandler : ICommandHandler<RunWindowRulesCommand>
{
private readonly Bus _bus;
private readonly CommandParsingService _commandParsingService;
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/SetFloatingHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/SetFloatingHandler.cs
index a4267b83..1a84b218 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/SetFloatingHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/SetFloatingHandler.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Domain.Workspaces;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class SetFloatingHandler : ICommandHandler<SetFloatingCommand>
+ internal sealed class SetFloatingHandler : ICommandHandler<SetFloatingCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/SetMaximizedHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/SetMaximizedHandler.cs
index 76a47fa3..16988661 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/SetMaximizedHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/SetMaximizedHandler.cs
@@ -1,16 +1,16 @@
-using GlazeWM.Domain.Windows.Commands;
+using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class SetMaximizedHandler : ICommandHandler<SetMaximizedCommand>
+ internal sealed class SetMaximizedHandler : ICommandHandler<SetMaximizedCommand>
{
public CommandResponse Handle(SetMaximizedCommand command)
{
var window = command.Window;
- ShowWindow(window.Handle, ShowWindowCommands.MAXIMIZE);
+ ShowWindow(window.Handle, ShowWindowFlags.Maximize);
return CommandResponse.Ok;
}
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/SetMinimizedHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/SetMinimizedHandler.cs
index 5dddd89f..5fa007a4 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/SetMinimizedHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/SetMinimizedHandler.cs
@@ -1,16 +1,16 @@
-using GlazeWM.Domain.Windows.Commands;
+using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class SetMinimizedHandler : ICommandHandler<SetMinimizedCommand>
+ internal sealed class SetMinimizedHandler : ICommandHandler<SetMinimizedCommand>
{
public CommandResponse Handle(SetMinimizedCommand command)
{
var window = command.Window;
- ShowWindow(window.Handle, ShowWindowCommands.MINIMIZE);
+ ShowWindow(window.Handle, ShowWindowFlags.Minimize);
return CommandResponse.Ok;
}
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/SetTilingHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/SetTilingHandler.cs
index 4b1b8bf4..0abcabab 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/SetTilingHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/SetTilingHandler.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Domain.Workspaces;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class SetTilingHandler : ICommandHandler<SetTilingCommand>
+ internal sealed class SetTilingHandler : ICommandHandler<SetTilingCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs
index 260ca975..2b5c3f68 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs
@@ -1,11 +1,11 @@
-using System;
+using System;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class ShowAllWindowsHandler : ICommandHandler<ShowAllWindowsCommand>
+ internal sealed class ShowAllWindowsHandler : ICommandHandler<ShowAllWindowsCommand>
{
private readonly WindowService _windowService;
@@ -19,8 +19,8 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
// Show all windows regardless of whether their workspace is displayed.
foreach (var window in _windowService.GetWindows())
{
- const SWP flags = SWP.SWP_FRAMECHANGED | SWP.SWP_NOACTIVATE | SWP.SWP_NOCOPYBITS |
- SWP.SWP_NOZORDER | SWP.SWP_NOOWNERZORDER | SWP.SWP_NOSENDCHANGING | SWP.SWP_SHOWWINDOW;
+ const SetWindowPosFlags flags = SetWindowPosFlags.FrameChanged | SetWindowPosFlags.NoActivate | SetWindowPosFlags.NoCopyBits |
+ SetWindowPosFlags.NoZOrder | SetWindowPosFlags.NoOwnerZOrder | SetWindowPosFlags.NoSendChanging | SetWindowPosFlags.ShowWindow;
SetWindowPos(
window.Handle,
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs
index f7b0d906..4f2e55aa 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs
@@ -1,9 +1,9 @@
-using GlazeWM.Domain.Windows.Commands;
+using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class ToggleFloatingHandler : ICommandHandler<ToggleFloatingCommand>
+ internal sealed class ToggleFloatingHandler : ICommandHandler<ToggleFloatingCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ToggleMaximizedHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ToggleMaximizedHandler.cs
index d5fe4735..e7717033 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/ToggleMaximizedHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/ToggleMaximizedHandler.cs
@@ -1,19 +1,19 @@
-using GlazeWM.Domain.Windows.Commands;
+using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class ToggleMaximizedHandler : ICommandHandler<ToggleMaximizedCommand>
+ internal sealed class ToggleMaximizedHandler : ICommandHandler<ToggleMaximizedCommand>
{
public CommandResponse Handle(ToggleMaximizedCommand command)
{
var window = command.Window;
- if (window.HasWindowStyle(WS.WS_MAXIMIZE))
- ShowWindow(window.Handle, ShowWindowCommands.RESTORE);
+ if (window.HasWindowStyle(WindowStyles.Maximize))
+ ShowWindow(window.Handle, ShowWindowFlags.Restore);
else
- ShowWindow(window.Handle, ShowWindowCommands.MAXIMIZE);
+ ShowWindow(window.Handle, ShowWindowFlags.Maximize);
return CommandResponse.Ok;
}
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/UnmanageWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/UnmanageWindowHandler.cs
index d7212525..ea62595a 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/UnmanageWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/UnmanageWindowHandler.cs
@@ -1,11 +1,11 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.CommandHandlers
{
- internal class UnmanageWindowHandler : ICommandHandler<UnmanageWindowCommand>
+ internal sealed class UnmanageWindowHandler : ICommandHandler<UnmanageWindowCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Windows/Commands/CloseWindowCommand.cs b/GlazeWM.Domain/Windows/Commands/CloseWindowCommand.cs
index c599dc42..72e90248 100644
--- a/GlazeWM.Domain/Windows/Commands/CloseWindowCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/CloseWindowCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/IgnoreWindowCommand.cs b/GlazeWM.Domain/Windows/Commands/IgnoreWindowCommand.cs
index c65d4c34..ab3d784e 100644
--- a/GlazeWM.Domain/Windows/Commands/IgnoreWindowCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/IgnoreWindowCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/ManageWindowCommand.cs b/GlazeWM.Domain/Windows/Commands/ManageWindowCommand.cs
index 4e05e1cc..a25c58db 100644
--- a/GlazeWM.Domain/Windows/Commands/ManageWindowCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/ManageWindowCommand.cs
@@ -1,6 +1,6 @@
-using GlazeWM.Domain.Containers;
-using GlazeWM.Infrastructure.Bussing;
using System;
+using GlazeWM.Domain.Containers;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/MoveWindowCommand.cs b/GlazeWM.Domain/Windows/Commands/MoveWindowCommand.cs
index 6d5895a5..64c49f5b 100644
--- a/GlazeWM.Domain/Windows/Commands/MoveWindowCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/MoveWindowCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
diff --git a/GlazeWM.Domain/Windows/Commands/ResizeWindowBordersCommand.cs b/GlazeWM.Domain/Windows/Commands/ResizeWindowBordersCommand.cs
index b263c07c..e31ba898 100644
--- a/GlazeWM.Domain/Windows/Commands/ResizeWindowBordersCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/ResizeWindowBordersCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Windows.Commands
diff --git a/GlazeWM.Domain/Windows/Commands/ResizeWindowCommand.cs b/GlazeWM.Domain/Windows/Commands/ResizeWindowCommand.cs
index 46f238d3..dc279f1b 100644
--- a/GlazeWM.Domain/Windows/Commands/ResizeWindowCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/ResizeWindowCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
diff --git a/GlazeWM.Domain/Windows/Commands/RunWindowRulesCommand.cs b/GlazeWM.Domain/Windows/Commands/RunWindowRulesCommand.cs
index 237f4c66..24669240 100644
--- a/GlazeWM.Domain/Windows/Commands/RunWindowRulesCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/RunWindowRulesCommand.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Infrastructure.Bussing;
diff --git a/GlazeWM.Domain/Windows/Commands/SetFloatingCommand.cs b/GlazeWM.Domain/Windows/Commands/SetFloatingCommand.cs
index c16ff601..0504f86e 100644
--- a/GlazeWM.Domain/Windows/Commands/SetFloatingCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/SetFloatingCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/SetMaximizedCommand.cs b/GlazeWM.Domain/Windows/Commands/SetMaximizedCommand.cs
index edc55d2a..768c0bc9 100644
--- a/GlazeWM.Domain/Windows/Commands/SetMaximizedCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/SetMaximizedCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/SetMinimizedCommand.cs b/GlazeWM.Domain/Windows/Commands/SetMinimizedCommand.cs
index b2e4529d..22640e14 100644
--- a/GlazeWM.Domain/Windows/Commands/SetMinimizedCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/SetMinimizedCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/SetTilingCommand.cs b/GlazeWM.Domain/Windows/Commands/SetTilingCommand.cs
index f141b151..a7670843 100644
--- a/GlazeWM.Domain/Windows/Commands/SetTilingCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/SetTilingCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs b/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs
index 4a0037a1..ab555813 100644
--- a/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/ToggleFloatingCommand.cs b/GlazeWM.Domain/Windows/Commands/ToggleFloatingCommand.cs
index f58149d9..4c36e188 100644
--- a/GlazeWM.Domain/Windows/Commands/ToggleFloatingCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/ToggleFloatingCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/ToggleMaximizedCommand.cs b/GlazeWM.Domain/Windows/Commands/ToggleMaximizedCommand.cs
index b088ef19..ae012b4c 100644
--- a/GlazeWM.Domain/Windows/Commands/ToggleMaximizedCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/ToggleMaximizedCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/Commands/UnmanageWindowCommand.cs b/GlazeWM.Domain/Windows/Commands/UnmanageWindowCommand.cs
index 397e6f23..bf9d3026 100644
--- a/GlazeWM.Domain/Windows/Commands/UnmanageWindowCommand.cs
+++ b/GlazeWM.Domain/Windows/Commands/UnmanageWindowCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Commands
{
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs
index 9cf89f64..2c318b51 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Common.Utils;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Monitors.Commands;
@@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowDestroyedHandler : IEventHandler<WindowDestroyedEvent>
+ internal sealed class WindowDestroyedHandler : IEventHandler<WindowDestroyedEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowFocusedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowFocusedHandler.cs
index 50f6e947..de0d90e5 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowFocusedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowFocusedHandler.cs
@@ -8,7 +8,7 @@ using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowFocusedHandler : IEventHandler<WindowFocusedEvent>
+ internal sealed class WindowFocusedHandler : IEventHandler<WindowFocusedEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs
index d0aaaafb..47c36430 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Common.Utils;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Monitors.Commands;
@@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowHiddenHandler : IEventHandler<WindowHiddenEvent>
+ internal sealed class WindowHiddenHandler : IEventHandler<WindowHiddenEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowLocationChangedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowLocationChangedHandler.cs
index 23213b8b..ed661fa2 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowLocationChangedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowLocationChangedHandler.cs
@@ -1,10 +1,10 @@
-using GlazeWM.Domain.Monitors.Commands;
+using GlazeWM.Domain.Monitors.Commands;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.Events;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowLocationChangedHandler : IEventHandler<WindowLocationChangedEvent>
+ internal sealed class WindowLocationChangedHandler : IEventHandler<WindowLocationChangedEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs
index 9247c90c..a9572677 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs
@@ -10,7 +10,7 @@ using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowMinimizeEndedHandler : IEventHandler<WindowMinimizeEndedEvent>
+ internal sealed class WindowMinimizeEndedHandler : IEventHandler<WindowMinimizeEndedEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
@@ -70,29 +70,29 @@ namespace GlazeWM.Domain.Windows.EventHandlers
{
return window.PreviousState switch
{
- WindowType.FLOATING => new FloatingWindow(
+ WindowType.Floating => new FloatingWindow(
window.Handle,
window.FloatingPlacement,
window.BorderDelta
),
- WindowType.MAXIMIZED => new MaximizedWindow(
+ WindowType.Maximized => new MaximizedWindow(
window.Handle,
window.FloatingPlacement,
window.BorderDelta
),
- WindowType.FULLSCREEN => new FullscreenWindow(
+ WindowType.Fullscreen => new FullscreenWindow(
window.Handle,
window.FloatingPlacement,
window.BorderDelta
),
// Set `SizePercentage` to 0 to correctly resize the container when moved within tree.
- WindowType.TILING => new TilingWindow(
+ WindowType.Tiling => new TilingWindow(
window.Handle,
window.FloatingPlacement,
window.BorderDelta,
0
),
- WindowType.MINIMIZED => throw new ArgumentException(null, nameof(window)),
+ WindowType.Minimized => throw new ArgumentException(null, nameof(window)),
_ => throw new ArgumentException(null, nameof(window)),
};
}
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs
index 2994e75c..07f2dff2 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs
@@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowMinimizedHandler : IEventHandler<WindowMinimizedEvent>
+ internal sealed class WindowMinimizedHandler : IEventHandler<WindowMinimizedEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMovedOrResizedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMovedOrResizedHandler.cs
index c520a5b9..f0632207 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMovedOrResizedHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMovedOrResizedHandler.cs
@@ -14,7 +14,7 @@ using Microsoft.Extensions.Logging;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowMovedOrResizedHandler : IEventHandler<WindowMovedOrResizedEvent>
+ internal sealed class WindowMovedOrResizedHandler : IEventHandler<WindowMovedOrResizedEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
@@ -82,8 +82,8 @@ namespace GlazeWM.Domain.Windows.EventHandlers
var deltaWidth = adjustedPlacement.Width - window.Width;
var deltaHeight = adjustedPlacement.Height - window.Height;
- _bus.Invoke(new ResizeWindowCommand(window, ResizeDimension.WIDTH, $"{deltaWidth}px"));
- _bus.Invoke(new ResizeWindowCommand(window, ResizeDimension.HEIGHT, $"{deltaHeight}px"));
+ _bus.Invoke(new ResizeWindowCommand(window, ResizeDimension.Width, $"{deltaWidth}px"));
+ _bus.Invoke(new ResizeWindowCommand(window, ResizeDimension.Height, $"{deltaHeight}px"));
}
private void UpdateFloatingWindow(FloatingWindow window)
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowShownHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowShownHandler.cs
index 342993f0..50e70443 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowShownHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowShownHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Monitors.Commands;
using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Infrastructure.Bussing;
@@ -6,7 +6,7 @@ using GlazeWM.Infrastructure.Common.Events;
namespace GlazeWM.Domain.Windows.EventHandlers
{
- internal class WindowShownHandler : IEventHandler<WindowShownEvent>
+ internal sealed class WindowShownHandler : IEventHandler<WindowShownEvent>
{
private readonly Bus _bus;
private readonly WindowService _windowService;
diff --git a/GlazeWM.Domain/Windows/Events/FocusedWindowMovedEvent.cs b/GlazeWM.Domain/Windows/Events/FocusedWindowMovedEvent.cs
index f0d31cc7..24f6e1c9 100644
--- a/GlazeWM.Domain/Windows/Events/FocusedWindowMovedEvent.cs
+++ b/GlazeWM.Domain/Windows/Events/FocusedWindowMovedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Events
diff --git a/GlazeWM.Domain/Windows/FloatingWindow.cs b/GlazeWM.Domain/Windows/FloatingWindow.cs
index 1c1ec230..b6988174 100644
--- a/GlazeWM.Domain/Windows/FloatingWindow.cs
+++ b/GlazeWM.Domain/Windows/FloatingWindow.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Windows
diff --git a/GlazeWM.Domain/Windows/FullscreenWindow.cs b/GlazeWM.Domain/Windows/FullscreenWindow.cs
index 1e691b1b..522cfd08 100644
--- a/GlazeWM.Domain/Windows/FullscreenWindow.cs
+++ b/GlazeWM.Domain/Windows/FullscreenWindow.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Windows
diff --git a/GlazeWM.Domain/Windows/MaximizedWindow.cs b/GlazeWM.Domain/Windows/MaximizedWindow.cs
index 0d927f3c..556be64b 100644
--- a/GlazeWM.Domain/Windows/MaximizedWindow.cs
+++ b/GlazeWM.Domain/Windows/MaximizedWindow.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Windows
diff --git a/GlazeWM.Domain/Windows/MinimizedWindow.cs b/GlazeWM.Domain/Windows/MinimizedWindow.cs
index 78ddd1e6..ae6c52d7 100644
--- a/GlazeWM.Domain/Windows/MinimizedWindow.cs
+++ b/GlazeWM.Domain/Windows/MinimizedWindow.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Windows
diff --git a/GlazeWM.Domain/Windows/TilingWindow.cs b/GlazeWM.Domain/Windows/TilingWindow.cs
index 0f6b164c..d6be9da9 100644
--- a/GlazeWM.Domain/Windows/TilingWindow.cs
+++ b/GlazeWM.Domain/Windows/TilingWindow.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Domain.Containers;
using GlazeWM.Infrastructure;
using GlazeWM.Infrastructure.WindowsApi;
diff --git a/GlazeWM.Domain/Windows/Window.cs b/GlazeWM.Domain/Windows/Window.cs
index 09b8ca52..ddbc9a13 100644
--- a/GlazeWM.Domain/Windows/Window.cs
+++ b/GlazeWM.Domain/Windows/Window.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Workspaces;
using GlazeWM.Infrastructure.WindowsApi;
@@ -53,16 +53,16 @@ namespace GlazeWM.Domain.Windows
public bool IsManageable => WindowService.IsHandleManageable(Handle);
- public WS WindowStyles => WindowService.GetWindowStyles(Handle);
+ public WindowStyles WindowStyles => WindowService.GetWindowStyles(Handle);
- public WS_EX WindowStylesEx => WindowService.GetWindowStylesEx(Handle);
+ public WindowStylesEx WindowStylesEx => WindowService.GetWindowStylesEx(Handle);
- public bool HasWindowStyle(WS style)
+ public bool HasWindowStyle(WindowStyles style)
{
return WindowService.HandleHasWindowStyle(Handle, style);
}
- public bool HasWindowExStyle(WS_EX style)
+ public bool HasWindowExStyle(WindowStylesEx style)
{
return WindowService.HandleHasWindowExStyle(Handle, style);
}
diff --git a/GlazeWM.Domain/Windows/WindowService.cs b/GlazeWM.Domain/Windows/WindowService.cs
index 36834f9d..da8b7487 100644
--- a/GlazeWM.Domain/Windows/WindowService.cs
+++ b/GlazeWM.Domain/Windows/WindowService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@@ -115,22 +115,22 @@ namespace GlazeWM.Domain.Windows
return windowHandles;
}
- public static WS_EX GetWindowStylesEx(IntPtr handle)
+ public static WindowStylesEx GetWindowStylesEx(IntPtr handle)
{
- return unchecked((WS_EX)GetWindowLongPtr(handle, GWL_EXSTYLE).ToInt64());
+ return unchecked((WindowStylesEx)GetWindowLongPtr(handle, GWLEXSTYLE).ToInt64());
}
- public static WS GetWindowStyles(IntPtr handle)
+ public static WindowStyles GetWindowStyles(IntPtr handle)
{
- return unchecked((WS)GetWindowLongPtr(handle, GWL_STYLE).ToInt64());
+ return unchecked((WindowStyles)GetWindowLongPtr(handle, GWLSTYLE).ToInt64());
}
- public static bool HandleHasWindowStyle(IntPtr handle, WS style)
+ public static bool HandleHasWindowStyle(IntPtr handle, WindowStyles style)
{
return (GetWindowStyles(handle) & style) != 0;
}
- public static bool HandleHasWindowExStyle(IntPtr handle, WS_EX style)
+ public static bool HandleHasWindowExStyle(IntPtr handle, WindowStylesEx style)
{
return (GetWindowStylesEx(handle) & style) != 0;
}
@@ -144,7 +144,7 @@ namespace GlazeWM.Domain.Windows
{
_ = DwmGetWindowAttribute(
handle,
- DwmWindowAttribute.DWMWA_CLOAKED,
+ DwmWindowAttribute.Cloaked,
out var isCloaked,
Marshal.SizeOf(typeof(bool))
);
@@ -168,8 +168,8 @@ namespace GlazeWM.Domain.Windows
// Ensure window is top-level (ie. not a child window). Ignore windows that cannot be focused
// or if they're unavailable in task switcher (alt+tab menu).
- var isApplicationWindow = !HandleHasWindowStyle(handle, WS.WS_CHILD)
- && !HandleHasWindowExStyle(handle, WS_EX.WS_EX_NOACTIVATE | WS_EX.WS_EX_TOOLWINDOW);
+ var isApplicationWindow = !HandleHasWindowStyle(handle, WindowStyles.Child)
+ && !HandleHasWindowExStyle(handle, WindowStylesEx.NoActivate | WindowStylesEx.ToolWindow);
if (!isApplicationWindow)
return false;
@@ -177,8 +177,8 @@ namespace GlazeWM.Domain.Windows
/// Some applications spawn top-level windows for menus that should be ignored. This includes
/// the autocomplete popup in Notepad++ and title bar menu in Keepass. Although not
/// foolproof, these can typically be identified by having an owner window and no title bar.
- var isMenuWindow = GetWindow(handle, GW.GW_OWNER) != IntPtr.Zero
- && !HandleHasWindowStyle(handle, WS.WS_CAPTION);
+ var isMenuWindow = GetWindow(handle, GW.Owner) != IntPtr.Zero
+ && !HandleHasWindowStyle(handle, WindowStyles.Capion);
return !isMenuWindow;
}
@@ -216,10 +216,10 @@ namespace GlazeWM.Domain.Windows
{
return window switch
{
- TilingWindow => WindowType.TILING,
- FloatingWindow => WindowType.FLOATING,
- MaximizedWindow => WindowType.MAXIMIZED,
- FullscreenWindow => WindowType.FULLSCREEN,
+ TilingWindow => WindowType.Tiling,
+ FloatingWindow => WindowType.Floating,
+ MaximizedWindow => WindowType.Maximized,
+ FullscreenWindow => WindowType.Fullscreen,
_ => throw new ArgumentException(null, nameof(window)),
};
}
diff --git a/GlazeWM.Domain/Windows/WindowType.cs b/GlazeWM.Domain/Windows/WindowType.cs
index 064252d7..1823abe9 100644
--- a/GlazeWM.Domain/Windows/WindowType.cs
+++ b/GlazeWM.Domain/Windows/WindowType.cs
@@ -2,10 +2,10 @@ namespace GlazeWM.Domain.Windows
{
public enum WindowType
{
- TILING,
- FLOATING,
- MINIMIZED,
- MAXIMIZED,
- FULLSCREEN,
+ Tiling,
+ Floating,
+ Minimized,
+ Maximized,
+ Fullscreen,
}
}
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs
index a34791ce..e19f9c30 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs
@@ -1,12 +1,12 @@
-using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Domain.Workspaces.Commands;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers.Commands;
+using GlazeWM.Domain.Workspaces.Commands;
using GlazeWM.Domain.Workspaces.Events;
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class ActivateWorkspaceHandler : ICommandHandler<ActivateWorkspaceCommand>
+ internal sealed class ActivateWorkspaceHandler : ICommandHandler<ActivateWorkspaceCommand>
{
private readonly Bus _bus;
@@ -20,7 +20,7 @@ namespace GlazeWM.Domain.Workspaces.CommandHandlers
var workspaceName = command.WorkspaceName;
var targetMonitor = command.TargetMonitor;
- Layout layout = targetMonitor.Height > targetMonitor.Width ? Layout.VERTICAL : Layout.HORIZONTAL;
+ var layout = targetMonitor.Height > targetMonitor.Width ? Layout.Vertical : Layout.Horizontal;
var newWorkspace = new Workspace(workspaceName, layout);
// Attach the created workspace to the specified monitor.
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs
index 88993791..7733d870 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs
@@ -1,11 +1,11 @@
-using GlazeWM.Domain.Containers.Commands;
+using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Workspaces.Commands;
using GlazeWM.Domain.Workspaces.Events;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class DeactivateWorkspaceHandler : ICommandHandler<DeactivateWorkspaceCommand>
+ internal sealed class DeactivateWorkspaceHandler : ICommandHandler<DeactivateWorkspaceCommand>
{
public Bus _bus { get; }
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs
index 1eb3e62f..f8a38964 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs
@@ -1,15 +1,15 @@
-using GlazeWM.Infrastructure.Bussing;
+using System.Linq;
+using GlazeWM.Domain.Containers;
+using GlazeWM.Domain.Containers.Commands;
+using GlazeWM.Domain.Containers.Events;
using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.Workspaces.Commands;
-using GlazeWM.Domain.Containers;
-using GlazeWM.Domain.Containers.Events;
-using GlazeWM.Domain.Containers.Commands;
-using System.Linq;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class FocusWorkspaceHandler : ICommandHandler<FocusWorkspaceCommand>
+ internal sealed class FocusWorkspaceHandler : ICommandHandler<FocusWorkspaceCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceRecentHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceRecentHandler.cs
index abcb27cc..37da5177 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceRecentHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceRecentHandler.cs
@@ -1,11 +1,11 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.Workspaces.Commands;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class FocusWorkspaceRecentHandler : ICommandHandler<FocusWorkspaceRecentCommand>
+ internal sealed class FocusWorkspaceRecentHandler : ICommandHandler<FocusWorkspaceRecentCommand>
{
private readonly Bus _bus;
private readonly UserConfigService _userConfigService;
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceSequenceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceSequenceHandler.cs
index 7e682ec5..30bf9ead 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceSequenceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceSequenceHandler.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.UserConfigs;
@@ -7,7 +7,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class FocusWorkspaceSequenceHandler : ICommandHandler<FocusWorkspaceSequenceCommand>
+ internal sealed class FocusWorkspaceSequenceHandler : ICommandHandler<FocusWorkspaceSequenceCommand>
{
private readonly Bus _bus;
private readonly UserConfigService _userConfigService;
@@ -44,8 +44,8 @@ namespace GlazeWM.Domain.Workspaces.CommandHandlers
// there is no previous/next workspace.
var indexToFocus = direction switch
{
- Sequence.PREVIOUS => configIndex == 0 ? sortedWorkspaces.Count - 1 : configIndex - 1,
- Sequence.NEXT => configIndex == sortedWorkspaces.Count - 1 ? 0 : configIndex + 1,
+ Sequence.Previous => configIndex == 0 ? sortedWorkspaces.Count - 1 : configIndex - 1,
+ Sequence.Next => configIndex == sortedWorkspaces.Count - 1 ? 0 : configIndex + 1,
_ => throw new ArgumentException(nameof(direction)),
};
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWindowToWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWindowToWorkspaceHandler.cs
index f92aff21..3919cc9c 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWindowToWorkspaceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWindowToWorkspaceHandler.cs
@@ -1,14 +1,14 @@
-using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Containers.Commands;
+using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.Windows;
using GlazeWM.Domain.Workspaces.Commands;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class MoveWindowToWorkspaceHandler : ICommandHandler<MoveWindowToWorkspaceCommand>
+ internal sealed class MoveWindowToWorkspaceHandler : ICommandHandler<MoveWindowToWorkspaceCommand>
{
private readonly Bus _bus;
private readonly ContainerService _containerService;
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWorkspaceInDirectionHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWorkspaceInDirectionHandler.cs
index 9ced1909..4cef0130 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWorkspaceInDirectionHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/MoveWorkspaceInDirectionHandler.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.Windows;
@@ -9,7 +9,7 @@ using GlazeWM.Infrastructure.Exceptions;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class MoveWorkspaceInDirectionHandler :
+ internal sealed class MoveWorkspaceInDirectionHandler :
ICommandHandler<MoveWorkspaceInDirectionCommand>
{
private readonly Bus _bus;
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/UpdateWorkspacesFromConfigHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/UpdateWorkspacesFromConfigHandler.cs
index 01c94e0d..9490df0b 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/UpdateWorkspacesFromConfigHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/UpdateWorkspacesFromConfigHandler.cs
@@ -1,11 +1,11 @@
-using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Domain.Workspaces.Commands;
using GlazeWM.Domain.Monitors;
+using GlazeWM.Domain.Workspaces.Commands;
+using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Exceptions;
namespace GlazeWM.Domain.Workspaces.CommandHandlers
{
- internal class UpdateWorkspacesFromConfigHandler :
+ internal sealed class UpdateWorkspacesFromConfigHandler :
ICommandHandler<UpdateWorkspacesFromConfigCommand>
{
private readonly WorkspaceService _workspaceService;
diff --git a/GlazeWM.Domain/Workspaces/Commands/ActivateWorkspaceCommand.cs b/GlazeWM.Domain/Workspaces/Commands/ActivateWorkspaceCommand.cs
index 533d7ea9..21d02822 100644
--- a/GlazeWM.Domain/Workspaces/Commands/ActivateWorkspaceCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/ActivateWorkspaceCommand.cs
@@ -1,9 +1,9 @@
-using GlazeWM.Domain.Monitors;
+using GlazeWM.Domain.Monitors;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
- internal class ActivateWorkspaceCommand : Command
+ internal sealed class ActivateWorkspaceCommand : Command
{
public string WorkspaceName { get; }
public Monitor TargetMonitor { get; }
diff --git a/GlazeWM.Domain/Workspaces/Commands/DeactivateWorkspaceCommand.cs b/GlazeWM.Domain/Workspaces/Commands/DeactivateWorkspaceCommand.cs
index 8812ac3a..81b05256 100644
--- a/GlazeWM.Domain/Workspaces/Commands/DeactivateWorkspaceCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/DeactivateWorkspaceCommand.cs
@@ -1,8 +1,8 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
- internal class DeactivateWorkspaceCommand : Command
+ internal sealed class DeactivateWorkspaceCommand : Command
{
public Workspace Workspace { get; }
diff --git a/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceCommand.cs b/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceCommand.cs
index e0dca6be..88a31a97 100644
--- a/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
diff --git a/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceRecentCommand.cs b/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceRecentCommand.cs
index 43d196da..dce6c575 100644
--- a/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceRecentCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceRecentCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
diff --git a/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceSequenceCommand.cs b/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceSequenceCommand.cs
index f9a7adac..f0936462 100644
--- a/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceSequenceCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/FocusWorkspaceSequenceCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
diff --git a/GlazeWM.Domain/Workspaces/Commands/MoveWindowToWorkspaceCommand.cs b/GlazeWM.Domain/Workspaces/Commands/MoveWindowToWorkspaceCommand.cs
index df1e677a..1b2f6f14 100644
--- a/GlazeWM.Domain/Workspaces/Commands/MoveWindowToWorkspaceCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/MoveWindowToWorkspaceCommand.cs
@@ -1,9 +1,9 @@
-using GlazeWM.Domain.Windows;
+using GlazeWM.Domain.Windows;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
- internal class MoveWindowToWorkspaceCommand : Command
+ internal sealed class MoveWindowToWorkspaceCommand : Command
{
public Window WindowToMove { get; }
public string WorkspaceName { get; }
diff --git a/GlazeWM.Domain/Workspaces/Commands/MoveWorkspaceInDirectionCommand.cs b/GlazeWM.Domain/Workspaces/Commands/MoveWorkspaceInDirectionCommand.cs
index 67831835..cadb3c70 100644
--- a/GlazeWM.Domain/Workspaces/Commands/MoveWorkspaceInDirectionCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/MoveWorkspaceInDirectionCommand.cs
@@ -1,9 +1,9 @@
-using GlazeWM.Domain.Common.Enums;
+using GlazeWM.Domain.Common.Enums;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
- internal class MoveWorkspaceInDirectionCommand : Command
+ internal sealed class MoveWorkspaceInDirectionCommand : Command
{
// TODO: Add argument for workspace to move instead of assuming the focused workspace.
public Direction Direction { get; }
diff --git a/GlazeWM.Domain/Workspaces/Commands/UpdateWorkspacesFromConfigCommand.cs b/GlazeWM.Domain/Workspaces/Commands/UpdateWorkspacesFromConfigCommand.cs
index 84f6c6a0..78f24c55 100644
--- a/GlazeWM.Domain/Workspaces/Commands/UpdateWorkspacesFromConfigCommand.cs
+++ b/GlazeWM.Domain/Workspaces/Commands/UpdateWorkspacesFromConfigCommand.cs
@@ -4,7 +4,7 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Commands
{
- internal class UpdateWorkspacesFromConfigCommand : Command
+ internal sealed class UpdateWorkspacesFromConfigCommand : Command
{
public List<WorkspaceConfig> WorkspaceConfigs { get; }
diff --git a/GlazeWM.Domain/Workspaces/Events/WorkspaceActivatedEvent.cs b/GlazeWM.Domain/Workspaces/Events/WorkspaceActivatedEvent.cs
index f1f0eda7..a05e8b26 100644
--- a/GlazeWM.Domain/Workspaces/Events/WorkspaceActivatedEvent.cs
+++ b/GlazeWM.Domain/Workspaces/Events/WorkspaceActivatedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Events
{
diff --git a/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs b/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs
index fe2fb678..a39fe478 100644
--- a/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs
+++ b/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Events
{
diff --git a/GlazeWM.Domain/Workspaces/Workspace.cs b/GlazeWM.Domain/Workspaces/Workspace.cs
index 59b324ca..65c2f801 100644
--- a/GlazeWM.Domain/Workspaces/Workspace.cs
+++ b/GlazeWM.Domain/Workspaces/Workspace.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Monitors;
@@ -65,7 +65,7 @@ namespace GlazeWM.Domain.Workspaces
public Workspace(string name, Layout layout)
{
- this.Layout = layout;
+ Layout = layout;
Id = $"WORKSPACE/{name}";
Name = name;
}
diff --git a/GlazeWM.Domain/Workspaces/WorkspaceService.cs b/GlazeWM.Domain/Workspaces/WorkspaceService.cs
index 1af510f5..27aec95f 100644
--- a/GlazeWM.Domain/Workspaces/WorkspaceService.cs
+++ b/GlazeWM.Domain/Workspaces/WorkspaceService.cs
@@ -1,8 +1,8 @@
-using GlazeWM.Domain.Containers;
-using GlazeWM.Domain.UserConfigs;
using System.Collections.Generic;
using System.Linq;
+using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Monitors;
+using GlazeWM.Domain.UserConfigs;
namespace GlazeWM.Domain.Workspaces
{
diff --git a/GlazeWM.Infrastructure/Bussing/Bus.cs b/GlazeWM.Infrastructure/Bussing/Bus.cs
index 38c73518..3ebffad7 100644
--- a/GlazeWM.Infrastructure/Bussing/Bus.cs
+++ b/GlazeWM.Infrastructure/Bussing/Bus.cs
@@ -1,9 +1,9 @@
-using GlazeWM.Infrastructure.Common.Commands;
-using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Reactive.Subjects;
using System.Threading.Tasks;
+using GlazeWM.Infrastructure.Common.Commands;
+using Microsoft.Extensions.Logging;
namespace GlazeWM.Infrastructure.Bussing
{
@@ -28,7 +28,7 @@ namespace GlazeWM.Infrastructure.Bussing
{
lock (LockObj)
{
- _logger.LogDebug("Command {commandName} invoked.", command.Name);
+ _logger.LogDebug("Command {CommandName} invoked.", command.Name);
// Create a `Type` object representing the constructed `ICommandHandler` generic.
var handlerType = typeof(ICommandHandler<>).MakeGenericType(command.GetType());
diff --git a/GlazeWM.Infrastructure/Bussing/Command.cs b/GlazeWM.Infrastructure/Bussing/Command.cs
index 3a583df4..b57ff738 100644
--- a/GlazeWM.Infrastructure/Bussing/Command.cs
+++ b/GlazeWM.Infrastructure/Bussing/Command.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.Bussing
+namespace GlazeWM.Infrastructure.Bussing
{
public class Command
{
diff --git a/GlazeWM.Infrastructure/Bussing/CommandResponse.cs b/GlazeWM.Infrastructure/Bussing/CommandResponse.cs
index 8d1d6f28..0c483755 100644
--- a/GlazeWM.Infrastructure/Bussing/CommandResponse.cs
+++ b/GlazeWM.Infrastructure/Bussing/CommandResponse.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.Bussing
+namespace GlazeWM.Infrastructure.Bussing
{
public class CommandResponse
{
diff --git a/GlazeWM.Infrastructure/Bussing/Event.cs b/GlazeWM.Infrastructure/Bussing/Event.cs
index 4dcb731a..6bbe6af4 100644
--- a/GlazeWM.Infrastructure/Bussing/Event.cs
+++ b/GlazeWM.Infrastructure/Bussing/Event.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.Bussing
+namespace GlazeWM.Infrastructure.Bussing
{
public class Event
{
diff --git a/GlazeWM.Infrastructure/Bussing/ICommandHandler.cs b/GlazeWM.Infrastructure/Bussing/ICommandHandler.cs
index 337fbcad..5f44e460 100644
--- a/GlazeWM.Infrastructure/Bussing/ICommandHandler.cs
+++ b/GlazeWM.Infrastructure/Bussing/ICommandHandler.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.Bussing
+namespace GlazeWM.Infrastructure.Bussing
{
public interface ICommandHandler<TCommand> where TCommand : Command
{
diff --git a/GlazeWM.Infrastructure/Bussing/IEventHandler.cs b/GlazeWM.Infrastructure/Bussing/IEventHandler.cs
index f3f8f30f..6b8f6a65 100644
--- a/GlazeWM.Infrastructure/Bussing/IEventHandler.cs
+++ b/GlazeWM.Infrastructure/Bussing/IEventHandler.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.Bussing
+namespace GlazeWM.Infrastructure.Bussing
{
public interface IEventHandler<TEvent> where TEvent : Event
{
diff --git a/GlazeWM.Infrastructure/Common/CommandHandlers/NoopHandler.cs b/GlazeWM.Infrastructure/Common/CommandHandlers/NoopHandler.cs
index 4c8d4c90..38600368 100644
--- a/GlazeWM.Infrastructure/Common/CommandHandlers/NoopHandler.cs
+++ b/GlazeWM.Infrastructure/Common/CommandHandlers/NoopHandler.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.Commands;
namespace GlazeWM.Infrastructure.Common.CommandHandlers
diff --git a/GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs b/GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs
index 0cb158ab..14ea790c 100644
--- a/GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs
+++ b/GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Commands
{
diff --git a/GlazeWM.Infrastructure/Common/Commands/HandleFatalExceptionCommand.cs b/GlazeWM.Infrastructure/Common/Commands/HandleFatalExceptionCommand.cs
index 6dab324b..26d09b6a 100644
--- a/GlazeWM.Infrastructure/Common/Commands/HandleFatalExceptionCommand.cs
+++ b/GlazeWM.Infrastructure/Common/Commands/HandleFatalExceptionCommand.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Commands
diff --git a/GlazeWM.Infrastructure/Common/Commands/NoopCommand.cs b/GlazeWM.Infrastructure/Common/Commands/NoopCommand.cs
index 7576bc7b..d9f9960f 100644
--- a/GlazeWM.Infrastructure/Common/Commands/NoopCommand.cs
+++ b/GlazeWM.Infrastructure/Common/Commands/NoopCommand.cs
@@ -1,4 +1,4 @@
-using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Commands
{
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowDestroyedEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowDestroyedEvent.cs
index 62db68bd..c0720b83 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowDestroyedEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowDestroyedEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowFocusedEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowFocusedEvent.cs
index c396f0b9..c10837b0 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowFocusedEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowFocusedEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowHiddenEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowHiddenEvent.cs
index b87bc35d..5a9dd83e 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowHiddenEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowHiddenEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowLocationChangedEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowLocationChangedEvent.cs
index f5fb6496..bfe59b5b 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowLocationChangedEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowLocationChangedEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowMinimizeEndedEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowMinimizeEndedEvent.cs
index 34ec93a6..06375d53 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowMinimizeEndedEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowMinimizeEndedEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowMinimizedEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowMinimizedEvent.cs
index e8488ea9..3a3b7cce 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowMinimizedEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowMinimizedEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowMovedOrResizedEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowMovedOrResizedEvent.cs
index 2ef9f5f2..d58b8a52 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowMovedOrResizedEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowMovedOrResizedEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/Common/Events/WindowShownEvent.cs b/GlazeWM.Infrastructure/Common/Events/WindowShownEvent.cs
index 6c2fccfa..e0ed6eb1 100644
--- a/GlazeWM.Infrastructure/Common/Events/WindowShownEvent.cs
+++ b/GlazeWM.Infrastructure/Common/Events/WindowShownEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Infrastructure.Common.Events
diff --git a/GlazeWM.Infrastructure/DependencyInjection.cs b/GlazeWM.Infrastructure/DependencyInjection.cs
index 2d3b448b..6f6fe461 100644
--- a/GlazeWM.Infrastructure/DependencyInjection.cs
+++ b/GlazeWM.Infrastructure/DependencyInjection.cs
@@ -1,6 +1,6 @@
-using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Infrastructure.Common.Commands;
+using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.CommandHandlers;
+using GlazeWM.Infrastructure.Common.Commands;
using GlazeWM.Infrastructure.Serialization;
using GlazeWM.Infrastructure.WindowsApi;
using Microsoft.Extensions.DependencyInjection;
diff --git a/GlazeWM.Infrastructure/Logging/LogFormatter.cs b/GlazeWM.Infrastructure/Logging/LogFormatter.cs
index eb31dd85..3579c9f6 100644
--- a/GlazeWM.Infrastructure/Logging/LogFormatter.cs
+++ b/GlazeWM.Infrastructure/Logging/LogFormatter.cs
@@ -1,9 +1,10 @@
-using Microsoft.Extensions.Logging;
+using System;
+using System.Globalization;
+using System.IO;
+using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Options;
-using System;
-using System.IO;
namespace GlazeWM.Infrastructure.Logging
{
@@ -44,7 +45,9 @@ namespace GlazeWM.Infrastructure.Logging
? DateTime.UtcNow
: DateTime.Now;
- textWriter.Write($"{timestamp.ToString(_formatterOptions.TimestampFormat)}");
+ textWriter.Write(
+ $"{timestamp.ToString(_formatterOptions.TimestampFormat, CultureInfo.InvariantCulture)}"
+ );
}
private static void AddTrimmedCategoryPrefix<T>(TextWriter textWriter, LogEntry<T> logEntry)
diff --git a/GlazeWM.Infrastructure/Serialization/SnakeCaseNamingPolicy.cs b/GlazeWM.Infrastructure/Serialization/SnakeCaseNamingPolicy.cs
index 21474225..b57be1e6 100644
--- a/GlazeWM.Infrastructure/Serialization/SnakeCaseNamingPolicy.cs
+++ b/GlazeWM.Infrastructure/Serialization/SnakeCaseNamingPolicy.cs
@@ -1,3 +1,4 @@
+using System.Globalization;
using System.Linq;
using System.Text.Json;
@@ -20,7 +21,7 @@ namespace GlazeWM.Infrastructure.Serialization
: letter.ToString()
);
- return string.Concat(snakeCaseLetters).ToLower();
+ return string.Concat(snakeCaseLetters).ToLower(CultureInfo.InvariantCulture);
}
}
}
diff --git a/GlazeWM.Infrastructure/ServiceLocator.cs b/GlazeWM.Infrastructure/ServiceLocator.cs
index 77a34b56..9530bb24 100644
--- a/GlazeWM.Infrastructure/ServiceLocator.cs
+++ b/GlazeWM.Infrastructure/ServiceLocator.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
diff --git a/GlazeWM.Infrastructure/Utils/KeybindingHelper.cs b/GlazeWM.Infrastructure/Utils/KeybindingHelper.cs
index 7038fd83..3342575c 100644
--- a/GlazeWM.Infrastructure/Utils/KeybindingHelper.cs
+++ b/GlazeWM.Infrastructure/Utils/KeybindingHelper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
diff --git a/GlazeWM.Infrastructure/WindowsApi/Enums/EventConstant.cs b/GlazeWM.Infrastructure/WindowsApi/Enums/EventConstant.cs
index 7dc3fabc..ada8fcaa 100644
--- a/GlazeWM.Infrastructure/WindowsApi/Enums/EventConstant.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/Enums/EventConstant.cs
@@ -1,18 +1,18 @@
-namespace GlazeWM.Infrastructure.WindowsApi.Enums
+namespace GlazeWM.Infrastructure.WindowsApi.Enums
{
/// <summary>
/// Only the subset of event constants relevant to this application are included.
/// </summary>
public enum EventConstant : uint
{
- EVENT_SYSTEM_FOREGROUND = 0x0003,
- EVENT_SYSTEM_MOVESIZEEND = 0x000B,
- EVENT_SYSTEM_MINIMIZESTART = 0x0016,
- EVENT_SYSTEM_MINIMIZEEND = 0x0017,
- EVENT_OBJECT_DESTROY = 0x8001,
- EVENT_OBJECT_SHOW = 0x8002,
- EVENT_OBJECT_HIDE = 0x8003,
- EVENT_OBJECT_LOCATIONCHANGE = 0x800B,
- EVENT_OBJECT_NAMECHANGE = 0x800C,
+ Foreground = 0x0003,
+ MoveSizeEnd = 0x000B,
+ MinimizeStart = 0x0016,
+ MinimizeEnd = 0x0017,
+ Destroy = 0x8001,
+ Show = 0x8002,
+ Hide = 0x8003,
+ LocationChange = 0x800B,
+ NameChange = 0x800C,
}
}
diff --git a/GlazeWM.Infrastructure/WindowsApi/Enums/ObjectIdentifier.cs b/GlazeWM.Infrastructure/WindowsApi/Enums/ObjectIdentifier.cs
index 1f797f42..8791ad09 100644
--- a/GlazeWM.Infrastructure/WindowsApi/Enums/ObjectIdentifier.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/Enums/ObjectIdentifier.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.WindowsApi.Enums
+namespace GlazeWM.Infrastructure.WindowsApi.Enums
{
/// <summary>
/// Identifies categories of accessible objects within a window (including the window object itself).
@@ -6,6 +6,6 @@
/// </summary>
public enum ObjectIdentifier
{
- OBJID_WINDOW = 0,
+ Window = 0,
}
}
diff --git a/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs b/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs
index 3ddd8a7f..1d14f7bd 100644
--- a/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/KeybindingService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@@ -54,7 +54,7 @@ namespace GlazeWM.Infrastructure.WindowsApi
{
// Create low-level keyboard hook.
_ = SetWindowsHookEx(
- HookType.WH_KEYBOARD_LL,
+ HookType.KeyboardLowLevel,
_hookProc,
Process.GetCurrentProcess().MainModule.BaseAddress,
0
diff --git a/GlazeWM.Infrastructure/WindowsApi/RectDelta.cs b/GlazeWM.Infrastructure/WindowsApi/RectDelta.cs
index 79a1be62..6aef8540 100644
--- a/GlazeWM.Infrastructure/WindowsApi/RectDelta.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/RectDelta.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.WindowsApi
+namespace GlazeWM.Infrastructure.WindowsApi
{
public class RectDelta
{
diff --git a/GlazeWM.Infrastructure/WindowsApi/SetWindowPosFlags.cs b/GlazeWM.Infrastructure/WindowsApi/SetWindowPosFlags.cs
index b9eae4d7..c4bfe10a 100644
--- a/GlazeWM.Infrastructure/WindowsApi/SetWindowPosFlags.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/SetWindowPosFlags.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
namespace GlazeWM.Infrastructure.WindowsApi
{
diff --git a/GlazeWM.Infrastructure/WindowsApi/SystemEventService.cs b/GlazeWM.Infrastructure/WindowsApi/SystemEventService.cs
index 8e050b38..129dd1a7 100644
--- a/GlazeWM.Infrastructure/WindowsApi/SystemEventService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/SystemEventService.cs
@@ -1,8 +1,8 @@
-using GlazeWM.Infrastructure.Bussing;
-using GlazeWM.Infrastructure.Common.Events;
-using Microsoft.Win32;
using System;
using System.Reactive.Linq;
+using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Common.Events;
+using Microsoft.Win32;
namespace GlazeWM.Infrastructure.WindowsApi
{
diff --git a/GlazeWM.Infrastructure/WindowsApi/SystemTrayIcon.cs b/GlazeWM.Infrastructure/WindowsApi/SystemTrayIcon.cs
index d107d9a5..ef2e6524 100644
--- a/GlazeWM.Infrastructure/WindowsApi/SystemTrayIcon.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/SystemTrayIcon.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
diff --git a/GlazeWM.Infrastructure/WindowsApi/SystemTrayIconConfig.cs b/GlazeWM.Infrastructure/WindowsApi/SystemTrayIconConfig.cs
index a6434a23..3330e951 100644
--- a/GlazeWM.Infrastructure/WindowsApi/SystemTrayIconConfig.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/SystemTrayIconConfig.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
namespace GlazeWM.Infrastructure.WindowsApi
diff --git a/GlazeWM.Infrastructure/WindowsApi/WindowEventService.cs b/GlazeWM.Infrastructure/WindowsApi/WindowEventService.cs
index ed687276..2f967c7f 100644
--- a/GlazeWM.Infrastructure/WindowsApi/WindowEventService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/WindowEventService.cs
@@ -1,7 +1,7 @@
+using System;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Common.Events;
using GlazeWM.Infrastructure.WindowsApi.Enums;
-using System;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
namespace GlazeWM.Infrastructure.WindowsApi
@@ -24,12 +24,12 @@ namespace GlazeWM.Infrastructure.WindowsApi
public void Start()
{
- SetWinEventHook(EventConstant.EVENT_OBJECT_LOCATIONCHANGE, EventConstant.EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, _hookProc, 0, 0, 0);
- SetWinEventHook(EventConstant.EVENT_OBJECT_DESTROY, EventConstant.EVENT_OBJECT_HIDE, IntPtr.Zero, _hookProc, 0, 0, 0);
- SetWinEventHook(EventConstant.EVENT_SYSTEM_MINIMIZESTART, EventConstant.EVENT_SYSTEM_MINIMIZEEND, IntPtr.Zero, _hookProc, 0, 0, 0);
- SetWinEventHook(EventConstant.EVENT_SYSTEM_MOVESIZEEND, EventConstant.EVENT_SYSTEM_MOVESIZEEND, IntPtr.Zero, _hookProc, 0, 0, 0);
- SetWinEventHook(EventConstant.EVENT_SYSTEM_FOREGROUND, EventConstant.EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, _hookProc, 0, 0, 0);
- SetWinEventHook(EventConstant.EVENT_OBJECT_LOCATIONCHANGE, EventConstant.EVENT_OBJECT_NAMECHANGE, IntPtr.Zero, _hookProc, 0, 0, 0);
+ SetWinEventHook(EventConstant.LocationChange, EventConstant.LocationChange, IntPtr.Zero, _hookProc, 0, 0, 0);
+ SetWinEventHook(EventConstant.Destroy, EventConstant.Hide, IntPtr.Zero, _hookProc, 0, 0, 0);
+ SetWinEventHook(EventConstant.MinimizeStart, EventConstant.MinimizeEnd, IntPtr.Zero, _hookProc, 0, 0, 0);
+ SetWinEventHook(EventConstant.MoveSizeEnd, EventConstant.MoveSizeEnd, IntPtr.Zero, _hookProc, 0, 0, 0);
+ SetWinEventHook(EventConstant.Foreground, EventConstant.Foreground, IntPtr.Zero, _hookProc, 0, 0, 0);
+ SetWinEventHook(EventConstant.LocationChange, EventConstant.NameChange, IntPtr.Zero, _hookProc, 0, 0, 0);
}
private void WindowEventHookProc(
@@ -42,7 +42,7 @@ namespace GlazeWM.Infrastructure.WindowsApi
uint dwmsEventTime)
{
// Whether the event is actually associated with a window object (instead of a UI control).
- var isWindowEvent = idChild == CHILDID_SELF && idObject == ObjectIdentifier.OBJID_WINDOW
+ var isWindowEvent = idChild == CHILDID_SELF && idObject == ObjectIdentifier.Window
&& hwnd != IntPtr.Zero;
if (!isWindowEvent)
@@ -50,15 +50,15 @@ namespace GlazeWM.Infrastructure.WindowsApi
Event eventToRaise = eventType switch
{
- EventConstant.EVENT_OBJECT_LOCATIONCHANGE => new WindowLocationChangedEvent(hwnd),
- EventConstant.EVENT_SYSTEM_FOREGROUND => new WindowFocusedEvent(hwnd),
- EventConstant.EVENT_SYSTEM_MINIMIZESTART => new WindowMinimizedEvent(hwnd),
- EventConstant.EVENT_SYSTEM_MINIMIZEEND => new WindowMinimizeEndedEvent(hwnd),
- EventConstant.EVENT_SYSTEM_MOVESIZEEND => new WindowMovedOrResizedEvent(hwnd),
- EventConstant.EVENT_OBJECT_DESTROY => new WindowDestroyedEvent(hwnd),
- EventConstant.EVENT_OBJECT_SHOW => new WindowShownEvent(hwnd),
- EventConstant.EVENT_OBJECT_NAMECHANGE => new WindowTitleChangedEvent(hwnd),
- EventConstant.EVENT_OBJECT_HIDE => new WindowHiddenEvent(hwnd),
+ EventConstant.LocationChange => new WindowLocationChangedEvent(hwnd),
+ EventConstant.Foreground => new WindowFocusedEvent(hwnd),
+ EventConstant.MinimizeStart => new WindowMinimizedEvent(hwnd),
+ EventConstant.MinimizeEnd => new WindowMinimizeEndedEvent(hwnd),
+ EventConstant.MoveSizeEnd => new WindowMovedOrResizedEvent(hwnd),
+ EventConstant.Destroy => new WindowDestroyedEvent(hwnd),
+ EventConstant.Show => new WindowShownEvent(hwnd),
+ EventConstant.NameChange => new WindowTitleChangedEvent(hwnd),
+ EventConstant.Hide => new WindowHiddenEvent(hwnd),
_ => null,
};
diff --git a/GlazeWM.Infrastructure/WindowsApi/WindowRect.cs b/GlazeWM.Infrastructure/WindowsApi/WindowRect.cs
index 86880988..e484f7f9 100644
--- a/GlazeWM.Infrastructure/WindowsApi/WindowRect.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/WindowRect.cs
@@ -1,4 +1,4 @@
-namespace GlazeWM.Infrastructure.WindowsApi
+namespace GlazeWM.Infrastructure.WindowsApi
{
public struct Rect
{
diff --git a/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs b/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
index a07c5712..0263a439 100644
--- a/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
@@ -1,29 +1,29 @@
-using GlazeWM.Infrastructure.WindowsApi.Enums;
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
+using GlazeWM.Infrastructure.WindowsApi.Enums;
namespace GlazeWM.Infrastructure.WindowsApi
{
public static class WindowsApiService
{
[Flags]
- public enum SWP : uint
+ public enum SetWindowPosFlags : uint
{
- SWP_NOSIZE = 0x0001,
- SWP_NOMOVE = 0x0002,
- SWP_NOZORDER = 0x0004,
- SWP_NOREDRAW = 0x0008,
- SWP_NOACTIVATE = 0x0010,
- SWP_FRAMECHANGED = 0x0020,
- SWP_SHOWWINDOW = 0x0040,
- SWP_HIDEWINDOW = 0x0080,
- SWP_NOCOPYBITS = 0x0100,
- SWP_NOOWNERZORDER = 0x0200,
- SWP_NOSENDCHANGING = 0x0400,
- SWP_DEFERERASE = 0x2000,
- SWP_ASYNCWINDOWPOS = 0x4000
+ NoSize = 0x0001,
+ NoMove = 0x0002,
+ NoZOrder = 0x0004,
+ NoRedraw = 0x0008,
+ NoActivate = 0x0010,
+ FrameChanged = 0x0020,
+ ShowWindow = 0x0040,
+ HideWindow = 0x0080,
+ NoCopyBits = 0x0100,
+ NoOwnerZOrder = 0x0200,
+ NoSendChanging = 0x0400,
+ DeferErase = 0x2000,
+ AsyncWindowPos = 0x4000
}
/// <summary>
@@ -55,98 +55,98 @@ namespace GlazeWM.Infrastructure.WindowsApi
/// Window styles
/// </summary>
[Flags]
- public enum WS : uint
+ public enum WindowStyles : uint
{
- WS_OVERLAPPED = 0x00000000,
- WS_TILED = WS_OVERLAPPED,
- WS_TABSTOP = 0x00010000,
- WS_MAXIMIZEBOX = 0x00010000,
- WS_GROUP = 0x00020000,
- WS_MINIMIZEBOX = 0x00020000,
- WS_THICKFRAME = 0x00040000,
- WS_SIZEBOX = WS_THICKFRAME,
- WS_SYSMENU = 0x00080000,
- WS_HSCROLL = 0x00100000,
- WS_VSCROLL = 0x00200000,
- WS_DLGFRAME = 0x00400000,
- WS_BORDER = 0x00800000,
- WS_CAPTION = WS_BORDER | WS_DLGFRAME,
- WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
- WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
- WS_MAXIMIZE = 0x01000000,
- WS_CLIPCHILDREN = 0x02000000,
- WS_CLIPSIBLINGS = 0x04000000,
- WS_DISABLED = 0x08000000,
- WS_VISIBLE = 0x10000000,
- WS_MINIMIZE = 0x20000000,
- WS_ICONIC = WS_MINIMIZE,
- WS_CHILD = 0x40000000,
- WS_CHILDWINDOW = WS_CHILD,
- WS_POPUP = 0x80000000,
- WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU
+ Overlapped = 0x00000000,
+ Tiled = Overlapped,
+ TabStop = 0x00010000,
+ MaximizeBox = 0x00010000,
+ Group = 0x00020000,
+ MinimizeBox = 0x00020000,
+ ThickFrame = 0x00040000,
+ SizeBox = ThickFrame,
+ SysMenu = 0x00080000,
+ HScroll = 0x00100000,
+ VScroll = 0x00200000,
+ DlgFrame = 0x00400000,
+ Border = 0x00800000,
+ Capion = Border | DlgFrame,
+ TiledWindow = OverlappedWindow,
+ OverlappedWindow = Overlapped | Capion | SysMenu | ThickFrame | MinimizeBox | MaximizeBox,
+ Maximize = 0x01000000,
+ ClipChildren = 0x02000000,
+ ClipSiblings = 0x04000000,
+ Disabled = 0x08000000,
+ Visible = 0x10000000,
+ Minimize = 0x20000000,
+ Iconic = Minimize,
+ Child = 0x40000000,
+ ChildWindow = Child,
+ Popup = 0x80000000,
+ PopupWindow = Popup | Border | SysMenu
}
/// <summary>
/// Extended window styles
/// </summary>
[Flags]
- public enum WS_EX : uint
+ public enum WindowStylesEx : uint
{
- WS_EX_LEFT = 0x0000,
- WS_EX_LTRREADING = 0x0000,
- WS_EX_RIGHTSCROLLBAR = 0x0000,
- WS_EX_DLGMODALFRAME = 0x0001,
- WS_EX_NOPARENTNOTIFY = 0x0004,
- WS_EX_TOPMOST = 0x0008,
- WS_EX_ACCEPTFILES = 0x0010,
- WS_EX_TRANSPARENT = 0x0020,
- WS_EX_MDICHILD = 0x0040,
- WS_EX_TOOLWINDOW = 0x0080,
- WS_EX_WINDOWEDGE = 0x0100,
- WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
- WS_EX_CLIENTEDGE = 0x0200,
- WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE,
- WS_EX_CONTEXTHELP = 0x0400,
- WS_EX_RIGHT = 0x1000,
- WS_EX_RTLREADING = 0x2000,
- WS_EX_LEFTSCROLLBAR = 0x4000,
- WS_EX_CONTROLPARENT = 0x10000,
- WS_EX_STATICEDGE = 0x20000,
- WS_EX_APPWINDOW = 0x40000,
- WS_EX_LAYERED = 0x00080000,
- WS_EX_NOINHERITLAYOUT = 0x00100000,
- WS_EX_LAYOUTRTL = 0x00400000,
- WS_EX_COMPOSITED = 0x02000000,
- WS_EX_NOACTIVATE = 0x08000000
+ Left = 0x0000,
+ LtrReading = 0x0000,
+ RightScrollbar = 0x0000,
+ DlgModalFrame = 0x0001,
+ NoParentNotify = 0x0004,
+ TopMost = 0x0008,
+ AcceptFiles = 0x0010,
+ Transparent = 0x0020,
+ MdiChild = 0x0040,
+ ToolWindow = 0x0080,
+ WindowEdge = 0x0100,
+ PaletteWindow = WindowEdge | ToolWindow | TopMost,
+ ClientEdge = 0x0200,
+ OverlappedWindow = WindowEdge | ClientEdge,
+ ContextHelp = 0x0400,
+ Right = 0x1000,
+ RtlReading = 0x2000,
+ LeftScrollbar = 0x4000,
+ ControlParent = 0x10000,
+ StaticEdge = 0x20000,
+ AppWindow = 0x40000,
+ Layered = 0x00080000,
+ NoInheritLayout = 0x00100000,
+ LayoutRtl = 0x00400000,
+ Composited = 0x02000000,
+ NoActivate = 0x08000000
}
[Flags]
public enum DwmWindowAttribute : uint
{
- DWMWA_NCRENDERING_ENABLED = 1,
- DWMWA_NCRENDERING_POLICY,
- DWMWA_TRANSITIONS_FORCEDISABLED,
- DWMWA_ALLOW_NCPAINT,
- DWMWA_CAPTION_BUTTON_BOUNDS,
- DWMWA_NONCLIENT_RTL_LAYOUT,
- DWMWA_FORCE_ICONIC_REPRESENTATION,
- DWMWA_FLIP3D_POLICY,
- DWMWA_EXTENDED_FRAME_BOUNDS,
- DWMWA_HAS_ICONIC_BITMAP,
- DWMWA_DISALLOW_PEEK,
- DWMWA_EXCLUDED_FROM_PEEK,
- DWMWA_CLOAK,
- DWMWA_CLOAKED,
- DWMWA_FREEZE_REPRESENTATION,
- DWMWA_LAST
+ NcRenderingEnabled = 1,
+ NcRenderingPolicy,
+ TransitionsForceDisabled,
+ AllowNcPaint,
+ CaptionButtonBounds,
+ NonClientRtlLayout,
+ ForceIconicRepresentation,
+ Flip3DPolicy,
+ ExtendedFrameBounds,
+ HasIconicBitmap,
+ DisallowPeek,
+ ExcludedFromPeek,
+ Cloak,
+ Cloaked,
+ FreezeRepresentation,
+ Last
}
- public const int GWL_STYLE = -16;
- public const int GWL_EXSTYLE = -20;
+ public const int GWLSTYLE = -16;
+ public const int GWLEXSTYLE = -20;
public enum GW : uint
{
- GW_OWNER = 4,
+ Owner = 4,
}
public delegate bool EnumWindowsDelegate(IntPtr hWnd, int lParam);
@@ -185,14 +185,28 @@ namespace GlazeWM.Infrastructure.WindowsApi
}
[DllImport("user32.dll", SetLastError = true)]
- public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SWP uFlags);
+ public static extern bool SetWindowPos(
+ IntPtr hWnd,
+ IntPtr hWndInsertAfter,
+ int x,
+ int y,
+ int cx,
+ int cy,
+ SetWindowPosFlags uFlags);
[DllImport("user32.dll")]
public static extern IntPtr BeginDeferWindowPos(int nNumWindows);
[DllImport("user32.dll")]
- public static extern IntPtr DeferWindowPos(IntPtr hWinPosInfo, IntPtr hWnd,
- [Optional] IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags);
+ public static extern IntPtr DeferWindowPos(
+ IntPtr hWinPosInfo,
+ IntPtr hWnd,
+ [Optional] IntPtr hWndInsertAfter,
+ int x,
+ int y,
+ int cx,
+ int cy,
+ SetWindowPosFlags uFlags);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
@@ -209,27 +223,27 @@ namespace GlazeWM.Infrastructure.WindowsApi
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
- public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
+ public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
public static extern bool SetFocus(IntPtr hWnd);
[DllImport("user32.dll")]
- public static extern bool SetCursorPos(int X, int Y);
+ public static extern bool SetCursorPos(int x, int y);
/// <summary>
/// Params that can be passed to `ShowWindow`. Only the subset of flags relevant to
/// this application are included.
/// </summary>
- public enum ShowWindowCommands : uint
+ public enum ShowWindowFlags : uint
{
- MINIMIZE = 2,
- MAXIMIZE = 3,
- RESTORE = 9,
+ Minimize = 2,
+ Maximize = 3,
+ Restore = 9,
}
[DllImport("user32.dll")]
- public static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommands flags);
+ public static extern bool ShowWindow(IntPtr hWnd, ShowWindowFlags flags);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int GetWindowTextLength(IntPtr hWnd);
@@ -265,7 +279,7 @@ namespace GlazeWM.Infrastructure.WindowsApi
/// <summary>
/// The current show state of the window.
/// </summary>
- public ShowWindowCommands ShowCommand;
+ public ShowWindowFlags ShowCommand;
/// <summary>
/// The coordinates of the window's upper-left corner when the window is minimized.
@@ -300,8 +314,8 @@ namespace GlazeWM.Infrastructure.WindowsApi
public enum HookType
{
- WH_KEYBOARD_LL = 13,
- WH_MOUSE_LL = 14
+ KeyboardLowLevel = 13,
+ MouseLowLevel = 14
}
/// <summary>
@@ -370,23 +384,23 @@ namespace GlazeWM.Infrastructure.WindowsApi
/// </summary>
public enum SendMessageType : uint
{
- WM_CLOSE = 0x0010,
+ Close = 0x0010,
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern IntPtr SendMessage(IntPtr hWnd, SendMessageType Msg, IntPtr wParam, IntPtr lParam);
+ public static extern IntPtr SendMessage(IntPtr hWnd, SendMessageType msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool IsProcessDPIAware();
public enum DpiAwarenessContext
{
- Context_UnawareGdiScaled = -5,
- Context_PerMonitorAwareV2 = -4,
- Context_PerMonitorAware = -3,
- Context_SystemAware = -2,
- Context_Unaware = -1,
- Context_Undefined = 0
+ UnawareGdiScaled = -5,
+ PerMonitorAwareV2 = -4,
+ PerMonitorAware = -3,
+ SystemAware = -2,
+ Unaware = -1,
+ Undefined = 0
}
[DllImport("user32.dll", SetLastError = true)]
@@ -396,13 +410,13 @@ namespace GlazeWM.Infrastructure.WindowsApi
public static extern uint GetDpiForWindow(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
- public static extern bool AdjustWindowRectEx(ref Rect lpRect, WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WS_EX dwExStyle);
+ public static extern bool AdjustWindowRectEx(ref Rect lpRect, WindowStyles dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WindowStylesEx dwExStyle);
[DllImport("user32.dll", SetLastError = true)]
- public static extern bool AdjustWindowRect(ref Rect lpRect, WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu);
+ public static extern bool AdjustWindowRect(ref Rect lpRect, WindowStyles dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu);
[DllImport("user32.dll", SetLastError = true)]
- public static extern bool AdjustWindowRectExForDpi(ref Rect lpRect, WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WS_EX dwExStyle, uint dpi);
+ public static extern bool AdjustWindowRectExForDpi(ref Rect lpRect, WindowStyles dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WindowStylesEx dwExStyle, uint dpi);
public enum DpiType
{
@@ -416,16 +430,17 @@ namespace GlazeWM.Infrastructure.WindowsApi
public enum MonitorFromPointFlags : uint
{
- MONITOR_DEFAULTTONEAREST = 2,
+ DefaultToNearest = 2,
}
[DllImport("User32.dll")]
public static extern IntPtr MonitorFromPoint(Point pt, MonitorFromPointFlags dwFlags);
[DllImport("kernel32.dll")]
- public static extern bool GetSystemPowerStatus(out SYSTEM_POWER_STATUS lpSystemPowerStatus);
+ public static extern bool GetSystemPowerStatus(out SystemPowerStatus lpSystemPowerStatus);
- public struct SYSTEM_POWER_STATUS
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SystemPowerStatus
{
public byte ACLineStatus;
public byte BatteryFlag;
diff --git a/GlazeWM.sln b/GlazeWM.sln
index 47b5028e..bd984db0 100644
--- a/GlazeWM.sln
+++ b/GlazeWM.sln
@@ -1,4 +1,4 @@
-
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14