-
Notifications
You must be signed in to change notification settings - Fork 230
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
GUI-box steals keyboard focus #2568
Comments
I'm not sure there's much I can easily do about this. The GUI windows are built atop a more generic window class that controls keyboard focus and it is used for the other windows in kOS like the terminal and toolbar dialog. Having the gui NOT take focus when the others do would be odd. |
Hi Dunbaratu, There is a clear difference in behaviour between kOS 1.1.5.2 and 1.1.6.0. KOS does have some knowledge about keyboard focus, apparently:
======= Having to reset keyboard focus manually, in the middle of a complex maneuver ... it's really cumbersome. |
That line is not kOS choosing the focus. That's kOS telling Unity "when you think I have focus, use this theme to draw the widget instead of the normal one." It's got nothing to do with telling it WHEN to change focus - just how to draw things when UNITY says the widget got the focus. |
Exactly, that line doesn't give any control over keyboard focus. ======= There are two patches in 1.1.6.0 related to GUI:
The change in behaviour is probably caused by one of them. |
I found which edit introduced this. It was part of PR #2403. This isn't keyboard focus. It's Kerbal's weird home-made input lock mask system. As part of #2403, I fixed a bug where the GUI windows weren't participating in that system properly because their input locks were getting the same identity string as other input locks and they couldn't be distinguished when being removed. (i.e. the GUI window and the text terminal all had the same locking ID of "empty string" so when one got removed, they all got removed.) It would be more accurate to say the "bug" is a design you don't like. The GUI lockout was intentional design, but in 1.1.5.2 there were bugs in how the input locking system was being used that among other things made it fail to adhere to the design. It can't merely be reverted because that same bug caused other problems and had to be fixed. The fact that all the locking IDs were getting mashed together was a big problem. But what might work is to, now that the system works, instead of breaking it again just remove GUI windows from participating in it, leaving it only used by the terminal window and editor window. |
^ Okay in my testing that seems to work. I just added an option for a KOSManagedWindow to choose not to participate in the control lockout scheme, and had the GUI widgets do that, while the other ones still participate in it like normal, and it seems to give the behaviour you want without re-introducing the bugs the earlier fix got rid of. |
That's good news, Dunbaratu. Thank you very much. |
After updating from kOS 1.1.5.2, I ran into an awkward problem.
Spawning, or clicking on a GUI-box sets keyboard focus to that box.
The keyboard can only be used again by left clicking in-world first.
For some reason, a few keys like C, V and Arrows are exceptions.
=======
Test ship:
Test script:
Repro:
Observe 1.1.5.2: All keystrokes are passed on to the world, as expected.
Observe 1.1.6.0 and later: The GUI-box has keyboard focus, all keystrokes are lost.
Observe: Same results.
Expected: A GUI-box only has keyboard focus when it has an active text-entry field.
The text was updated successfully, but these errors were encountered: