Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Modify behaviour when last editor gets closed #8023

Merged
merged 1 commit into from
Nov 23, 2018

Conversation

facchinm
Copy link
Member

@facchinm facchinm commented Sep 21, 2018

Fixes #8021 and #936

@facchinm facchinm changed the title [WIP] Modify behaviour of OSX close [macOS] Modify behaviour when last editor gets closed Sep 24, 2018
@facchinm facchinm added the OS: OSX Specific to the Mac OS X (macOS) version of the Arduino IDE label Sep 24, 2018
@facchinm facchinm added this to the Release 1.8.8 milestone Sep 24, 2018
@arduino arduino deleted a comment from ArduinoBot Sep 24, 2018
Copy link
Contributor

@sandeepmistry sandeepmistry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this out on macOS 10.12.6.

When I close all the IDE windows, the app now stays open. Cmd-N can be used to create a new sketch, same for File -> New

@@ -921,7 +922,10 @@ public boolean handleClose(Editor editor) {
storeSketches();

// This will store the sketch count as zero
editor.setVisible(false);
//editor.dispose();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the commented code :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it there for a reason :) On my trials, if dispose() gets called the toolbar doesn't disappear but clicking on any element has no effect. I believe it's a broader bug, since the toolbar handlers are declared inside the first Editor instance. If we refactor the code dispose() should be called, so it's more like a reminder :)

}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better error handling here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely (no idea about how to handle it anyway)

@gvarisco
Copy link
Contributor

gvarisco commented Sep 25, 2018

@sandeepmistry same here, despite I've noticed that if you have multiple tabs and decide to close the first one, the app "goes away" (as in: stays in background, do not kill itself, but tabs are gone if you click again on it) instead of showing the other tabs kept open.

cc @facchinm

@facchinm
Copy link
Member Author

@gvarisco can you expand on that? The "new" behaviour should only kick in if a single Editor windows is open (multiple tabs on the same editor don't count they are part of an "atomic" sketch).
At reopen I asked @akash73 what is the expected behaviour for OSX users and we agreed to implement "new empty sketch" instead than "reopen last sketch". It can be changed of course 😉

@gvarisco
Copy link
Contributor

Clarified with @facchinm - all good on my side. LGTM.

Don't call System.exit() but trust the ThinkDifferent handler
Handle reopen only if no editor is visible
Don't dispose last closing editor (so its toolbars are still in active state)
@facchinm facchinm merged commit c311a94 into arduino:master Nov 23, 2018
@cmaglie cmaglie deleted the new_behaviour_osx_close branch January 9, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: OSX Specific to the Mac OS X (macOS) version of the Arduino IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants