-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Rework guiKeyChangeMenu #15152
base: master
Are you sure you want to change the base?
Rework guiKeyChangeMenu #15152
Conversation
Hey, ,do you know if this will interfere with my PR #14785 ? It's a month old PR but I was also planning on rewroking the gui key change menu. I wanted to bundle it into the settings menu itself, it that makes sense, so we'd need to expose some Lua client-side mod functions to do such a thing. |
From a quick skim: not much (yet). Or it would not be much work to rebase (since the focus of this PR is solely to update
First off: 👍 From a technical perspective, moving the keybinding menu to Lua would (from my limited understanding) be slightly more complicated than moving other menus, as you would also need a custom input event handler specifically (and only) for this formspec. My current approach is to make a subclass of Moving this to Lua would likely involve moving key handling to Lua as well, but this would also mean that we would need to (at least partly) expose an internal API that allows replacing the event handler with a Lua function that is called before the formspec handler. Even if we limit this specifically to keypresses, I suppose the changes would probably be enough to become its own PR. From a timing perspective, the goal here is mainly to have something in the (very) short term that allows other/future PRs to update the keybinding menu relatively easily. This becomes relevant as this is mainly a helper PR for me: my personal goal at the moment is to finish #14964, which (as I wrote in the comment linked in the top post) also involves (*) allowing players to use multiple keybindings, the latter of which would benefit from a PR like this one. (*) This is not exactly a dependency. Using SDL scancodes and allowing players to use multiple keybindings are two different things (and also belong to different PRs), but it is best to have both PRs merged around the same time given the implications of using SDL scancodes. |
So for moving the key change menu to Lua, I was thinking that there could be a That being said, moving it to Lua would also require setting up a secure Lua environment on the client for the pause menu controls or enabling CSM for all users. Which is certainly more work. So I'm fine with the approach of this PR |
That's kind of what I was hinting. As ruben suggested, a binding would work, but regardless, we could still show the keybinds set with Lua, and show a seperate C++ popup to change the keybind. That is also a client-side mod which is more work. Your approach is fine, but do consider it for later. (Hell, that would be useful even for non-CSM cases; a mod might try to show the users keyboard key for Aux1 as |
eb96efe
to
d1c91c4
Compare
4332673
to
734ebbb
Compare
734ebbb
to
3d25082
Compare
This PR reworks
GUIKeyChangeMenu
to useGUIFormSpecMenu
. This partly changes the behavior of the menu:Rework
GUIKeyChangeMenu
to use (more or less)The
GUIKeyChangeMenu
is largely rewritten.Fixes Allow using the delete key as a keybinding #9602 (as the relevant logic has been reworked).
2.2 Internal code refactoring.
This makes it easier to change this form in the future. In particular, this is required by Implement secondary keybindings #15577.
To do
This PR is a Work in Progress.
GUIKeyChangeMenu
to useGUIFormSpecMenu
How to test
clear.png
texture) button to clear the keybinding and that the button is present only for entries with a keybinding. Observe that it actually removes the keybinding.Screenshot