[MWB]Simulate input to gain focus when hiding mouse (#26524)

* [MWB]Simulate input to gain focus when hiding mouse

* Little tooltip fix
This commit is contained in:
Jaime Bernardo
2023-05-31 16:59:15 +01:00
committed by GitHub
parent 0f04180912
commit 88656a9fe0
3 changed files with 8 additions and 3 deletions

View File

@@ -433,6 +433,11 @@ namespace MouseWithoutBorders
Program.DotForm.TopMost = true;
Program.DotForm.Show();
Application.DoEvents();
// Simulate input to help bring to the foreground, as it doesn't seem to work in every case otherwise.
NativeMethods.INPUT input = new NativeMethods.INPUT { type = (int)NativeMethods.InputType.INPUT_MOUSE, mi = { } };
NativeMethods.INPUT[] inputs = new NativeMethods.INPUT[] { input };
_ = NativeMethods.SendInput(1, inputs, Marshal.SizeOf(typeof(NativeMethods.INPUT)));
m.Result = SetForeGround() ? new IntPtr(1) : IntPtr.Zero;
break;

View File

@@ -405,7 +405,7 @@ namespace MouseWithoutBorders
CallingConvention = CallingConvention.StdCall)]
internal static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam);
private enum InputType
internal enum InputType
{
INPUT_MOUSE = 0,
INPUT_KEYBOARD = 1,

View File

@@ -92,7 +92,7 @@
Content=""
FontFamily="{StaticResource SymbolThemeFontFamily}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="MouseWithoutBorders_CopyMachineName" />
<TextBlock x:Uid="MouseWithoutBorders_CopyMachineName" TextWrapping="Wrap" />
</ToolTipService.ToolTip>
</Button>
</StackPanel>
@@ -161,7 +161,7 @@
</ItemsControl>
<Button HorizontalAlignment="Right" Command="{x:Bind Mode=OneTime, Path=ReconnectCommand}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="MouseWithoutBorders_ReconnectTooltip" />
<TextBlock x:Uid="MouseWithoutBorders_ReconnectTooltip" TextWrapping="Wrap"/>
</ToolTipService.ToolTip>
<TextBlock x:Uid="MouseWithoutBorders_ReconnectButton" />
</Button>