Skip to content

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

refactor(infra,domain): remove custom `Point` struct; use `Point` from `System.Drawing` instead

Lars Berger280e9643906b
diff --git a/GlazeWM.Domain/Monitors/MonitorService.cs b/GlazeWM.Domain/Monitors/MonitorService.cs
index 991f167b..ecafc4e8 100644
--- a/GlazeWM.Domain/Monitors/MonitorService.cs
+++ b/GlazeWM.Domain/Monitors/MonitorService.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using GlazeWM.Domain.Common.Enums;
@@ -53,7 +54,7 @@ namespace GlazeWM.Domain.Monitors
public uint GetMonitorDpi(Screen screen)
{
// Get a handle to the monitor from a `Screen`.
- var point = new System.Drawing.Point(screen.Bounds.Left + 1, screen.Bounds.Top + 1);
+ var point = new Point(screen.Bounds.Left + 1, screen.Bounds.Top + 1);
var monitorHandle = MonitorFromPoint(point, MonitorFromPointFlags.MONITOR_DEFAULTTONEAREST);
uint dpiX, dpiY;
diff --git a/GlazeWM.Infrastructure/WindowsApi/Point.cs b/GlazeWM.Infrastructure/WindowsApi/Point.cs
deleted file mode 100644
index 93d8bd7f..00000000
--- a/GlazeWM.Infrastructure/WindowsApi/Point.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace GlazeWM.Infrastructure.WindowsApi
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct Point
- {
- public int X;
- public int Y;
- }
-}
diff --git a/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs b/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
index 3ac35493..6dc1ac74 100644
--- a/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
@@ -1,5 +1,6 @@
-using GlazeWM.Infrastructure.WindowsApi.Enums;
+using GlazeWM.Infrastructure.WindowsApi.Enums;
using System;
+using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
@@ -381,6 +382,6 @@ namespace GlazeWM.Infrastructure.WindowsApi
}
[DllImport("User32.dll")]
- public static extern IntPtr MonitorFromPoint(System.Drawing.Point pt, MonitorFromPointFlags dwFlags);
+ public static extern IntPtr MonitorFromPoint(Point pt, MonitorFromPointFlags dwFlags);
}
}