Introduce COMMAND constant to keyboard::Modifiers
This commit is contained in:
parent
1cef6a2a58
commit
bbdc3dbfef
1 changed files with 12 additions and 0 deletions
|
|
@ -28,6 +28,18 @@ bitflags! {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Modifiers {
|
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`].
|
/// Returns true if the [`SHIFT`] key is pressed in the [`Modifiers`].
|
||||||
pub fn shift(self) -> bool {
|
pub fn shift(self) -> bool {
|
||||||
self.contains(Self::SHIFT)
|
self.contains(Self::SHIFT)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue