Skip to content

Add methods to set automatic window closing#1272

Merged
bvssvni merged 1 commit intoPistonDevelopers:masterfrom
kaikalii:master
Feb 6, 2019
Merged

Add methods to set automatic window closing#1272
bvssvni merged 1 commit intoPistonDevelopers:masterfrom
kaikalii:master

Conversation

@kaikalii
Copy link
Copy Markdown
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
Copy Markdown
Member

bvssvni commented Feb 6, 2019

Great work! Merge when ready.

@kaikalii
Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

bvssvni commented Feb 6, 2019

Merging.

@bvssvni bvssvni merged commit fc76899 into PistonDevelopers:master Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants