1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-21 13:20:11 +00:00

Added RSG GTN750 refocus override

This commit is contained in:
Stanley 2022-09-25 10:49:49 -04:00
parent da4a6498f9
commit 7db356cb43
16 changed files with 178 additions and 62 deletions

View file

@ -10,9 +10,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.ArduinoAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.ArduinoAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -10,9 +10,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.Orchestration</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.Orchestration</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -4,6 +4,8 @@ using MSFSPopoutPanelManager.WindowsAgent;
using System; using System;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MSFSPopoutPanelManager.Orchestration namespace MSFSPopoutPanelManager.Orchestration
{ {
@ -14,6 +16,11 @@ namespace MSFSPopoutPanelManager.Orchestration
private Rectangle _lastWindowRectangle; private Rectangle _lastWindowRectangle;
private IntPtr _panelHandleDisableRefresh = IntPtr.Zero; private IntPtr _panelHandleDisableRefresh = IntPtr.Zero;
private uint _prevWinEvent = PInvokeConstant.EVENT_SYSTEM_CAPTUREEND;
private int _winEventClickLock = 0;
private object _hookLock = new object();
private bool _isHookMouseDown = false;
public PanelConfigurationOrchestrator() public PanelConfigurationOrchestrator()
{ {
_winEvent = new PInvoke.WinEventProc(EventCallback); _winEvent = new PInvoke.WinEventProc(EventCallback);
@ -199,7 +206,10 @@ namespace MSFSPopoutPanelManager.Orchestration
return; return;
// Setup panel config event hooks // Setup panel config event hooks
_winEventHook = PInvoke.SetWinEventHook(PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND, PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, _winEvent, 0, 0, PInvokeConstant.WINEVENT_OUTOFCONTEXT); if (!ActiveProfile.RealSimGearGTN750Gen1Override)
_winEventHook = PInvoke.SetWinEventHook(PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND, PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, _winEvent, 0, 0, PInvokeConstant.WINEVENT_OUTOFCONTEXT);
else
_winEventHook = PInvoke.SetWinEventHook(PInvokeConstant.EVENT_SYSTEM_CAPTURESTART, PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, _winEvent, 0, 0, PInvokeConstant.WINEVENT_OUTOFCONTEXT);
} }
private void UnhookWinEvent() private void UnhookWinEvent()
@ -214,6 +224,8 @@ namespace MSFSPopoutPanelManager.Orchestration
{ {
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE: case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND: case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
case PInvokeConstant.EVENT_SYSTEM_CAPTURESTART:
case PInvokeConstant.EVENT_SYSTEM_CAPTUREEND:
// check by priority to speed up comparing of escaping constraints // check by priority to speed up comparing of escaping constraints
if (hwnd == IntPtr.Zero || idObject != 0 || hWinEventHook != _winEventHook || !AllowEdit) if (hwnd == IntPtr.Zero || idObject != 0 || hWinEventHook != _winEventHook || !AllowEdit)
return; return;
@ -253,6 +265,17 @@ namespace MSFSPopoutPanelManager.Orchestration
PInvoke.ShowWindow(hwnd, PInvokeConstant.SW_RESTORE); PInvoke.ShowWindow(hwnd, PInvokeConstant.SW_RESTORE);
} }
break; break;
case PInvokeConstant.EVENT_SYSTEM_CAPTURESTART:
if (!panelConfig.HasTouchableEvent || _prevWinEvent == PInvokeConstant.EVENT_SYSTEM_CAPTURESTART)
break;
HandleTouchDownEvent(panelConfig);
break;
case PInvokeConstant.EVENT_SYSTEM_CAPTUREEND:
if (!panelConfig.TouchEnabled || _prevWinEvent == PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE)
break;
HandleTouchUpEvent(panelConfig);
break;
} }
} }
else else
@ -301,6 +324,75 @@ namespace MSFSPopoutPanelManager.Orchestration
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND: case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
ProfileData.WriteProfiles(); ProfileData.WriteProfiles();
break; break;
case PInvokeConstant.EVENT_SYSTEM_CAPTURESTART:
if (!panelConfig.HasTouchableEvent || _prevWinEvent == PInvokeConstant.EVENT_SYSTEM_CAPTURESTART)
break;
HandleTouchDownEvent(panelConfig);
break;
case PInvokeConstant.EVENT_SYSTEM_CAPTUREEND:
if (!panelConfig.TouchEnabled || _prevWinEvent == PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE)
break;
HandleTouchUpEvent(panelConfig);
break;
}
}
}
private void HandleTouchDownEvent(PanelConfig panelConfig)
{
if (!_isHookMouseDown)
{
lock (_hookLock)
{
Point point;
PInvoke.GetCursorPos(out point);
// Disable left clicking if user is touching the title bar area
if (point.Y - panelConfig.Top > (panelConfig.HideTitlebar ? 5 : 31))
_isHookMouseDown = true;
}
}
}
private void HandleTouchUpEvent(PanelConfig panelConfig)
{
if (_isHookMouseDown)
{
Thread.Sleep(AppSettingData.AppSetting.TouchScreenSettings.TouchDownUpDelay);
lock (_hookLock)
{
_isHookMouseDown = false;
Point point;
PInvoke.GetCursorPos(out point);
// Disable left clicking if user is touching the title bar area
if (point.Y - panelConfig.Top > (panelConfig.HideTitlebar ? 5 : 31))
{
var prevWinEventClickLock = ++_winEventClickLock;
if (prevWinEventClickLock == _winEventClickLock && AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindow)
{
Task.Run(() => RefocusMsfs(panelConfig.PanelHandle, prevWinEventClickLock));
}
}
}
}
}
private void RefocusMsfs(IntPtr panelConfigHandle, int prevWinEventClickLock)
{
Thread.Sleep(AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindowDelay);
if (prevWinEventClickLock == _winEventClickLock)
{
if (!_isHookMouseDown)
{
var rectangle = WindowActionManager.GetWindowRect(panelConfigHandle);
PInvoke.SetCursorPos(rectangle.X - 5, rectangle.Y + 5);
} }
} }
} }

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.Shared</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.Shared</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.SimConnectAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.SimConnectAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.TouchPanelAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.TouchPanelAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -140,6 +140,7 @@ namespace MSFSPopoutPanelManager.UserDataAgent
TouchDownUpDelay = 0; TouchDownUpDelay = 0;
RefocusGameWindow = true; RefocusGameWindow = true;
RefocusGameWindowDelay = 500; RefocusGameWindowDelay = 500;
RealSimGearGTN750Gen1Override = false;
} }
public int TouchDownUpDelay { get; set; } public int TouchDownUpDelay { get; set; }
@ -147,6 +148,8 @@ namespace MSFSPopoutPanelManager.UserDataAgent
public bool RefocusGameWindow { get; set; } public bool RefocusGameWindow { get; set; }
public int RefocusGameWindowDelay { get; set; } public int RefocusGameWindowDelay { get; set; }
public bool RealSimGearGTN750Gen1Override { get; set; }
} }
public class TouchPanelSettings : ObservableObject public class TouchPanelSettings : ObservableObject

View file

@ -16,6 +16,7 @@ namespace MSFSPopoutPanelManager.UserDataAgent
IsLocked = false; IsLocked = false;
PowerOnRequiredForColdStart = false; PowerOnRequiredForColdStart = false;
IncludeInGamePanels = false; IncludeInGamePanels = false;
RealSimGearGTN750Gen1Override = false;
MsfsGameWindowConfig = new MsfsGameWindowConfig(); MsfsGameWindowConfig = new MsfsGameWindowConfig();
@ -46,6 +47,8 @@ namespace MSFSPopoutPanelManager.UserDataAgent
public bool IncludeInGamePanels { get; set; } public bool IncludeInGamePanels { get; set; }
public bool RealSimGearGTN750Gen1Override { get; set; }
public MsfsGameWindowConfig MsfsGameWindowConfig { get; set; } public MsfsGameWindowConfig MsfsGameWindowConfig { get; set; }
[JsonIgnore] [JsonIgnore]

View file

@ -10,9 +10,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.UserDataAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.UserDataAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.WebServer</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.WebServer</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -16,6 +16,9 @@ namespace MSFSPopoutPanelManager.WindowsAgent
public const int SW_MINIMIZE = 6; public const int SW_MINIMIZE = 6;
public const int SW_RESTORE = 9; public const int SW_RESTORE = 9;
public const uint EVENT_SYSTEM_CAPTURESTART = 0x0008;
public const uint EVENT_SYSTEM_CAPTUREEND = 0x0009;
public const uint EVENT_SYSTEM_MOVESIZESTART = 0x000A;
public const uint EVENT_SYSTEM_MOVESIZEEND = 0x000B; public const uint EVENT_SYSTEM_MOVESIZEEND = 0x000B;
public const uint EVENT_OBJECT_LOCATIONCHANGE = 0x800B; public const uint EVENT_OBJECT_LOCATIONCHANGE = 0x800B;

View file

@ -15,10 +15,9 @@ namespace MSFSPopoutPanelManager.WindowsAgent
private static PInvoke.WindowsHookExProc callbackDelegate = HookCallBack; private static PInvoke.WindowsHookExProc callbackDelegate = HookCallBack;
private static bool _isTouchDown; private static bool _isTouchDown;
private static int _mouseMoveCount; private static int _mouseMoveCount;
private static bool _isMouseMoveBlock = false;
private static object _mouseTouchLock = new object(); private static object _mouseTouchLock = new object();
private static bool _isDragged = false; private static bool _isDragged = false;
private static bool _refocused = true; private static int _refocusedTaskIndex = 0;
private const int PANEL_MENUBAR_HEIGHT = 31; private const int PANEL_MENUBAR_HEIGHT = 31;
private const uint TOUCH_FLAG = 0xFF515700; private const uint TOUCH_FLAG = 0xFF515700;
@ -37,18 +36,30 @@ namespace MSFSPopoutPanelManager.WindowsAgent
public static void Hook() public static void Hook()
{ {
// If using RSG GT750 Gen 1, disable touch support
if (ActiveProfile != null && ActiveProfile.RealSimGearGTN750Gen1Override)
return;
_simulatorProcess = WindowProcessManager.GetSimulatorProcess(); _simulatorProcess = WindowProcessManager.GetSimulatorProcess();
Process curProcess = Process.GetCurrentProcess(); Process curProcess = Process.GetCurrentProcess();
ProcessModule curModule = curProcess.MainModule; ProcessModule curModule = curProcess.MainModule;
var hookWindowPtr = PInvoke.GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName); var hookWindowPtr = PInvoke.GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName);
_hHook = PInvoke.SetWindowsHookEx(HookType.WH_MOUSE_LL, callbackDelegate, hookWindowPtr, 0); _hHook = PInvoke.SetWindowsHookEx(HookType.WH_MOUSE_LL, callbackDelegate, hookWindowPtr, 0);
} }
public static void UnHook() public static void UnHook()
{ {
PInvoke.UnhookWindowsHookEx(_hHook); // If using RSG GT750 Gen 1, disable touch support
_hHook = IntPtr.Zero; if (ActiveProfile != null && ActiveProfile.RealSimGearGTN750Gen1Override)
return;
if (_hHook != IntPtr.Zero)
{
PInvoke.UnhookWindowsHookEx(_hHook);
_hHook = IntPtr.Zero;
}
} }
public static bool IsHooked { get { return _hHook != IntPtr.Zero; } } public static bool IsHooked { get { return _hHook != IntPtr.Zero; } }
@ -58,7 +69,6 @@ namespace MSFSPopoutPanelManager.WindowsAgent
if (code != 0) if (code != 0)
return PInvoke.CallNextHookEx(_hHook, code, wParam, lParam); return PInvoke.CallNextHookEx(_hHook, code, wParam, lParam);
var info = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT)); var info = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
var extraInfo = (uint)info.dwExtraInfo; var extraInfo = (uint)info.dwExtraInfo;
var isTouched = (extraInfo & TOUCH_FLAG) == TOUCH_FLAG; var isTouched = (extraInfo & TOUCH_FLAG) == TOUCH_FLAG;
@ -104,9 +114,7 @@ namespace MSFSPopoutPanelManager.WindowsAgent
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
if (!_isTouchDown) if (!_isTouchDown)
{ {
_refocused = false;
_isTouchDown = true; _isTouchDown = true;
_isMouseMoveBlock = true;
lock (_mouseTouchLock) lock (_mouseTouchLock)
{ {
@ -121,7 +129,6 @@ namespace MSFSPopoutPanelManager.WindowsAgent
Thread.Sleep(AppSetting.TouchScreenSettings.TouchDownUpDelay + 25); Thread.Sleep(AppSetting.TouchScreenSettings.TouchDownUpDelay + 25);
PInvoke.mouse_event(MOUSEEVENTF_LEFTDOWN, info.pt.X, info.pt.Y, 0, 0); PInvoke.mouse_event(MOUSEEVENTF_LEFTDOWN, info.pt.X, info.pt.Y, 0, 0);
Thread.Sleep(AppSetting.TouchScreenSettings.TouchDownUpDelay + 50); Thread.Sleep(AppSetting.TouchScreenSettings.TouchDownUpDelay + 50);
_isMouseMoveBlock = false;
_isTouchDown = false; _isTouchDown = false;
}); });
} }
@ -142,11 +149,25 @@ namespace MSFSPopoutPanelManager.WindowsAgent
_isDragged = false; _isDragged = false;
} }
_mouseMoveCount = 0; _mouseMoveCount = 0;
RefocusMsfsGameWindow(panelConfig);
// Refocus game window
if (AppSetting.TouchScreenSettings.RefocusGameWindow && !panelConfig.DisableGameRefocus)
{
_refocusedTaskIndex++;
var currentRefocusIndex = _refocusedTaskIndex;
Thread.Sleep(AppSetting.TouchScreenSettings.RefocusGameWindowDelay);
if (currentRefocusIndex == _refocusedTaskIndex)
{
var rectangle = WindowActionManager.GetWindowRect(panelConfig.PanelHandle);
PInvoke.SetCursorPos(rectangle.X - 5, rectangle.Y + 5);
}
}
}); });
return 1; return 1;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if (_isMouseMoveBlock) if (_isTouchDown)
return 1; return 1;
_mouseMoveCount++; _mouseMoveCount++;
@ -156,19 +177,5 @@ namespace MSFSPopoutPanelManager.WindowsAgent
return PInvoke.CallNextHookEx(_hHook, code, wParam, lParam); return PInvoke.CallNextHookEx(_hHook, code, wParam, lParam);
} }
private static void RefocusMsfsGameWindow(PanelConfig panelConfig)
{
Thread.Sleep(AppSetting.TouchScreenSettings.RefocusGameWindowDelay);
if (!_refocused && !_isTouchDown && AppSetting.TouchScreenSettings.RefocusGameWindow && !panelConfig.DisableGameRefocus)
{
_refocused = true;
var rectangle = WindowActionManager.GetWindowRect(_simulatorProcess.Handle);
var clientRectangle = WindowActionManager.GetClientRect(_simulatorProcess.Handle);
PInvoke.SetCursorPos(rectangle.X + clientRectangle.Width / 2, rectangle.Y + clientRectangle.Height / 2);
}
}
} }
} }

View file

@ -11,9 +11,9 @@
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.WindowsAgent</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.WindowsAgent</RootNamespace>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>Embedded</DebugType> <DebugType>Embedded</DebugType>
<Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations> <Configurations>Debug;Release;DebugTouchPanel;ReleaseTouchPanel</Configurations>

View file

@ -262,17 +262,22 @@
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Vertical" Visibility="{Binding TouchSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}"> <WrapPanel Orientation="Vertical" Visibility="{Binding TouchSettingsVisible, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}">
<WrapPanel Orientation="Vertical" Margin="0,0,20,20"> <WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Refocus Game Window</TextBlock> <TextBlock Style="{StaticResource TextBlockHeading}">Refocus Game Window</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/> <Line Stretch="Fill" Stroke="Gray" X2="1"/>
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindow, Mode=TwoWay}" > <CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindow, Mode=TwoWay}" >
<AccessText TextWrapping="Wrap">Automactically set focus back to game window after a period of inactivity on touch enabled panel. This will give your flight control back when using pop out panel.</AccessText> <AccessText TextWrapping="Wrap">Automactically set focus back to game window after a period of inactivity on touch enabled panel. This will give your flight control back when using pop out panel.</AccessText>
</CheckBox> </CheckBox>
<WrapPanel Margin="0,10,0,0"> <WrapPanel Margin="0,10,0,0">
<mah:NumericUpDown Width="100" Minimum="500" Maximum="2000" Interval="500" FontSize="16" Height="32" Value="{Binding AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindowDelay, Mode=TwoWay}"></mah:NumericUpDown> <mah:NumericUpDown Width="100" Minimum="500" Maximum="2000" Interval="500" FontSize="16" Height="32" Value="{Binding AppSettingData.AppSetting.TouchScreenSettings.RefocusGameWindowDelay, Mode=TwoWay}"></mah:NumericUpDown>
<AccessText Margin="10,0,0,0" Width="490">Amount of time in milliseconds to wait for touch inactivity before input focus goes back to game window.</AccessText> <AccessText Margin="10,0,0,0" Width="490">Amount of time in milliseconds to wait for touch inactivity before input focus goes back to game window.</AccessText>
</WrapPanel>
<WrapPanel Margin="0,10,0,0">
<CheckBox IsChecked="{Binding AppSettingData.AppSetting.TouchScreenSettings.RealSimGearGTN750Gen1Override, Mode=TwoWay}" >
<AccessText Margin="10,0,0,0" Width="490">Use custom refocus logic for RealSimGear GTN750 Gen1.</AccessText>
</CheckBox>
</WrapPanel>
</WrapPanel> </WrapPanel>
</WrapPanel>
<WrapPanel Orientation="Vertical" Margin="0,0,20,20"> <WrapPanel Orientation="Vertical" Margin="0,0,20,20">
<TextBlock Style="{StaticResource TextBlockHeading}">Touch Down Touch Up Delay</TextBlock> <TextBlock Style="{StaticResource TextBlockHeading}">Touch Down Touch Up Delay</TextBlock>
<Line Stretch="Fill" Stroke="Gray" X2="1"/> <Line Stretch="Fill" Stroke="Gray" X2="1"/>

View file

@ -78,6 +78,9 @@
</WrapPanel> </WrapPanel>
<CheckBox Margin="10,5,0,0" Content="Power on required to pop out panels on cold start (G1000 / NXi Only)" IsChecked="{Binding ProfileData.ActiveProfile.PowerOnRequiredForColdStart}" Command="{Binding SetPowerOnRequiredCommand}" /> <CheckBox Margin="10,5,0,0" Content="Power on required to pop out panels on cold start (G1000 / NXi Only)" IsChecked="{Binding ProfileData.ActiveProfile.PowerOnRequiredForColdStart}" Command="{Binding SetPowerOnRequiredCommand}" />
<CheckBox Margin="10,5,0,0" Content="Include in-game menu bar panels (VFR Map, Checklist, ATC, etc)" IsChecked="{Binding ProfileData.ActiveProfile.IncludeInGamePanels}" Command="{Binding SetIncludeInGamePanelsCommand}" /> <CheckBox Margin="10,5,0,0" Content="Include in-game menu bar panels (VFR Map, Checklist, ATC, etc)" IsChecked="{Binding ProfileData.ActiveProfile.IncludeInGamePanels}" Command="{Binding SetIncludeInGamePanelsCommand}" />
<WrapPanel Orientation="Horizontal" Visibility="{Binding AppSettingData.AppSetting.TouchScreenSettings.RealSimGearGTN750Gen1Override, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}" >
<CheckBox Margin="10,5,0,0" Content="RealSimGear GTN750 Gen1" IsChecked="{Binding ProfileData.ActiveProfile.RealSimGearGTN750Gen1Override}" Command="{Binding SetIncludeInGamePanelsCommand}" />
</WrapPanel>
<WrapPanel Name="TouchPanelConfigurationPanel" Orientation="Horizontal" Margin="0,10,0,0" Visibility="{Binding AppSettingData.AppSetting.IsEnabledTouchPanelServer, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}" > <WrapPanel Name="TouchPanelConfigurationPanel" Orientation="Horizontal" Margin="0,10,0,0" Visibility="{Binding AppSettingData.AppSetting.IsEnabledTouchPanelServer, Converter={StaticResource VisibleIfTrueConverter}, Mode=OneWay}" >
<Label Content="Open MSFS touch panel when flight session starts" Margin="5,0,0,0" /> <Label Content="Open MSFS touch panel when flight session starts" Margin="5,0,0,0" />
<Button Content="+" ToolTip="Add Binding" Margin="94,0,0,0" Width="40" Command="{Binding OpenTouchPanelBindingCommand}"/> <Button Content="+" ToolTip="Add Binding" Margin="94,0,0,0" Width="40" Command="{Binding OpenTouchPanelBindingCommand}"/>

View file

@ -14,9 +14,9 @@
<RootNamespace>MSFSPopoutPanelManager.WpfApp</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.WpfApp</RootNamespace>
<ApplicationIcon>logo.ico</ApplicationIcon> <ApplicationIcon>logo.ico</ApplicationIcon>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Version>3.4.3.0911</Version> <Version>3.4.4.0925</Version>
<AssemblyVersion>3.4.3.0911</AssemblyVersion> <AssemblyVersion>3.4.4.0925</AssemblyVersion>
<FileVersion>3.4.3.0911</FileVersion> <FileVersion>3.4.4.0925</FileVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugType>embedded</DebugType> <DebugType>embedded</DebugType>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> <SatelliteResourceLanguages>en</SatelliteResourceLanguages>