allow non ascii character in ReceivedCharacter

This commit is contained in:
Paul Rouget 2016-02-08 14:42:44 +01:00
parent 3246613a51
commit 202f8c5a2d

View file

@ -837,10 +837,8 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
let received_c_str = nsevent.characters().UTF8String(); let received_c_str = nsevent.characters().UTF8String();
let received_str = CStr::from_ptr(received_c_str); let received_str = CStr::from_ptr(received_c_str);
for received_char in from_utf8(received_str.to_bytes()).unwrap().chars() { for received_char in from_utf8(received_str.to_bytes()).unwrap().chars() {
if received_char.is_ascii() {
events.push_back(ReceivedCharacter(received_char)); events.push_back(ReceivedCharacter(received_char));
} }
}
let vkey = event::vkeycode_to_element(NSEvent::keyCode(nsevent)); let vkey = event::vkeycode_to_element(NSEvent::keyCode(nsevent));
events.push_back(KeyboardInput(Pressed, NSEvent::keyCode(nsevent) as u8, vkey)); events.push_back(KeyboardInput(Pressed, NSEvent::keyCode(nsevent) as u8, vkey));