key repeat -- how to turn this off? #3373
-
I am speaking of the ElementState module. For example, There are many issues opened up requesting this feature dating from years back. I don't think it's worth it for anybody (including myself) to spend, for example, 30 minutes browsing through all of what there is to find on this topic just to get a simple "no" or "yes, here is how it is done." So, let's keep this discussion simple. How do you turn off key repeat? Let's keep our answers short. This will help us all find out what we need without digging through long threads. I'll mention this to try and be helpful to other people -- if it is impossible, then it is not too hard just to make a variable such as "was_up_key_press_counter" and reset it to 0 when the key is released. This is only one of many possible workarounds. EDIT: Going to give some honest feedback, if there truely is no way to detect or turn off key repeat, then I think winit should probably get there stuff together because this is such an obvious and needed feature 😉 It makes me think that the people who made this library have not actually used it to make real programs, or the programs they make are very narrow in type (I am making a game with a custom engine, so that is my perspective), and they don't actually have any idea what their product needs to do to be functional. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 16 replies
-
https://docs.rs/winit/latest/winit/event/struct.KeyEvent.html#structfield.repeat
I'd suggest you to learn how to communicate, We don't owe you anything, we're working on it in our free time for nothing. It's not the first time you communicate and try to straight offense people. |
Beta Was this translation helpful? Give feedback.
-
There's a legit question here. I found this because I have a problem where holding an arrow key down for a long time in a game-type program sometimes causes the action to continue for seconds after key release. I'm ignoring events where input.repeat is set. But I'm not sure that's the correct action. Could that cause me to miss a key-up event? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I meant that I render at RedrawRequested, but I call RequestRedraw only at AboutToWait. Winit docs say to call RequestRedraw at the end of the redraw in RedrawRequested, but that behaves terribly. Worst case is Windows executables under Wine, where every key is delayed about 3 seconds. X11 on Linux is a big sluggish. Winit doesn't really manage this; it passes the buck to the underlying platform. Wine has its own event loop, and it's not a good one. |
Beta Was this translation helpful? Give feedback.
https://docs.rs/winit/latest/winit/event/struct.KeyEvent.html#structfield.repeat
I'd suggest you to learn how to communicate, We don't owe you anything, we're working on it in our free time for nothing. It's not the first time you communicate and try to straight offense people.