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

Add methods to set automatic window closing #1272

Merged
merged 1 commit into from Feb 6, 2019

Conversation

@kaikalii
Copy link
Contributor

@kaikalii kaikalii commented Feb 6, 2019

The implementors of AdvancedWindow that I have worked with automatically close the window when the X or ALT+F4 are pressed, but this is not always desirable. For example, upon the user attempting to close the window, a game might want to display a message first that says, "Are you sure you want to quit? All unsaved progress will be lost."

I have added methods to WindowSettings and AdvancedWindow that allow an automatic_close value to be set. If automatic_close is false, implementors of AdvancedWindow should not close the window, but should still send an Input::Close(..) event. The close attempt can be processed, and if the window really should be closed, then Window::set_should_close can be called. I have noted all of this in the method documentation. By default, automatic_close on WindowSettings is true so as not to add extra event-handling overhead for the majority of use cases.

@bvssvni
Copy link
Member

@bvssvni bvssvni commented Feb 6, 2019

Great work! Merge when ready.

@kaikalii
Copy link
Contributor Author

@kaikalii kaikalii commented Feb 6, 2019

Great work! Merge when ready.

Do you mean for me to merge it? because I don't have permissions.

@bvssvni
Copy link
Member

@bvssvni bvssvni commented Feb 6, 2019

Merging.

@bvssvni bvssvni merged commit fc76899 into PistonDevelopers:master Feb 6, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants