mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +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.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,
|
||||
|
||||
Reference in New Issue
Block a user