You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One simple thing I would like from Piston is the ability to disable automatic window closing when the window's "X" button in the top corner is pressed. For example, if I am developing some kind of editor-like interface, and the user tries to close the window, I would like to be able to intercept that close request and ask them if they would like to save their data first.
My idea would be to add automatic_close(self, bool) -> Self and set_automatic_close(&mut self, bool) methods to the Window trait.
As an example, currently, in GlutinWindow's implementation of Window, when a close is requested, should_close is set to true and a Event::Input(Input::Close(CloseArgs {})) is returned from Window::poll_event(). If automatic_close were set to false, then the close event could still be returned, but should_close would not be set to true. This would allow the user to have control over when the window actually closes.
Something to consider would be whether or not these methods should have a default implementation that does nothing, so as not to break current Window implementors that blindly upgrade their piston version.
The text was updated successfully, but these errors were encountered:
One simple thing I would like from Piston is the ability to disable automatic window closing when the window's "X" button in the top corner is pressed. For example, if I am developing some kind of editor-like interface, and the user tries to close the window, I would like to be able to intercept that close request and ask them if they would like to save their data first.
My idea would be to add
automatic_close(self, bool) -> Self
andset_automatic_close(&mut self, bool)
methods to theWindow
trait.As an example, currently, in
GlutinWindow
's implementation ofWindow
, when a close is requested,should_close
is set totrue
and aEvent::Input(Input::Close(CloseArgs {}))
is returned fromWindow::poll_event()
. Ifautomatic_close
were set to false, then the close event could still be returned, butshould_close
would not be set totrue
. This would allow the user to have control over when the window actually closes.Something to consider would be whether or not these methods should have a default implementation that does nothing, so as not to break current
Window
implementors that blindly upgrade theirpiston
version.The text was updated successfully, but these errors were encountered: