Skip to content

Commit 3cd7c3c

Browse files
committed
Remove CursorInfo class
1 parent 3cfe122 commit 3cd7c3c

File tree

2 files changed

+6
-32
lines changed

2 files changed

+6
-32
lines changed

Flow.Launcher.Plugin/SharedModels/CursorInfo.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

Flow.Launcher.Plugin/SharedModels/MonitorInfo.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Runtime.InteropServices;
43
using System.Windows;
54
using Windows.Win32;
@@ -102,7 +101,11 @@ public static unsafe MonitorInfo GetPrimaryDisplayMonitor()
102101
/// <returns>The display monitor that contains the cursor, or null if no monitor is found.</returns>
103102
public static unsafe MonitorInfo GetCursorDisplayMonitor()
104103
{
105-
var cursorMonitor = PInvoke.MonitorFromPoint(CursorInfo.Position, MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST);
104+
if (!PInvoke.GetCursorPos(out var pt))
105+
{
106+
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error());
107+
}
108+
var cursorMonitor = PInvoke.MonitorFromPoint(pt, MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST);
106109
MonitorInfo cursorMonitorInfo = null;
107110
var callback = new MONITORENUMPROC((monitor, deviceContext, rect, data) =>
108111
{

0 commit comments

Comments
 (0)