mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02: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.TopMost = true;
|
||||||
Program.DotForm.Show();
|
Program.DotForm.Show();
|
||||||
Application.DoEvents();
|
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;
|
m.Result = SetForeGround() ? new IntPtr(1) : IntPtr.Zero;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ namespace MouseWithoutBorders
|
|||||||
CallingConvention = CallingConvention.StdCall)]
|
CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam);
|
internal static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam);
|
||||||
|
|
||||||
private enum InputType
|
internal enum InputType
|
||||||
{
|
{
|
||||||
INPUT_MOUSE = 0,
|
INPUT_MOUSE = 0,
|
||||||
INPUT_KEYBOARD = 1,
|
INPUT_KEYBOARD = 1,
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
Content=""
|
Content=""
|
||||||
FontFamily="{StaticResource SymbolThemeFontFamily}">
|
FontFamily="{StaticResource SymbolThemeFontFamily}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<TextBlock x:Uid="MouseWithoutBorders_CopyMachineName" />
|
<TextBlock x:Uid="MouseWithoutBorders_CopyMachineName" TextWrapping="Wrap" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
<Button HorizontalAlignment="Right" Command="{x:Bind Mode=OneTime, Path=ReconnectCommand}">
|
<Button HorizontalAlignment="Right" Command="{x:Bind Mode=OneTime, Path=ReconnectCommand}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<TextBlock x:Uid="MouseWithoutBorders_ReconnectTooltip" />
|
<TextBlock x:Uid="MouseWithoutBorders_ReconnectTooltip" TextWrapping="Wrap"/>
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
<TextBlock x:Uid="MouseWithoutBorders_ReconnectButton" />
|
<TextBlock x:Uid="MouseWithoutBorders_ReconnectButton" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user