Skip to content

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

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

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