1

In my mac application I am supporting full screen by changing system resolution of the device. And I am resetting back to old resolution if the user switches from full screen to windowed mode or if user quits the app and I need to handle force quit case also.
1. Is there any API or callback which tells the application if the user presses cmd+opt+esc(force quit).
2. Any other way to handle this?

I know in NSApplicaction there is an option to disable force quit([NSApplication setPresentationOptions: NSApplicationPresentationDisableForceQuit]) but instead of disabling it I want to handle force quit event.

Chandan Shetty SP
  • 5,087
  • 6
  • 42
  • 63

1 Answers1

3

The general consensus is that force quit sends a SIGKILL ("consensus" as I don't know any Apple documentation that states this, but it is the logical answer). A SIGKILL cannot be caught so you cannot do cleanup directly. An alternative is to run a helper application which monitors you main app and does the cleanup, the main app can terminate the helper on normal exit. See also this question.

Community
  • 1
  • 1
CRD
  • 52,522
  • 5
  • 70
  • 86