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

Fix ImGui keybindings screen not allowing the user to scroll the list upon opening #72871

Merged

Conversation

katemonster33
Copy link
Contributor

@katemonster33 katemonster33 commented Apr 6, 2024

Summary

Bugfixes "Fixes ImGui keybindings UI not allowing the user to scroll"

Purpose of change

Fixes: #72598
Fixes: #72066

Describe the solution

Implemented actions in the keybindings screen to switch to "filtering" mode and back. This breaks from the original behavior of the screen because ImGui does not behave well with having the user use the arrow keys to scroll one part of the screen while also having a text field accepting text input on another part of the screen. Only one control can truly have "focus" at a time and switching focus between elements in order to have user input apply in both places like the old screen, simply is not possible.

Describe alternatives you've considered

Modifying ImGui itself to allow programmatic focusing of elements be truly "seamless" so when a user presses an arrow key, have the scrollable element focus, or when they press an alphanumeric key, focus the text field. This is currently possible but at the cost of ImGui "eating" the input that the user makes that causes the focus switch. There is simply no way around it.

Testing

Additional context

Turns out that modifying the text passed to the InputText field programmatically is a very annoying operation, and possibly requires a new version of ImGui in order to work properly.

…tween "show" mode where the user can scroll the list, and filtering mode where the user can enter text into the filter text box.
@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Apr 6, 2024
@katemonster33 katemonster33 marked this pull request as ready for review April 7, 2024 18:54
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 7, 2024
Copy link
Member

@akrieger akrieger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete the dead code (especially the newly added dead code).

Also tidy is still sad.

src/cata_imgui.cpp Outdated Show resolved Hide resolved
src/cata_imgui.cpp Outdated Show resolved Hide resolved
src/cata_imgui.cpp Outdated Show resolved Hide resolved
src/cata_imgui.cpp Outdated Show resolved Hide resolved
@akrieger akrieger merged commit a1e69f1 into CleverRaven:master Apr 8, 2024
22 of 26 checks passed
SurFlurer added a commit to SurFlurer/Cataclysm-DDA that referenced this pull request Aug 26, 2024
…_keybindings_focus_fix"

This reverts commit a1e69f1, reversing
changes made to 0095b30.
this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
2 participants