mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Fix ColorPicker editor and OOBE FancyZones snap (#13598)
This commit is contained in:
committed by
GitHub
parent
063beddb01
commit
805d8d81c5
@@ -9,12 +9,21 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
public static class NativeMethods
|
||||
{
|
||||
private const int GWL_STYLE = -16;
|
||||
private const int WS_POPUP = 1 << 31; // 0x80000000
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern uint SendInput(uint nInputs, NativeKeyboardHelper.INPUT[] pInputs, int cbSize);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
|
||||
internal static extern short GetAsyncKeyState(int vKey);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
#pragma warning disable CA1401 // P/Invokes should not be visible
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow);
|
||||
@@ -28,5 +37,10 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
||||
public static extern bool FreeLibrary(IntPtr hModule);
|
||||
#pragma warning restore CA1401 // P/Invokes should not be visible
|
||||
|
||||
public static void SetPopupStyle(IntPtr hwnd)
|
||||
{
|
||||
_ = SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Views;
|
||||
@@ -83,5 +84,12 @@ namespace PowerToys.Settings
|
||||
((App)Application.Current).OpenSettingsWindow(type);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
var hwnd = new WindowInteropHelper(this).Handle;
|
||||
NativeMethods.SetPopupStyle(hwnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user