GUI: restore the Pause Menu after closing the Settings Menu#15891
GUI: restore the Pause Menu after closing the Settings Menu#15891sfan5 merged 3 commits intoluanti-org:masterfrom
Conversation
|
When I saw this PR, I was initially going to comment something along the lines of
However, I now found out that, as implied in the PR description...
... closing C++ sub-menus actually gets you back to the "main" pause menu on 5.12.0-dev. This is actually a recent regression caused by 2c50066:
This can easily be fixed by only applying that workaround to the settings button, where it is actually necessary, and reverting it for the other buttons. |
It seems this is a subjective matter because I would prefer to always return to the pause menu before explicitly closing it. This is also done similarly in other games - difference being that these layers of menus (/formspecs) are yet not visually represented in Luanti. |
|
Yeah, this seems like a matter of preference. I suppose either behavior is objectively fine as long as it's consistent between all the sub-menus (C++ and Lua). If you want to continue with this, you should also update the buttons that are currently labeled "Exit" to say "Back" instead: luanti/builtin/common/settings/dlg_settings.lua Lines 530 to 532 in db15bc6 luanti/src/gui/guiVolumeChange.cpp Lines 79 to 80 in db15bc6 |
d117cca to
263024e
Compare
There was a problem hiding this comment.
This appears to work. Fine by me.
The code (and changes to it) around managing GUIFormspecMenu instances & references to them is messy though. To truly understand it, I'd have to spend more time looking at it than I'm currently willing to invest. You seem to have built some understanding of how it works, I would be happy if you were able to refactor it at some point.
Because it is more intuitive this way.
When closing the in-game Settings menu, the Pause menu will be shown again.
The
GUIModalMenucode is responsible for handling overlaid formspec "layers". C++ GUI implementations (e.g.GUIPasswordChange) do support this well. The Lua side of the Main Menu has its own layer code, which works the same way. However, when entering the Settings menu (Lua formspec) though the Pause menu (C++), there is no way back.This PR fixes that by allowing to overlay any kind of
showPauseMenuFormSpecformspecs (until they get closed explicitly).To do
This PR is Ready for Review.
How to test
GUIKeyChangeMenudoes not depend onm_formspec)Also open and close some random formspecs to ensure it's not causing side-effects.