using System.Runtime.InteropServices;
namespace CursorLang.Core.Interop;
///
/// The right to bring a window to the foreground.
///
internal static class ForegroundPermissionNative
{
/// ASFW_ANY — any process gets the right.
private const uint AnyProcess = 0xFFFFFFFF;
///
/// Gives up our right to bring a window to the foreground in favour of other processes.
///
///
/// Windows does not let just anyone change the foreground window: you have to be
/// the process the user interacted with last. An instance started long ago is not
/// one of those, and its window will come up only if the right is shared by the
/// process the user has just launched.
///
internal static void GrantToAnyProcess() => AllowSetForegroundWindow(AnyProcess);
[DllImport("user32.dll")]
private static extern bool AllowSetForegroundWindow(uint dwProcessId);
}