Handle some TextInput events
This commit is contained in:
parent
63cd0fd8eb
commit
fedcab6f4f
7 changed files with 93 additions and 29 deletions
|
|
@ -1,6 +1,8 @@
|
|||
use crate::{
|
||||
column, conversion, input::mouse, renderer::Windowed, Cache, Column,
|
||||
Element, Event, Length, MouseCursor, UserInterface,
|
||||
column, conversion,
|
||||
input::{keyboard, mouse},
|
||||
renderer::Windowed,
|
||||
Cache, Column, Element, Event, Length, MouseCursor, UserInterface,
|
||||
};
|
||||
|
||||
pub trait Application {
|
||||
|
|
@ -167,6 +169,25 @@ pub trait Application {
|
|||
));
|
||||
}
|
||||
},
|
||||
WindowEvent::ReceivedCharacter(c) => {
|
||||
events.push(Event::Keyboard(
|
||||
keyboard::Event::CharacterReceived(c),
|
||||
));
|
||||
}
|
||||
WindowEvent::KeyboardInput {
|
||||
input:
|
||||
winit::event::KeyboardInput {
|
||||
virtual_keycode: Some(virtual_keycode),
|
||||
state,
|
||||
..
|
||||
},
|
||||
..
|
||||
} => {
|
||||
events.push(Event::Keyboard(keyboard::Event::Input {
|
||||
key_code: conversion::key_code(virtual_keycode),
|
||||
state: conversion::button_state(state),
|
||||
}));
|
||||
}
|
||||
WindowEvent::CloseRequested => {
|
||||
*control_flow = ControlFlow::Exit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue