-
Notifications
You must be signed in to change notification settings - Fork 307
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
[Bug] The caps lock indicator only gets updated when you type #670
Comments
This error was already reported over at #607 but for numlock. Granted, the title doesn't indicate much :D |
So should this issue stay? |
You decide. It's technically different, since it's about capslock and not numlock. 👀 |
Yeah, this looks way better than #607! Like, where does he even mention numlock?
Either ways, you should fix it too. |
They mention it right there: #607 (comment) |
Sorry, maybe I should open a new issue at that time. |
No worries, you can just tell your issue here. You can close your other issue if you want, though. |
To be honest, it seems that you have already completed the repair, but I have no plans to restart recently so I can't test it. I usually restart after updating the kernel or important components. Just close it when you think it's done and we'll raise it again if there are still questions. |
I only fixed it for the clocks, but not for the lock states. That's a bit more complicated, because what I think happens is that termbox is polling for TTY events (through |
I think I can't reproduce it anymore, but if you say that it's still broken then whatever. |
That's because in 598fa6a, we temporarily reverted to the same behavior as the old version: updating the lock indicator periodically. |
But I didn't update. |
So mysterious. |
That commit shouldn't have had to exist, it always worked this way. I commented that code originally because I was doing tests in my terminal without appropriate permissions to access |
Well, I only confirmed that the original rewritten version had this code snippet. I didn't carefully check which commit it was commented. I only noticed that it was uncommented in that commit. |
I forgot about that issue. It's about capslock not being shown at all. I'll have to check if it was a feature back then, and if it wasn't, close the issue since it's been implemented since. |
It should be before #78. |
This feature has existed at least since ce745bf. |
I took another look at main.zig, so it was because the drawing of all components was tied together when rewriting. In older versions, the action of the drawing lock indicator was performed at the top level of the loop's main function. |
So maybe you have animations or a clock turned on? |
That makes sense. It was basically updated independently, but still in the main render loop. |
Actually, I took a better look at the code from the commit you sent but I don't really see how it's much different from what we have right now. In Ly v0.1.0, the screen only got updated if it got forced to or if there was an event. But, we can't just make it force update every time, and as I already stated before, the TTY doesn't send any event for numlock or capslock activation. |
Aaah, yeah, it started working because just as I was creating this issue, I have changed the config to use the doom animation. Mystery solved! |
Yes, I didn't look carefully yesterday. |
Hope these can help you:
|
The problem is that we'd still be limited to termbox2's event peeking functions. Since the way they work doesn't allow for retrieving the numlock & capslock key states, the only way to fix this issue would be to stop using those entirely and use the event interface mentioned above. However, I'm afraid this may hinder portability & porting efforts, like with the mentioned OpenBSD example. Also, while we only do handle key events, there are other types of events, possibly like resolution changes (though I'm not quite sure if those are part of TTY events). |
I guess it depends on what these indicators are trying to achieve. If it is just to make the user notice after typing that what they have just entered is a capital letter or number, then it has actually succeeded. But that's obviously not what it should be. Maybe people do want to know immediately that Caps Lock or Num Lock is enabled. Well, as you say, making these low-level changes may hinder portability & porting efforts. However, do people really need to receive immediate feedback from these indicators? I think you could consider using tb_peek_event() directly with 100ms, humans are not that sensitive.
|
The problem with this is it would continuiously update the UI even when not needed, which degrades performance. There's no perfect solution except, I believe, running the code in a separate thread, but I haven't tried that yet. |
I believe I saw |
Personally, I don't think that alone is a valid justification for decreasing performance, even if the display manager isn't the most important piece to optimize. |
Pre-requisites
Ly version
1.0.1
Observed behavior
The caps lock indicator only gets updated when you type.
Expected behavior
The caps lock indicator updates the same moment that you press the caps lock key.
Steps to reproduce
Relevant logs
No response
The text was updated successfully, but these errors were encountered: