@@ -290,11 +290,11 @@ impl InputState {
290
290
///
291
291
/// Includes key-repeat events.
292
292
///
293
- /// This uses [`Modifiers::matches_logically`] to match modifiers.
294
- /// This means that e.g. the shortcut `Ctrl` + `Key::Plus` will be matched
295
- /// as long as `Ctrl` and `Plus` are pressed, ignoring if
296
- /// `Shift` or `Alt` are also pressed (because those modifiers might
297
- /// be required to produce the logical `Key::Plus`).
293
+ /// This uses [`Modifiers::matches_logically`] to match modifiers,
294
+ /// meaning extra Shift and Alt modifiers are ignored.
295
+ /// Therefore, you should match most specific shortcuts first,
296
+ /// i.e. check for `Cmd-Shift-S` ("Save as…") before `Cmd-S` ("Save"),
297
+ /// so that a user pressing `Cmd-Shift-S` won't trigger the wrong command!
298
298
pub fn count_and_consume_key ( & mut self , modifiers : Modifiers , logical_key : Key ) -> usize {
299
299
let mut count = 0usize ;
300
300
@@ -320,6 +320,12 @@ impl InputState {
320
320
/// Check for a key press. If found, `true` is returned and the key pressed is consumed, so that this will only return `true` once.
321
321
///
322
322
/// Includes key-repeat events.
323
+ ///
324
+ /// This uses [`Modifiers::matches_logically`] to match modifiers,
325
+ /// meaning extra Shift and Alt modifiers are ignored.
326
+ /// Therefore, you should match most specific shortcuts first,
327
+ /// i.e. check for `Cmd-Shift-S` ("Save as…") before `Cmd-S` ("Save"),
328
+ /// so that a user pressing `Cmd-Shift-S` won't trigger the wrong command!
323
329
pub fn consume_key ( & mut self , modifiers : Modifiers , logical_key : Key ) -> bool {
324
330
self . count_and_consume_key ( modifiers, logical_key) > 0
325
331
}
@@ -328,7 +334,11 @@ impl InputState {
328
334
///
329
335
/// If so, `true` is returned and the key pressed is consumed, so that this will only return `true` once.
330
336
///
331
- /// Includes key-repeat events.
337
+ /// This uses [`Modifiers::matches_logically`] to match modifiers,
338
+ /// meaning extra Shift and Alt modifiers are ignored.
339
+ /// Therefore, you should match most specific shortcuts first,
340
+ /// i.e. check for `Cmd-Shift-S` ("Save as…") before `Cmd-S` ("Save"),
341
+ /// so that a user pressing `Cmd-Shift-S` won't trigger the wrong command!
332
342
pub fn consume_shortcut ( & mut self , shortcut : & KeyboardShortcut ) -> bool {
333
343
let KeyboardShortcut {
334
344
modifiers,
0 commit comments