Browse Source

add EnvVar to disable the x11 shutdown cancellation feature

pull/6883/head
Jumar Macato 5 years ago
parent
commit
b9e262f020
No known key found for this signature in database GPG Key ID: 85076C4D9D3155A3
  1. 8
      src/Avalonia.X11/X11PlatformLifetimeEvents.cs

8
src/Avalonia.X11/X11PlatformLifetimeEvents.cs

@ -34,6 +34,9 @@ namespace Avalonia.X11
private static readonly ICELib.IceIOErrorHandler s_iceIoErrorHandlerDelegate = StaticIceIOErrorHandler;
private static readonly SMLib.IceWatchProc s_iceWatchProcDelegate = IceWatchHandler;
private bool AllowShutdownCancellation =>
Environment.GetEnvironmentVariable("AVALONIA_X11_USE_SESSION_MANAGER") != "0";
private static SMLib.SmcCallbacks s_callbacks = new SMLib.SmcCallbacks()
{
ShutdownCancelled = Marshal.GetFunctionPointerForDelegate(s_shutdownCancelledDelegate),
@ -226,7 +229,10 @@ namespace Avalonia.X11
{
var e = new ShutdownRequestedEventArgs();
ShutdownRequested?.Invoke(this, e);
if (AllowShutdownCancellation)
{
ShutdownRequested?.Invoke(this, e);
}
SMLib.SmcInteractDone(smcConn, e.Cancel);

Loading…
Cancel
Save