mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-12-26 22:32:01 +00:00
Add touch for full screen pop out
This commit is contained in:
parent
7089a2aeff
commit
e94cb5e581
18 changed files with 55 additions and 294 deletions
|
@ -94,11 +94,11 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
|
|||
|
||||
[JsonIgnore]
|
||||
public bool IsDeletablePanel => PanelType != PanelType.HudBarWindow && PanelType != PanelType.RefocusDisplay &&
|
||||
PanelType != PanelType.NumPadWindow && PanelType != PanelType.SwitchWindow;
|
||||
PanelType != PanelType.NumPadWindow;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsTouchEnablePanel => PanelType != PanelType.HudBarWindow && PanelType != PanelType.RefocusDisplay &&
|
||||
PanelType != PanelType.NumPadWindow && PanelType != PanelType.SwitchWindow;
|
||||
PanelType != PanelType.NumPadWindow;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsCustomPopOut => PanelType == PanelType.CustomPopout;
|
||||
|
@ -116,9 +116,6 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
|
|||
[JsonIgnore]
|
||||
public bool IsNumPadWindow => PanelType == PanelType.NumPadWindow;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsSwitchWindow => PanelType == PanelType.SwitchWindow;
|
||||
|
||||
[JsonIgnore]
|
||||
public string PanelSourceCoordinateText
|
||||
{
|
||||
|
@ -130,5 +127,8 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
|
|||
return $"Left: {PanelSource.X} / Top: {PanelSource.Y}";
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public MonitorInfo FullScreenMonitorInfo { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
StatusMessageWindow = 7,
|
||||
RefocusDisplay = 8,
|
||||
NumPadWindow = 9,
|
||||
SwitchWindow = 20,
|
||||
Unknown = 100
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,5 @@ namespace MSFSPopoutPanelManager.DomainModel.Profile
|
|||
public RefocusOnDisplay RefocusOnDisplay { get; set; } = new();
|
||||
|
||||
public NumPadConfig NumPadConfig { get; set; } = new();
|
||||
|
||||
public SwitchWindowConfig SwitchWindowConfig { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using MSFSPopoutPanelManager.Shared;
|
||||
|
||||
namespace MSFSPopoutPanelManager.DomainModel.Profile
|
||||
{
|
||||
public class SwitchWindowConfig : ObservableObject
|
||||
{
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
|
||||
public List<SwitchWindowPanel> Panels { get; set; }
|
||||
}
|
||||
|
||||
public class SwitchWindowPanel
|
||||
{
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public string PanelCaption { get; set; }
|
||||
}
|
||||
}
|
|
@ -82,7 +82,6 @@ namespace MSFSPopoutPanelManager.MainApp
|
|||
services.AddTransient(s => new MessageWindowViewModel(SharedStorage, s.GetRequiredService<PanelSourceOrchestrator>(), s.GetRequiredService<PanelPopOutOrchestrator>()));
|
||||
services.AddTransient(s => new HudBarViewModel(SharedStorage, s.GetRequiredService<FlightSimOrchestrator>()));
|
||||
services.AddTransient(_ => new NumPadViewModel(SharedStorage));
|
||||
services.AddTransient(_ => new SwitchWindowViewModel(SharedStorage));
|
||||
|
||||
}).Build();
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@
|
|||
x:Name="StackPanelAdjustment"
|
||||
Width="440"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{c:Binding 'DataItem.IsBuiltInPopOut or DataItem.IsHudBarWindow or DataItem.IsNumPadWindow or DataItem.IsSwitchWindow or (DataItem.IsCustomPopOut and DataItem.PanelSource.X != null)'}">
|
||||
Visibility="{c:Binding 'DataItem.IsBuiltInPopOut or DataItem.IsHudBarWindow or DataItem.IsNumPadWindow or (DataItem.IsCustomPopOut and DataItem.PanelSource.X != null)'}">
|
||||
<popOutPanelCard:PanelConfigField
|
||||
Margin="20,0,0,0"
|
||||
BindingPath="Top"
|
||||
|
|
|
@ -267,16 +267,6 @@
|
|||
<TextBlock Style="{StaticResource TxtBlockDisableWhenLocked}" ToolTip="Add a virtual keyboard NumPad to the game that has MSFS focused before sending key command">Add a virtual keyboard NumPad</TextBlock>
|
||||
</WrapPanel>
|
||||
|
||||
<WrapPanel Name="WrapPanelSwitchWindow" Margin="0,8,0,0">
|
||||
<ToggleButton
|
||||
IsChecked="{Binding ActiveProfile.ProfileSetting.SwitchWindowConfig.IsEnabled, Mode=TwoWay, NotifyOnTargetUpdated=True}"
|
||||
IsHitTestVisible="{c:Binding '!ActiveProfile.IsLocked',
|
||||
Mode=OneWay}"
|
||||
Style="{StaticResource ToggleButton}"
|
||||
TargetUpdated="AddSwitchWindow_TargetUpdated" />
|
||||
<TextBlock Style="{StaticResource TxtBlockDisableWhenLocked}" ToolTip="Add a switch window command bar to the game">Add a switch window command bar</TextBlock>
|
||||
</WrapPanel>
|
||||
|
||||
<StackPanel Margin="0,8,0,0" Orientation="Horizontal">
|
||||
<WrapPanel>
|
||||
<ToggleButton
|
||||
|
|
|
@ -23,12 +23,6 @@ namespace MSFSPopoutPanelManager.MainApp.AppUserControl
|
|||
|
||||
_viewModel = App.AppHost.Services.GetRequiredService<ProfileCardViewModel>();
|
||||
Loaded += (_, _) => { DataContext = _viewModel; };
|
||||
|
||||
#if LOCAL || DEBUG
|
||||
this.WrapPanelSwitchWindow.Visibility = Visibility.Visible;
|
||||
#else
|
||||
this.WrapPanelSwitchWindow.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void ToggleButtonEditProfileTitle_Click(object sender, RoutedEventArgs e)
|
||||
|
@ -69,11 +63,6 @@ namespace MSFSPopoutPanelManager.MainApp.AppUserControl
|
|||
{
|
||||
_viewModel.AddNumPadUpdatedCommand?.Execute(null);
|
||||
}
|
||||
|
||||
private void AddSwitchWindow_TargetUpdated(object sender, DataTransferEventArgs e)
|
||||
{
|
||||
_viewModel.AddSwitchWindowUpdatedCommand?.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
<Window
|
||||
x:Class="MSFSPopoutPanelManager.MainApp.AppWindow.SwitchWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:viewmodel="clr-namespace:MSFSPopoutPanelManager.MainApp.ViewModel"
|
||||
Title="Switch Window"
|
||||
Height="60"
|
||||
MinHeight="60"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<system:Double x:Key="IconSize">28</system:Double>
|
||||
</Window.Resources>
|
||||
<materialDesign:ColorZone
|
||||
Height="60"
|
||||
BorderBrush="White"
|
||||
BorderThickness="1"
|
||||
Mode="Dark">
|
||||
<Grid Margin="10,0" d:DataContext="{d:DesignInstance viewmodel:SwitchWindowViewModel}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="30" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<WrapPanel Grid.Column="0" VerticalAlignment="Center" Name="WrapPanelCustomButtons">
|
||||
</WrapPanel>
|
||||
<WrapPanel
|
||||
Grid.Column="1"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
x:Name="BtnClose"
|
||||
Width="{StaticResource IconSize}"
|
||||
Height="{StaticResource IconSize}"
|
||||
Margin="0,0,0,0"
|
||||
Click="BtnClose_Click"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignIconButton}"
|
||||
ToolTip="Close application">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</materialDesign:ColorZone>
|
||||
</Window>
|
|
@ -1,86 +0,0 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MSFSPopoutPanelManager.MainApp.ViewModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace MSFSPopoutPanelManager.MainApp.AppWindow
|
||||
{
|
||||
public partial class SwitchWindow : Window
|
||||
{
|
||||
private readonly SwitchWindowViewModel _viewModel;
|
||||
|
||||
public SwitchWindow(Guid panelId, int initialWidth, int initialHeight)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
|
||||
return;
|
||||
|
||||
_viewModel = App.AppHost.Services.GetRequiredService<SwitchWindowViewModel>();
|
||||
_viewModel.PanelId = panelId;
|
||||
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
DataContext = _viewModel;
|
||||
|
||||
var window = Window.GetWindow(this);
|
||||
if (window == null)
|
||||
throw new ApplicationException("Unable to instantiate switchWindow window");
|
||||
|
||||
_viewModel.PanelConfig.PanelHandle = new WindowInteropHelper(window).Handle;
|
||||
|
||||
if (initialWidth == 0 && initialHeight == 0)
|
||||
{
|
||||
this.Width = 410;
|
||||
this.Height = 60;
|
||||
_viewModel.PanelConfig.Width = Convert.ToInt16(this.Width);
|
||||
_viewModel.PanelConfig.Height = Convert.ToInt32(this.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Width = initialWidth;
|
||||
this.Height = initialHeight;
|
||||
}
|
||||
};
|
||||
|
||||
this.MouseLeftButtonDown += SwitchWindow_MouseLeftButtonDown;
|
||||
this.Topmost = true;
|
||||
|
||||
if (_viewModel.ProfileData.ActiveProfile.ProfileSetting.SwitchWindowConfig.Panels != null)
|
||||
{
|
||||
var style = Application.Current.TryFindResource("MaterialDesignOutlinedButton") as Style;
|
||||
|
||||
WrapPanelCustomButtons.Children.Clear();
|
||||
|
||||
foreach (var panel in _viewModel.ProfileData.ActiveProfile.ProfileSetting.SwitchWindowConfig.Panels)
|
||||
{
|
||||
WrapPanelCustomButtons.Children.Add(new Button()
|
||||
{
|
||||
Height = 45,
|
||||
Margin = new Thickness(5, 5, 5, 5),
|
||||
Content = panel.DisplayName,
|
||||
Foreground = new SolidColorBrush(Colors.White),
|
||||
FontSize = 28,
|
||||
Style = style,
|
||||
Command = _viewModel.ButtonCommand,
|
||||
CommandParameter = panel.PanelCaption
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SwitchWindow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@
|
|||
Kind="ChevronDown"
|
||||
Opacity="0.5"
|
||||
RenderTransformOrigin="0.5 0.5"
|
||||
Visibility="{c:Binding '!DataItem.IsHudBarWindow and !DataItem.IsRefocusDisplay and !DataItem.IsNumPadWindow and !DataItem.IsSwitchWindow and !ActiveProfile.IsEditingPanelSource'}">
|
||||
Visibility="{c:Binding '!DataItem.IsHudBarWindow and !DataItem.IsRefocusDisplay and !DataItem.IsNumPadWindow and !ActiveProfile.IsEditingPanelSource'}">
|
||||
<wpf:PackIcon.RenderTransform>
|
||||
<RotateTransform x:Name="ExpandPathRotateTransform" />
|
||||
</wpf:PackIcon.RenderTransform>
|
||||
|
|
|
@ -36,9 +36,6 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
|||
|
||||
panelPopOutOrchestrator.OnNumPadOpened -= HandleOnNumPadOpened;
|
||||
panelPopOutOrchestrator.OnNumPadOpened += HandleOnNumPadOpened;
|
||||
|
||||
panelPopOutOrchestrator.OnSwitchWindowOpened -= HandleOnSwitchWindowOpened;
|
||||
panelPopOutOrchestrator.OnSwitchWindowOpened += HandleOnSwitchWindowOpened;
|
||||
}
|
||||
|
||||
private void HandleShowOverlay(object sender, PanelConfig panelConfig)
|
||||
|
@ -102,22 +99,6 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
|||
});
|
||||
}
|
||||
|
||||
private void HandleOnSwitchWindowOpened(object sender, PanelConfig panelConfig)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(async () =>
|
||||
{
|
||||
var switchWindow = new SwitchWindow(panelConfig.Id, panelConfig.Width, panelConfig.Height);
|
||||
switchWindow.Show();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
WindowActionManager.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height);
|
||||
WindowActionManager.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void HandleOnPopOutStarted(object sender, EventArgs e)
|
||||
{
|
||||
if (!AppSettingData.ApplicationSetting.PopOutSetting.MinimizeDuringPopOut)
|
||||
|
|
|
@ -41,8 +41,6 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
|||
|
||||
public ICommand AddNumPadUpdatedCommand { get; }
|
||||
|
||||
public ICommand AddSwitchWindowUpdatedCommand { get; }
|
||||
|
||||
public ICommand RefocusDisplayRefreshedCommand { get; }
|
||||
|
||||
public DelegateCommand<string> RefocusDisplaySelectionUpdatedCommand { get; }
|
||||
|
@ -102,9 +100,7 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
|||
AddHudBarUpdatedCommand = new DelegateCommand(OnAddHudBarUpdated);
|
||||
|
||||
AddNumPadUpdatedCommand = new DelegateCommand(OnAddNumPadUpdated);
|
||||
#if LOCAL
|
||||
AddSwitchWindowUpdatedCommand = new DelegateCommand(OnAddSwitchWindowUpdated);
|
||||
#endif
|
||||
|
||||
RefocusDisplayUpdatedCommand = new DelegateCommand(OnRefocusDisplayUpdated);
|
||||
|
||||
RefocusDisplayRefreshedCommand = new DelegateCommand(OnRefocusDisplayRefreshed);
|
||||
|
@ -243,34 +239,6 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private void OnAddSwitchWindowUpdated()
|
||||
{
|
||||
if (ActiveProfile == null)
|
||||
return;
|
||||
|
||||
if (ActiveProfile.ProfileSetting.SwitchWindowConfig.IsEnabled)
|
||||
{
|
||||
if (ActiveProfile.PanelConfigs.Any(p => p.PanelType == PanelType.SwitchWindow))
|
||||
return;
|
||||
|
||||
ActiveProfile.PanelConfigs.Add(new PanelConfig
|
||||
{
|
||||
PanelName = "Switch Window",
|
||||
PanelType = PanelType.SwitchWindow,
|
||||
Left = 0,
|
||||
Top = 0,
|
||||
Width = 0,
|
||||
Height = 0,
|
||||
AutoGameRefocus = false
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveProfile.PanelConfigs.RemoveAll(p => p.PanelType == PanelType.SwitchWindow);
|
||||
ActiveProfile.ProfileSetting.SwitchWindowConfig.Panels = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRefocusDisplayUpdated()
|
||||
{
|
||||
if (ActiveProfile == null)
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using MSFSPopoutPanelManager.DomainModel.Profile;
|
||||
using MSFSPopoutPanelManager.Orchestration;
|
||||
using MSFSPopoutPanelManager.WindowsAgent;
|
||||
using Prism.Commands;
|
||||
|
||||
namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
||||
{
|
||||
public class SwitchWindowViewModel : BaseViewModel
|
||||
{
|
||||
public DelegateCommand<string> ButtonCommand { get; private set; }
|
||||
|
||||
public Guid PanelId { get; set; }
|
||||
|
||||
public PanelConfig PanelConfig => ActiveProfile.PanelConfigs.FirstOrDefault(p => p.Id == PanelId);
|
||||
|
||||
|
||||
public SwitchWindowViewModel(SharedStorage sharedStorage) : base(sharedStorage)
|
||||
{
|
||||
ButtonCommand = new DelegateCommand<string>(OnButtonActivated);
|
||||
}
|
||||
|
||||
private void OnButtonActivated(string commandParameter)
|
||||
{
|
||||
var handle = PInvoke.GetWindowHandle(commandParameter);
|
||||
|
||||
if(handle != IntPtr.Zero)
|
||||
PInvoke.SwitchToThisWindow(handle, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -130,8 +130,15 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
{
|
||||
InputEmulationManager.ToggleFullScreenPanel(panelConfig.PanelHandle);
|
||||
|
||||
if (!panelConfig.FullScreen)
|
||||
if (panelConfig.FullScreen)
|
||||
{
|
||||
WindowActionManager.SetHostMonitor(panelConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowActionManager.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height);
|
||||
panelConfig.FullScreenMonitorInfo = null;
|
||||
}
|
||||
}
|
||||
else if (configPropertyName == PanelConfigPropertyName.PanelName)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
public event EventHandler OnPopOutCompleted;
|
||||
public event EventHandler<PanelConfig> OnHudBarOpened;
|
||||
public event EventHandler<PanelConfig> OnNumPadOpened;
|
||||
public event EventHandler<PanelConfig> OnSwitchWindowOpened;
|
||||
|
||||
public async Task ManualPopOut()
|
||||
{
|
||||
|
@ -124,8 +123,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
|
||||
StepAddNumPad();
|
||||
|
||||
StepAddSwitchWindow();
|
||||
|
||||
SetupRefocusDisplay();
|
||||
|
||||
StepApplyPanelConfig();
|
||||
|
@ -393,18 +390,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
});
|
||||
}
|
||||
|
||||
private void StepAddSwitchWindow()
|
||||
{
|
||||
if (!ActiveProfile.ProfileSetting.SwitchWindowConfig.IsEnabled)
|
||||
return;
|
||||
|
||||
WorkflowStepWithMessage.Execute("Opening Switch Window", () =>
|
||||
{
|
||||
var panelConfig = ActiveProfile.PanelConfigs.FirstOrDefault(p => p.PanelType == PanelType.SwitchWindow);
|
||||
OnSwitchWindowOpened?.Invoke(this, panelConfig);
|
||||
});
|
||||
}
|
||||
|
||||
public void SetupRefocusDisplay()
|
||||
{
|
||||
if (!ActiveProfile.ProfileSetting.RefocusOnDisplay.IsEnabled)
|
||||
|
@ -551,6 +536,9 @@ namespace MSFSPopoutPanelManager.Orchestration
|
|||
Thread.Sleep(500);
|
||||
InputEmulationManager.ToggleFullScreenPanel(panel.PanelHandle);
|
||||
Thread.Sleep(250);
|
||||
|
||||
if (panel.TouchEnabled)
|
||||
WindowActionManager.SetHostMonitor(panel); // Set full screen coordinate for touch
|
||||
}
|
||||
|
||||
if (panel.FloatingPanel.IsEnabled && panel.FloatingPanel.HasKeyboardBinding && panel.FloatingPanel.IsHiddenOnStart)
|
||||
|
|
|
@ -92,10 +92,8 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
|
||||
// If touch point is within pop out panel boundaries and have touch enabled
|
||||
var panelConfig = ActiveProfile.PanelConfigs.FirstOrDefault(p => p.TouchEnabled &&
|
||||
(info.pt.X > p.Left
|
||||
&& info.pt.X < p.Left + p.Width
|
||||
&& info.pt.Y > p.Top + (p.HideTitlebar ? 5 : PANEL_MENUBAR_HEIGHT)
|
||||
&& info.pt.Y < p.Top + p.Height));
|
||||
((p.FullScreen && CheckWithinFullScreenCoordinate(p, info)) || CheckWithinWindowCoordinate(p, info)));
|
||||
|
||||
|
||||
if (panelConfig == null)
|
||||
return PInvoke.CallNextHookEx(_hHook, code, wParam, lParam);
|
||||
|
@ -218,5 +216,21 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
|
||||
return PInvoke.CallNextHookEx(_hHook, code, wParam, lParam);
|
||||
}
|
||||
|
||||
private static bool CheckWithinWindowCoordinate(PanelConfig panelConfig, MSLLHOOKSTRUCT coor)
|
||||
{
|
||||
return coor.pt.X > panelConfig.Left
|
||||
&& coor.pt.X < panelConfig.Left + panelConfig.Width
|
||||
&& coor.pt.Y > panelConfig.Top + (panelConfig.HideTitlebar ? 5 : PANEL_MENUBAR_HEIGHT)
|
||||
&& coor.pt.Y < panelConfig.Top + panelConfig.Height;
|
||||
}
|
||||
|
||||
private static bool CheckWithinFullScreenCoordinate(PanelConfig panelConfig, MSLLHOOKSTRUCT coor)
|
||||
{
|
||||
return coor.pt.X > panelConfig.FullScreenMonitorInfo.X
|
||||
&& coor.pt.X < panelConfig.FullScreenMonitorInfo.X + panelConfig.FullScreenMonitorInfo.Width
|
||||
&& coor.pt.Y > panelConfig.FullScreenMonitorInfo.Y
|
||||
&& coor.pt.Y < panelConfig.FullScreenMonitorInfo.Y + panelConfig.FullScreenMonitorInfo.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,9 +183,6 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
|
||||
if (caption.IndexOf("Virtual NumPad", StringComparison.Ordinal) > -1)
|
||||
return PanelType.NumPadWindow;
|
||||
|
||||
if (caption.IndexOf("Switch Window", StringComparison.Ordinal) > -1)
|
||||
return PanelType.SwitchWindow;
|
||||
|
||||
return PanelType.PopOutManager;
|
||||
}
|
||||
|
@ -199,7 +196,7 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
{
|
||||
var panelType = GetWindowPanelType(hwnd);
|
||||
|
||||
if (panelType == PanelType.CustomPopout || panelType == PanelType.HudBarWindow || panelType == PanelType.NumPadWindow || panelType == PanelType.SwitchWindow)
|
||||
if (panelType == PanelType.CustomPopout || panelType == PanelType.HudBarWindow || panelType == PanelType.NumPadWindow)
|
||||
CloseWindow(hwnd);
|
||||
|
||||
return true;
|
||||
|
@ -314,5 +311,22 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
|||
|
||||
return text.Substring(0, 26).Equals("Microsoft Flight Simulator", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public static void SetHostMonitor(PanelConfig panelConfig)
|
||||
{
|
||||
foreach (var screen in System.Windows.Forms.Screen.AllScreens)
|
||||
{
|
||||
if (screen.Bounds.IntersectsWith(new Rectangle(panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height)))
|
||||
panelConfig.FullScreenMonitorInfo =
|
||||
new MonitorInfo
|
||||
{
|
||||
Name = screen.DeviceName.Substring(screen.DeviceName.LastIndexOf("\\", StringComparison.Ordinal) + 1),
|
||||
X = screen.Bounds.X,
|
||||
Y = screen.Bounds.Y,
|
||||
Width = screen.Bounds.Width,
|
||||
Height = screen.Bounds.Height
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue