Richer input events

This expands input events to represent sub-pixel mouse positions, devices responsible for generating events, and raw
device-oriented events. The X11 back end is refactored to make full use of the new expressiveness. Other backends have
had new functionality minimally stubbed out, save for the macos backend which already supports sub-pixel mouse
positions.
This commit is contained in:
Benjamin Saunders 2017-04-22 13:52:35 -07:00
parent 544ee13bf3
commit 22bc119cd7
19 changed files with 994 additions and 786 deletions

View file

@ -1,6 +1,6 @@
extern crate winit;
use winit::{Event, ElementState, MouseCursor, WindowEvent};
use winit::{Event, ElementState, MouseCursor, WindowEvent, KeyboardInput};
fn main() {
let events_loop = winit::EventsLoop::new();
@ -13,7 +13,7 @@ fn main() {
events_loop.run_forever(|event| {
match event {
Event::WindowEvent { event: WindowEvent::KeyboardInput(ElementState::Pressed, _, _, _), .. } => {
Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { state: ElementState::Pressed, .. }, .. }, .. } => {
println!("Setting cursor to \"{:?}\"", cursors[cursor_idx]);
window.set_cursor(cursors[cursor_idx]);
if cursor_idx < cursors.len() - 1 {