Merge pull request #967 from hecrj/feature/command-keyboard-modifier
Introduce `COMMAND` constant to `keyboard::Modifiers`
This commit is contained in:
commit
2586210259
1 changed files with 12 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue