add physical_key to key subscriptions
This commit is contained in:
parent
3fc85b900d
commit
86083d8ec8
8 changed files with 29 additions and 17 deletions
|
|
@ -58,7 +58,7 @@ impl Layout {
|
|||
fn subscription(&self) -> Subscription<Message> {
|
||||
use keyboard::key;
|
||||
|
||||
keyboard::on_key_release(|key, _modifiers| match key {
|
||||
keyboard::on_key_release(|key, _physical_key, _modifiers| match key {
|
||||
keyboard::Key::Named(key::Named::ArrowLeft) => {
|
||||
Some(Message::Previous)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,12 +117,12 @@ impl Example {
|
|||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Message> {
|
||||
keyboard::on_key_press(|key_code, modifiers| {
|
||||
keyboard::on_key_press(|key, _physical_key, modifiers| {
|
||||
if !modifiers.command() {
|
||||
return None;
|
||||
}
|
||||
|
||||
handle_hotkey(key_code)
|
||||
handle_hotkey(key)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ impl Example {
|
|||
fn subscription(&self) -> Subscription<Message> {
|
||||
use keyboard::key;
|
||||
|
||||
keyboard::on_key_press(|key, _modifiers| {
|
||||
keyboard::on_key_press(|key, _physical_key, _modifiers| {
|
||||
if let keyboard::Key::Named(key::Named::F5) = key {
|
||||
Some(Message::Screenshot)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ impl Stopwatch {
|
|||
|
||||
fn handle_hotkey(
|
||||
key: keyboard::Key,
|
||||
_physical_key: keyboard::key::Physical,
|
||||
_modifiers: keyboard::Modifiers,
|
||||
) -> Option<Message> {
|
||||
use keyboard::key;
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ impl Styling {
|
|||
}
|
||||
|
||||
fn subscription(&self) -> Subscription<Message> {
|
||||
keyboard::on_key_press(|key, _modifiers| match key {
|
||||
keyboard::on_key_press(|key, _physical_key, _modifiers| match key {
|
||||
keyboard::Key::Named(
|
||||
keyboard::key::Named::ArrowUp | keyboard::key::Named::ArrowLeft,
|
||||
) => Some(Message::PreviousTheme),
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ impl Todos {
|
|||
fn subscription(&self) -> Subscription<Message> {
|
||||
use keyboard::key;
|
||||
|
||||
keyboard::on_key_press(|key, modifiers| {
|
||||
keyboard::on_key_press(|key, _physical_key, modifiers| {
|
||||
let keyboard::Key::Named(key) = key else {
|
||||
return None;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue