diff options
author | 2021-07-27 13:14:41 +0700 | |
---|---|---|
committer | 2021-07-27 13:14:41 +0700 | |
commit | 258621025958ef60d71ad4c4da4fbd8882675ddb (patch) | |
tree | 3f2b31882af0cec99c05b272a5b368f3f2553032 | |
parent | f94b50021dc6c4eebb2b44ac8c9ebd10a85f2e06 (diff) | |
parent | bbdc3dbfef9fa030fcba8d026599e102668d2367 (diff) | |
download | iced-258621025958ef60d71ad4c4da4fbd8882675ddb.tar.gz iced-258621025958ef60d71ad4c4da4fbd8882675ddb.tar.bz2 iced-258621025958ef60d71ad4c4da4fbd8882675ddb.zip |
Merge pull request #967 from hecrj/feature/command-keyboard-modifier
Introduce `COMMAND` constant to `keyboard::Modifiers`
-rw-r--r-- | core/src/keyboard/modifiers.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/keyboard/modifiers.rs b/core/src/keyboard/modifiers.rs index 383b9370..e61f145a 100644 --- a/core/src/keyboard/modifiers.rs +++ b/core/src/keyboard/modifiers.rs @@ -28,6 +28,18 @@ bitflags! { } impl Modifiers { + /// The "command" key. + /// + /// This is normally the main modifier to be used for hotkeys. + /// + /// On macOS, this is equivalent to `Self::LOGO`. + /// Ohterwise, this is equivalent to `Self::CTRL`. + pub const COMMAND: Self = if cfg!(target_os = "macos") { + Self::LOGO + } else { + Self::CTRL + }; + /// Returns true if the [`SHIFT`] key is pressed in the [`Modifiers`]. pub fn shift(self) -> bool { self.contains(Self::SHIFT) |