I am working on Win/MacOS game app. When user closes the app, I want to show a confirmation popup sorta "Are you sure you want to leave?".
On Windows, I listen to WM_CLOSE
message to intercept Alt-F4. Then, if user selects "Yes, I want to leave" -- I call PostQuitMessage(0);
to exit the app.
How do I intercept Cmd+Q on Mac OS? And, if user selects "Yes, I want to leave" -- how do I close the app (i.e. how to perform the same action as Cmd+Q does by default)?
MacOS part is in written in plain Objective-C and I am looking for an answer in Objective-C.