New key event re-entrance deadlock fix#1
Conversation
|
Yes, now that you mention it, that was also something I was afraid of when I made the fix originally, but I decided to go on an try it anyway to see if it had any problems. And after using it for a few months, without any issues I forgot about that. And this is with a QMK based keyboard, where I do a lot of tricks. For example I have a key where I press That said, there might be some very special case where things goes wrong, so your fix is probably better. |
|
As far as I understand, having messages coming from the keyboard in quick succession cannot trigger re-entrance by itself, because those messages become "queued" messages (not dispatched by PeekMessage). The problem arises when another thread sends a "nonqueued" message to the winit window. Because PeekMessage dispatches "nonqueued" messages. |
|
Yes, my point was more that it requires some very special circumstances to trigger any practical problems with the reversed event order. And that I would probably be more likely to notice them in my setup, than in other setups where the keyboard input is much slower, and PeekMessage wouldn't have a next key to read anyway. Anyway, that was just an observation, fixing it correctly is obviously always better. |
An alternative fix for the deadlock in the new keyboard events. See original: rust-windowing#2146
The most important difference between this and the original fix is that this tries to ensure that keyboard events are sent to the user in the order they arrived from the OS, and NOT in the order they are completed processing. (The completion order is reversed during re-entrace)
Here's a concrete example:
Ais dispatched to winitABis dispatched to winitBBACHANGELOG.mdif knowledge of this change could be valuable to users