From 191538aff18e194e68767490e7dd9283b80de965 Mon Sep 17 00:00:00 2001 From: Stanley Date: Sun, 10 Jul 2022 19:58:54 -0400 Subject: [PATCH] Started Version 3.3.7 development --- Model/PanelType.cs | 3 ++- Provider/InputEmulationManager.cs | 2 ++ Provider/PanelPopoutManager.cs | 2 ++ Provider/WindowManager.cs | 5 ++++- VERSION.md | 3 +++ WpfApp/PanelCoorOverlay.xaml.cs | 18 +++++++++++++++++- 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Model/PanelType.cs b/Model/PanelType.cs index bdddfca..f1925a9 100644 --- a/Model/PanelType.cs +++ b/Model/PanelType.cs @@ -6,6 +6,7 @@ BuiltInPopout, CustomPopout, MSFSTouchPanel, - WPFWindow + WPFWindow, + MultiMonitorWindow } } diff --git a/Provider/InputEmulationManager.cs b/Provider/InputEmulationManager.cs index a9545f6..ce4d8d1 100644 --- a/Provider/InputEmulationManager.cs +++ b/Provider/InputEmulationManager.cs @@ -22,6 +22,7 @@ namespace MSFSPopoutPanelManager.Provider public static void LeftClick(int x, int y) { + PInvoke.SetCursorPos(x, y); PInvoke.SetCursorPos(x, y); Thread.Sleep(300); @@ -42,6 +43,7 @@ namespace MSFSPopoutPanelManager.Provider LeftClick(x, y); Thread.Sleep(300); + PInvoke.SetCursorPos(x, y); PInvoke.SetCursorPos(x, y); Thread.Sleep(300); diff --git a/Provider/PanelPopoutManager.cs b/Provider/PanelPopoutManager.cs index fa41863..ba77dbe 100644 --- a/Provider/PanelPopoutManager.cs +++ b/Provider/PanelPopoutManager.cs @@ -382,6 +382,8 @@ namespace MSFSPopoutPanelManager.Provider panelInfo.PanelType = PanelType.CustomPopout; else if (caption.IndexOf("Microsoft Flight Simulator") > -1) // MSFS main game window return null; + else if (caption.IndexOf("WINDOW") > -1) + panelInfo.PanelType = PanelType.MultiMonitorWindow; else panelInfo.PanelType = PanelType.BuiltInPopout; diff --git a/Provider/WindowManager.cs b/Provider/WindowManager.cs index c811c5b..5ca3421 100644 --- a/Provider/WindowManager.cs +++ b/Provider/WindowManager.cs @@ -136,11 +136,14 @@ namespace MSFSPopoutPanelManager.Provider var className = PInvoke.GetClassName(hwnd); var caption = PInvoke.GetWindowText(hwnd); + if (className == "AceApp" && caption.IndexOf("WINDOW") > -1) // For multi monitor window, do nothing + return true; + if (className == "AceApp" && (caption.IndexOf("(Custom)") > -1 || caption == String.Empty)) // Only close non-builtin pop out panels { WindowManager.CloseWindow(hwnd); } - else if (className == "AceApp" && caption.IndexOf("Microsoft Flight Simulator") == -1) // for builtin pop out (ATC, VFR Map, ect) + else if (className == "AceApp" && caption.IndexOf("Microsoft Flight Simulator") == -1) // For builtin pop out (ATC, VFR Map, ect) { WindowManager.MoveWindow(hwnd, 0, 0); } diff --git a/VERSION.md b/VERSION.md index d7c2c89..11fa5fe 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,6 +1,9 @@ # Version History
+## Version 3.3.7 +* Fixed an issue where panel number circles are displayed at the wrong location instead of at the location where you clicked your mouse when setting monitor scale that is greater than 100% in Windows display setting. + ## Version 3.3.6 * Hot Fix: Resolved an issue where panel separation fails if your MSFS game window is not on the same monitor as where the panels are initially popped out (upper left corner). diff --git a/WpfApp/PanelCoorOverlay.xaml.cs b/WpfApp/PanelCoorOverlay.xaml.cs index 1bfd3f1..68ba241 100644 --- a/WpfApp/PanelCoorOverlay.xaml.cs +++ b/WpfApp/PanelCoorOverlay.xaml.cs @@ -1,6 +1,8 @@ -using MSFSPopoutPanelManager.Shared; +using MSFSPopoutPanelManager.Provider; +using MSFSPopoutPanelManager.Shared; using System; using System.Windows; +using System.Windows.Interop; namespace MSFSPopoutPanelManager.WpfApp { @@ -9,6 +11,9 @@ namespace MSFSPopoutPanelManager.WpfApp private const int TOP_ADJUSTMENT = 23; // half of window height private const int LEFT_ADJUSTMENT = 27; // half of window width + private int _leftCoor; + private int _topCoor; + public bool IsEditingPanelLocation { get; set; } public IntPtr WindowHandle { get; set; } @@ -22,14 +27,25 @@ namespace MSFSPopoutPanelManager.WpfApp IsEditingPanelLocation = false; this.LocationChanged += PanelCoorOverlay_LocationChanged; + this.Loaded += PanelCoorOverlay_Loaded; } public void MoveWindow(int x, int y) { + _leftCoor = x - LEFT_ADJUSTMENT; + _topCoor = y - TOP_ADJUSTMENT; + this.Left = x - LEFT_ADJUSTMENT; this.Top = y - TOP_ADJUSTMENT; } + private void PanelCoorOverlay_Loaded(object sender, System.EventArgs e) + { + // Fixed broken window left/top coordinate for DPI Awareness Per Monitor + var handle = new WindowInteropHelper(this).Handle; + WindowManager.MoveWindow(handle, _leftCoor, _topCoor); + } + private void PanelCoorOverlay_LocationChanged(object sender, EventArgs e) { if (this.Top is double.NaN || this.Left is double.NaN)