-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Enter key ReceivedCharacter(13) not 10 #477
Comments
Is in on Linux X11 or Linux Wayland? |
I went ahead and tested all the desktop backends:
0x0D (13) = I can confirm that directly using |
I am on X11. I wasn't sure if this is a bug or intended, but in either case, calling '\r' as a received char in linux seemed unintuitive. A side question: I want to see the unicode input support in GUI crates. For now their textbox implementation relies on its window library's event system (e.g. simply appending new ascii char from winit). I think it is easier to implement IME support in winit than each GUI crate implements its own. Will winit support IME? If then, I guess IME will take care of CR/LF distinction. |
In what way does winit not already support IME? Have you tried building from master? |
Just tested master and it works. Great! |
Alright, I did some digging, and I think I understand now. For historical reasons, the keyboard is always going to give us The current behavior seems like it will inevitably lead to application bugs, and it should be harmless to just always return This isn't an issue for GLFW, since they don't send |
'\n' or '\r\n' depending on platform sounds natural. The current ReceivedCharacter(char) cannot represent '\r\n'.
|
I'd add that in general regarding input handling, a single keystroke can generate several utf8 characters, So maybe it should be proper to replace See for example the kind of code we have in the wayland backend, this is not ideal I think: |
The situation for the macos backend is same as wayland : And for Windows, it do not support utf8 str currently (but we should use So i think we should replace |
The situation looks more complex than that: http://archives.miloush.net/michkap/archive/2012/05/21/10308135.html |
@francesca64 Yes, we should handle both case. On the other hand, we have to handle from https://msdn.microsoft.com/en-us/library/windows/desktop/ms646276(v=vs.85).aspx :
|
@jwilm since you're someone this directly impacts, what are your thoughts on the |
While discussing the keyboard input API over at #753 I brought up this issue in the following comment: #753 (comment) To summarize the discussion that followed, we decided to send |
|
[repost from glutin-#1008]
In Linux pressing enter produces glutin::WindowEvent::ReceivedCharacter(13).
I think the correct keycode is 13 but correct char should be 10 in Linux.
Is this a bug or should I check for 13 and convert to 10?
The text was updated successfully, but these errors were encountered: