mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Allow all projects to access MonitorInfo & CursorInfo
This commit is contained in:
parent
cbbd09b8a5
commit
4f423c47cd
4 changed files with 16 additions and 13 deletions
|
|
@ -34,14 +34,6 @@ WINDOW_STYLE
|
|||
SetLastError
|
||||
WINDOW_EX_STYLE
|
||||
|
||||
GetSystemMetrics
|
||||
EnumDisplayMonitors
|
||||
MonitorFromWindow
|
||||
GetMonitorInfo
|
||||
MONITORINFOEXW
|
||||
GetCursorPos
|
||||
MonitorFromPoint
|
||||
|
||||
WM_ENTERSIZEMOVE
|
||||
WM_EXITSIZEMOVE
|
||||
WM_NCLBUTTONDBLCLK
|
||||
|
|
|
|||
|
|
@ -5,4 +5,12 @@ GetWindowTextLength
|
|||
WM_KEYDOWN
|
||||
WM_KEYUP
|
||||
WM_SYSKEYDOWN
|
||||
WM_SYSKEYUP
|
||||
WM_SYSKEYUP
|
||||
|
||||
GetSystemMetrics
|
||||
EnumDisplayMonitors
|
||||
MonitorFromWindow
|
||||
GetMonitorInfo
|
||||
MONITORINFOEXW
|
||||
GetCursorPos
|
||||
MonitorFromPoint
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure;
|
||||
namespace Flow.Launcher.Plugin.SharedModels;
|
||||
|
||||
/// <summary>
|
||||
/// Contains full information about a cursor.
|
||||
|
|
@ -12,6 +12,9 @@ namespace Flow.Launcher.Infrastructure;
|
|||
/// </remarks>
|
||||
public class CursorInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current position of the cursor in screen coordinates.
|
||||
/// </summary>
|
||||
public static Point Position
|
||||
{
|
||||
get
|
||||
|
|
@ -7,7 +7,7 @@ using Windows.Win32.Foundation;
|
|||
using Windows.Win32.Graphics.Gdi;
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure;
|
||||
namespace Flow.Launcher.Plugin.SharedModels;
|
||||
|
||||
/// <summary>
|
||||
/// Contains full information about a display monitor.
|
||||
|
|
@ -75,7 +75,7 @@ public class MonitorInfo
|
|||
/// <returns>The primary display monitor, or null if no monitor is found.</returns>
|
||||
public static unsafe MonitorInfo GetPrimaryDisplayMonitor()
|
||||
{
|
||||
var primaryMonitor = PInvoke.MonitorFromWindow(new HWND(IntPtr.Zero), MONITOR_FROM_FLAGS.MONITOR_DEFAULTTOPRIMARY);
|
||||
var primaryMonitor = PInvoke.MonitorFromWindow(new HWND(nint.Zero), MONITOR_FROM_FLAGS.MONITOR_DEFAULTTOPRIMARY);
|
||||
MonitorInfo primaryMonitorInfo = null;
|
||||
var callback = new MONITORENUMPROC((monitor, deviceContext, rect, data) =>
|
||||
{
|
||||
|
|
@ -163,7 +163,7 @@ public class MonitorInfo
|
|||
/// <summary>
|
||||
/// Gets if the monitor is the primary display monitor.
|
||||
/// </summary>
|
||||
public bool IsPrimary => _monitor == PInvoke.MonitorFromWindow(new(IntPtr.Zero), MONITOR_FROM_FLAGS.MONITOR_DEFAULTTOPRIMARY);
|
||||
public bool IsPrimary => _monitor == PInvoke.MonitorFromWindow(new(nint.Zero), MONITOR_FROM_FLAGS.MONITOR_DEFAULTTOPRIMARY);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"{Name} {Bounds.Width}x{Bounds.Height}";
|
||||
Loading…
Reference in a new issue