mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user