Skip to content

Commit

Permalink
Start work on keyboard rework for mac
Browse files Browse the repository at this point in the history
As of this checkpoint, we generate an keyboard-types KeyboardEvent,
but don't plumb it through as the actual druid-shell keyboard event.

Also, there is no dead-key handling at this point.

Work towards #1040
  • Loading branch information
raphlinus committed Jun 20, 2020
1 parent 1e667dd commit 29cc45a
Show file tree
Hide file tree
Showing 5 changed files with 407 additions and 4 deletions.
1 change: 1 addition & 0 deletions druid-shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ time = "0.2.16"
cfg-if = "0.1.10"
instant = { version = "0.1.4", features = ["wasm-bindgen"] }
anyhow = "1.0.31"
keyboard-types = { version = "0.5.0", default_features = false }

# Optional dependencies
cairo-rs = { version = "0.8.1", default_features = false, optional = true }
Expand Down
9 changes: 5 additions & 4 deletions druid-shell/examples/shello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ impl WinHandler for HelloState {
}

fn key_down(&mut self, event: KeyEvent) -> bool {
let deadline = std::time::Duration::from_millis(500);
let id = self.handle.request_timer(deadline);
println!("keydown: {:?}, timer id = {:?}", event, id);

println!("keydown: {:?}", event);
false
}

fn key_up(&mut self, event: KeyEvent) {
println!("keyup: {:?}", event);
}

fn wheel(&mut self, event: &MouseEvent) {
println!("mouse_wheel {:?}", event);
}
Expand Down
Loading

0 comments on commit 29cc45a

Please sign in to comment.