From 3cfe122c7bb21f69e0b8bcb0e4a4d59bc571e4d3 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Jul 2025 13:51:35 +0800 Subject: [PATCH] Use new MonitorInfo class class --- Flow.Launcher.Infrastructure/Win32Helper.cs | 1 + Flow.Launcher/MainWindow.xaml.cs | 1 + Flow.Launcher/Msg.xaml.cs | 1 + Flow.Launcher/MsgWithButton.xaml.cs | 1 + Flow.Launcher/SettingWindow.xaml.cs | 1 + .../Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 5 +++-- 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Win32Helper.cs b/Flow.Launcher.Infrastructure/Win32Helper.cs index 84880d68c..68d382377 100644 --- a/Flow.Launcher.Infrastructure/Win32Helper.cs +++ b/Flow.Launcher.Infrastructure/Win32Helper.cs @@ -13,6 +13,7 @@ using System.Windows.Interop; using System.Windows.Markup; using System.Windows.Media; using Flow.Launcher.Infrastructure.UserSettings; +using Flow.Launcher.Plugin.SharedModels; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using Windows.Win32; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 429a4aece..e69de67cf 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -23,6 +23,7 @@ using Flow.Launcher.Infrastructure.DialogJump; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedCommands; +using Flow.Launcher.Plugin.SharedModels; using Flow.Launcher.ViewModel; using Microsoft.Win32; using ModernWpf.Controls; diff --git a/Flow.Launcher/Msg.xaml.cs b/Flow.Launcher/Msg.xaml.cs index 6063e489c..dd7d4495c 100644 --- a/Flow.Launcher/Msg.xaml.cs +++ b/Flow.Launcher/Msg.xaml.cs @@ -4,6 +4,7 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media.Animation; using Flow.Launcher.Infrastructure; +using Flow.Launcher.Plugin.SharedModels; namespace Flow.Launcher { diff --git a/Flow.Launcher/MsgWithButton.xaml.cs b/Flow.Launcher/MsgWithButton.xaml.cs index 89149c2d4..7ae53e6c5 100644 --- a/Flow.Launcher/MsgWithButton.xaml.cs +++ b/Flow.Launcher/MsgWithButton.xaml.cs @@ -4,6 +4,7 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media.Animation; using Flow.Launcher.Infrastructure; +using Flow.Launcher.Plugin.SharedModels; namespace Flow.Launcher { diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index b4f6bcf69..0e3e69996 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -7,6 +7,7 @@ using System.Windows.Interop; using CommunityToolkit.Mvvm.DependencyInjection; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.UserSettings; +using Flow.Launcher.Plugin.SharedModels; using Flow.Launcher.SettingPages.Views; using Flow.Launcher.ViewModel; using ModernWpf.Controls; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index cbf6f1f8b..274537cd3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -7,6 +7,7 @@ using System.Windows.Input; using Flow.Launcher.Plugin.Explorer.Search.Everything; using Flow.Launcher.Plugin.Explorer.Views; using Flow.Launcher.Plugin.SharedCommands; +using Flow.Launcher.Plugin.SharedModels; using Peter; using Path = System.IO.Path; @@ -72,10 +73,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search internal static void ShowNativeContextMenu(string path, ResultType type) { - var screenWithMouseCursor = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position); + var screenWithMouseCursor = MonitorInfo.GetCursorDisplayMonitor(); var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2; var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2; - var showPosition = new System.Drawing.Point(xOfScreenCenter, yOfScreenCenter); + var showPosition = new System.Drawing.Point((int)xOfScreenCenter, (int)yOfScreenCenter); switch (type) {