mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
29 lines
755 B
C#
29 lines
755 B
C#
using System.Drawing;
|
|
using System.Runtime.InteropServices;
|
|
using Windows.Win32;
|
|
|
|
namespace Flow.Launcher.Plugin.SharedModels;
|
|
|
|
/// <summary>
|
|
/// Contains full information about a cursor.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Use this class to replace the System.Windows.Forms.Cursor class which can cause possible System.PlatformNotSupportedException.
|
|
/// </remarks>
|
|
public class CursorInfo
|
|
{
|
|
/// <summary>
|
|
/// Gets the current position of the cursor in screen coordinates.
|
|
/// </summary>
|
|
public static Point Position
|
|
{
|
|
get
|
|
{
|
|
if (!PInvoke.GetCursorPos(out var pt))
|
|
{
|
|
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error());
|
|
}
|
|
return pt;
|
|
}
|
|
}
|
|
}
|