runelite / launcher

Launcher for RuneLite
https://runelite.net
BSD 2-Clause "Simplified" License
65 stars 95 forks source link

Handle CMD+Q inputs correctly on MacOS #104

Closed testing-ongithub closed 2 years ago

testing-ongithub commented 2 years ago

May require the setDefaultCloseOperation change from https://github.com/runelite/runelite/pull/14539.

Copying from that PR:

On MacOS, CMD+Q should result in a soft exit, which can allow for user confirmation, rather than a hard exit. Setting the "apple.eawt.quitStrategy" property to "CLOSE_ALL_WINDOWS" accomplishes this. However, the property has to be set before the _AppEventHandler is initialized and reads that property, which happens when SwingUtilities.invokeLater() is first called in SplashScreen.java.

Setting the "apple.eawt.quitStrategy" property to "CLOSE_ALL_WINDOWS" results in a windowClosing event being sent to each JFrame. If any of them handle that by exiting, the program will exit. Otherwise, the program will continue as if CMD+Q was not entered. The current SplashScreen windowClosing handling is EXIT_ON_CLOSE, so change it to DO_NOTHING_ON_CLOSE.