diff options
author | 2020-11-26 02:52:34 +0100 | |
---|---|---|
committer | 2020-11-26 02:52:34 +0100 | |
commit | 1f7e8b7f3d1804c39c8e0934b25f3ef178de269c (patch) | |
tree | 380d9224b81537e460ea7f9fe84c0c912d3f4cbf /core/src/keyboard | |
parent | bffaeed9fd44619491c012cd9270043828c1849c (diff) | |
parent | 01322f69a406eee76014f5e2834336e2295ad80e (diff) | |
download | iced-1f7e8b7f3d1804c39c8e0934b25f3ef178de269c.tar.gz iced-1f7e8b7f3d1804c39c8e0934b25f3ef178de269c.tar.bz2 iced-1f7e8b7f3d1804c39c8e0934b25f3ef178de269c.zip |
Merge pull request #632 from hecrj/improvement/update-docs
Use intra-doc links
Diffstat (limited to 'core/src/keyboard')
-rw-r--r-- | core/src/keyboard/event.rs | 8 | ||||
-rw-r--r-- | core/src/keyboard/modifiers.rs (renamed from core/src/keyboard/modifiers_state.rs) | 17 |
2 files changed, 10 insertions, 15 deletions
diff --git a/core/src/keyboard/event.rs b/core/src/keyboard/event.rs index d142c3bc..0564c171 100644 --- a/core/src/keyboard/event.rs +++ b/core/src/keyboard/event.rs @@ -1,4 +1,4 @@ -use super::{KeyCode, ModifiersState}; +use super::{KeyCode, Modifiers}; /// A keyboard event. /// @@ -14,7 +14,7 @@ pub enum Event { key_code: KeyCode, /// The state of the modifier keys - modifiers: ModifiersState, + modifiers: Modifiers, }, /// A keyboard key was released. @@ -23,12 +23,12 @@ pub enum Event { key_code: KeyCode, /// The state of the modifier keys - modifiers: ModifiersState, + modifiers: Modifiers, }, /// A unicode character was received. CharacterReceived(char), /// The keyboard modifiers have changed. - ModifiersChanged(ModifiersState), + ModifiersChanged(Modifiers), } diff --git a/core/src/keyboard/modifiers_state.rs b/core/src/keyboard/modifiers.rs index 254013c3..d2a0500e 100644 --- a/core/src/keyboard/modifiers_state.rs +++ b/core/src/keyboard/modifiers.rs @@ -1,6 +1,6 @@ /// The current state of the keyboard modifiers. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub struct ModifiersState { +pub struct Modifiers { /// Whether a shift key is pressed pub shift: bool, @@ -14,17 +14,14 @@ pub struct ModifiersState { pub logo: bool, } -impl ModifiersState { - /// Returns true if the current [`ModifiersState`] has a "command key" - /// pressed. +impl Modifiers { + /// Returns true if a "command key" is pressed in the [`Modifiers`]. /// /// The "command key" is the main modifier key used to issue commands in the /// current platform. Specifically: /// /// - It is the `logo` or command key (⌘) on macOS /// - It is the `control` key on other platforms - /// - /// [`ModifiersState`]: struct.ModifiersState.html pub fn is_command_pressed(self) -> bool { #[cfg(target_os = "macos")] let is_pressed = self.logo; @@ -35,11 +32,9 @@ impl ModifiersState { is_pressed } - /// Returns true if the current [`ModifiersState`] has at least the same - /// modifiers enabled as the given value, and false otherwise. - /// - /// [`ModifiersState`]: struct.ModifiersState.html - pub fn matches(&self, modifiers: ModifiersState) -> bool { + /// Returns true if the current [`Modifiers`] have at least the same + /// keys pressed as the provided ones, and false otherwise. + pub fn matches(&self, modifiers: Self) -> bool { let shift = !modifiers.shift || self.shift; let control = !modifiers.control || self.control; let alt = !modifiers.alt || self.alt; |