summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-07-27 12:54:39 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-07-27 12:54:39 +0700
commitbbdc3dbfef9fa030fcba8d026599e102668d2367 (patch)
treece2acb7cde354b4227e1d4698439ef1d3a328b98 /core
parent1cef6a2a589a0bd156553065257a2708d7bbf38b (diff)
downloadiced-bbdc3dbfef9fa030fcba8d026599e102668d2367.tar.gz
iced-bbdc3dbfef9fa030fcba8d026599e102668d2367.tar.bz2
iced-bbdc3dbfef9fa030fcba8d026599e102668d2367.zip
Introduce `COMMAND` constant to `keyboard::Modifiers`
Diffstat (limited to 'core')
-rw-r--r--core/src/keyboard/modifiers.rs12
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)