Skip to content

Commit 5f72118

Browse files
committed
Minor
1 parent 73f6d32 commit 5f72118

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

JL.Windows/WinApi.cs

+26-1
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,44 @@ internal static partial class NativeMethods
3535
internal const int MOD_NOREPEAT = 0x4000;
3636

3737
[StructLayout(LayoutKind.Sequential)]
38-
internal struct LPPOINT
38+
internal struct LPPOINT : IEquatable<LPPOINT>
3939
{
4040
public int X;
4141
public int Y;
42+
43+
public override readonly int GetHashCode()
44+
{
45+
unchecked
46+
{
47+
int hash = (17 * 37) + X;
48+
hash = (hash * 37) + Y;
49+
return hash;
50+
}
51+
}
52+
53+
public override readonly bool Equals(object? obj)
54+
{
55+
return obj is LPPOINT lpPoint && Equals(lpPoint);
56+
}
57+
58+
public readonly bool Equals(LPPOINT other)
59+
{
60+
return X == other.X && Y == other.Y;
61+
}
62+
63+
public static bool operator ==(LPPOINT left, LPPOINT right) => left.Equals(right);
64+
public static bool operator !=(LPPOINT left, LPPOINT right) => !left.Equals(right);
4265
}
4366

4467
// ReSharper disable UnusedMember.Global
68+
#pragma warning disable CA1028
4569
internal enum ChangeWindowMessageFilterExAction : uint
4670
{
4771
Reset = 0,
4872
Allow = 1,
4973
Disallow = 2
5074
}
75+
#pragma warning restore CA1028
5176
// ReSharper restore UnusedMember.Global
5277

5378
[LibraryImport("user32.dll", EntryPoint = "AddClipboardFormatListener", SetLastError = true)]

0 commit comments

Comments
 (0)