mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-13 16:05:01 +03:00
Update App.axaml.cs (#9421)
* Update App.axaml.cs * Update App.axaml.cs * Create MacOSAppHelper.cs * Update App.axaml.cs Removed unused macOS activation policy methods and constants. * Update and rename MacOSAppHelper.cs to MacAppUtils.cs * Update App.axaml.cs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace v2rayN.Desktop.Common;
|
||||
|
||||
internal static class MacAppUtils
|
||||
{
|
||||
private const string LibObjC = "/usr/lib/libobjc.dylib";
|
||||
private const nint ActivationPolicyAccessory = 1;
|
||||
|
||||
public static void SetActivationPolicyAccessory()
|
||||
=> objc_msgSend(
|
||||
objc_msgSend(objc_getClass("NSApplication"), sel_registerName("sharedApplication")),
|
||||
sel_registerName("setActivationPolicy:"),
|
||||
ActivationPolicyAccessory);
|
||||
|
||||
[DllImport(LibObjC)]
|
||||
private static extern nint objc_getClass(string name);
|
||||
|
||||
[DllImport(LibObjC)]
|
||||
private static extern nint sel_registerName(string name);
|
||||
|
||||
[DllImport(LibObjC, EntryPoint = "objc_msgSend")]
|
||||
private static extern nint objc_msgSend(nint receiver, nint selector);
|
||||
|
||||
[DllImport(LibObjC, EntryPoint = "objc_msgSend")]
|
||||
private static extern void objc_msgSend(nint receiver, nint selector, nint argument);
|
||||
}
|
||||
Reference in New Issue
Block a user