A recent commit broke the pattern editor popups for fin/replace and goto
line. The problem was cause by changes to the function that returns the
name of the currently focused subwindow using a function that only
updates when ImHex main window losses focus. The commit was aimed at
fixing evaluation of shortcuts in pattern data view and pattern editor
simultaneously but missed to fix some shortcuts like cut and paste.
The fix substitutes how the subwindow is first selected by using the
result of the subwindow selection used by imhex to insure that menus and
other ui components don't steal focus from views. The function that
returns the name of the current focused subwindow was changed to use
this value. This fixes both the window popups of pattern editor and all
the shortcut duplications.
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->
### Problem description
When trying to install imhex as a docker container using
`ghcr.io/werwolv/imhex/imhex-web`, the 9090 port doesn't connect to
anything on the host server. Connections to 9090 work inside the
container.
This is because the `localhost` address is `127.0.0.1` which does not
allow for access from outside.
### Implementation description
Change server binding from `localhost` to `0.0.0.0` to allow connections
from all interfaces, no just `lo`.
### Screenshots
<img width="345" height="257" alt="image"
src="https://github.com/user-attachments/assets/2825ac11-657c-4c34-b918-60c4a2750b0f"
/>
Where 9090 is before and 9091 is after the change.
Before
<img width="846" height="339" alt="image"
src="https://github.com/user-attachments/assets/4635467d-5190-49a8-bd97-f678f364250d"
/>
After
<img width="835" height="969" alt="image"
src="https://github.com/user-attachments/assets/af3f0228-ae0b-4704-89c9-50b32c2198eb"
/>
### Additional things
<!-- Anything else you would like to say -->
Currently, interactions with the user interface, like changing providers, opening menus or even resizing windows, take the focus away from the main views. This PR resets focus to the child (if view has no children then the view's window itself is used) of the view that had focus before the interaction took place.
It was tested by interacting with menus, changing providers, using toolbar icons, using command palette, resizing windows or widgets of the view itself that are not children windows of the main view (e.g. running a pattern and having focus return to the pattern editor when evaluation ends. or using the icons in the hex editor) and also by selecting the main view itself. To clarify this last item, if you click on the view tab (not the provider tab but the view tab itself) the focus will be restored to the child that had focused before the tab was clicked
There is no attempt to recover the active status of widgets within the window but it can be easily recovered by clicking the Tab key once. Some views, like the pattern data view, can set other views to focus depending on where they are clicked.
The implementation saves the the child sub-window in a pointer of the view and is only changed if another child is given focus. Then various UI interactions are detected with care not to change focus while the interaction occurs. The end of the interaction is detected by checking if undesired items are the ones that have focus (these undesired values only occur when the UI interaction ends) and if they are, then the focus is restored to the window that is stored in the view pointer.
When a project is loaded it is set to dirty without any changes so that
it goes through the steps that patterns with changes go through. The fix
uses a different starting step that doesn't set the dirty flags when
changing providers or loading projects.
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->
### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
Hopefully this will help us debug the bugs that appear once ImHex
restarts a little easier.
### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->
<img width="372" height="182" alt="image"
src="https://github.com/user-attachments/assets/1f27443e-9eaa-465a-b545-c2bbf0b56ca4"
/>