arduino-ide
arduino-ide copied to clipboard
[ATL-483] mac not to quit with all windows closed
Why
As reported closing the IDE when the last window is closed is an uncommon pattern in IDEs, and for good. This will enable opening projects from within the IDE2 even when no projects are currently open.
How
Listen to quit event and close the application only if not running on macOS
Fixes https://github.com/arduino/arduino-ide/issues/91
No explanation was provided for the closure of this PR, so I reopen it. If it is to be closed, the reason must be clearly documented:
Was the approach taken in the PR fatally flawed? If so, document exactly what was the flaw so that the mistake can be avoided on the next attempt.
Is there some unfinished work on the PR? If so, document exactly what is missing so that work can be completed.
It would be a lot of work to complete this PR. All menu bar handling is on the renderer side. Each renderer builds its own menu tree and then calls on main to install it (CHANNEL_SET_MENU_WITH_NODE_ID). Main builds a native copy of the menu tree and installs the copy. When a menu item is clicked on main calls back into the renderer to invoke the handler (CHANNEL_MAIN_MENU_ITEM_DID_CLICK).
When the last sketch window is closed the native menu bar is left behind. Attempting to execute an item causes main to send a message to the destroyed renderer leading to an uncaught exception.
From what I can tell this architecture is inherited from Theia.