Browse Source

formatting

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

19
src/Avalonia.X11/X11PlatformLifetimeEvents.cs

@ -17,7 +17,8 @@ namespace Avalonia.X11
private const ulong SmcSaveCompleteProcMask = 4L; private const ulong SmcSaveCompleteProcMask = 4L;
private const ulong SmcShutdownCancelledProcMask = 8L; private const ulong SmcShutdownCancelledProcMask = 8L;
private static readonly ConcurrentDictionary<IntPtr, X11PlatformLifetimeEvents> s_nativeToManagedMapper = new ConcurrentDictionary<IntPtr, X11PlatformLifetimeEvents>(); private static readonly ConcurrentDictionary<IntPtr, X11PlatformLifetimeEvents> s_nativeToManagedMapper =
new ConcurrentDictionary<IntPtr, X11PlatformLifetimeEvents>();
private static readonly SMLib.SmcSaveYourselfProc s_saveYourselfProcDelegate = SmcSaveYourselfHandler; private static readonly SMLib.SmcSaveYourselfProc s_saveYourselfProcDelegate = SmcSaveYourselfHandler;
private static readonly SMLib.SmcDieProc s_dieDelegate = SmcDieHandler; private static readonly SMLib.SmcDieProc s_dieDelegate = SmcDieHandler;
@ -196,7 +197,10 @@ namespace Avalonia.X11
private void SaveYourselfHandler(IntPtr smcConn, IntPtr clientData, bool shutdown, bool fast) private void SaveYourselfHandler(IntPtr smcConn, IntPtr clientData, bool shutdown, bool fast)
{ {
if (_saveYourselfPhase) if (_saveYourselfPhase)
{
SMLib.SmcSaveYourselfDone(smcConn, true); SMLib.SmcSaveYourselfDone(smcConn, true);
}
_saveYourselfPhase = true; _saveYourselfPhase = true;
if (shutdown && !fast) if (shutdown && !fast)
@ -216,10 +220,12 @@ namespace Avalonia.X11
{ {
// ReSharper disable once ConditionIsAlwaysTrueOrFalse // ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (ShutdownRequested is null) if (ShutdownRequested is null)
{
return; return;
}
var e = new ShutdownRequestedEventArgs();
var e = new ShutdownRequestedEventArgs();
ShutdownRequested(this, e); ShutdownRequested(this, e);
var shutdownCancelled = e.Cancel; var shutdownCancelled = e.Cancel;
@ -227,16 +233,19 @@ namespace Avalonia.X11
SMLib.SmcInteractDone(smcConn, shutdownCancelled); SMLib.SmcInteractDone(smcConn, shutdownCancelled);
if (shutdownCancelled) if (shutdownCancelled)
{
return; return;
}
_saveYourselfPhase = false;
_saveYourselfPhase = false;
SMLib.SmcSaveYourselfDone(smcConn, true); SMLib.SmcSaveYourselfDone(smcConn, true);
} }
private static void IceWatchHandler(IntPtr iceConn, IntPtr clientData, bool opening, IntPtr* watchData) private static void IceWatchHandler(IntPtr iceConn, IntPtr clientData, bool opening, IntPtr* watchData)
{ {
if (!opening) return; if (!opening) return;
ICELib.IceRemoveConnectionWatch(Marshal.GetFunctionPointerForDelegate(s_iceWatchProcDelegate), ICELib.IceRemoveConnectionWatch(Marshal.GetFunctionPointerForDelegate(s_iceWatchProcDelegate),
IntPtr.Zero); IntPtr.Zero);
} }

Loading…
Cancel
Save