cocoa: fix removal of menu shortcut
Closes PR 11463
This commit is contained in:
parent
d37cc7b3ec
commit
2282cae59a
|
@ -80,21 +80,22 @@
|
||||||
|
|
||||||
(define (set-menu-item-shortcut item label)
|
(define (set-menu-item-shortcut item label)
|
||||||
(let ([shortcut (regexp-match #rx"\tCut=(.)(.*)" label)])
|
(let ([shortcut (regexp-match #rx"\tCut=(.)(.*)" label)])
|
||||||
(when shortcut
|
(if shortcut
|
||||||
(let* ([s (string-downcase (string (integer->char (string->number (caddr shortcut)))))]
|
(let* ([s (string-downcase (string (integer->char (string->number (caddr shortcut)))))]
|
||||||
[flags (- (char->integer (string-ref (cadr shortcut) 0))
|
[flags (- (char->integer (string-ref (cadr shortcut) 0))
|
||||||
(char->integer #\A))]
|
(char->integer #\A))]
|
||||||
[mods (+ (if (positive? (bitwise-and flags 1))
|
[mods (+ (if (positive? (bitwise-and flags 1))
|
||||||
NSShiftKeyMask
|
NSShiftKeyMask
|
||||||
0)
|
0)
|
||||||
(if (positive? (bitwise-and flags 2))
|
(if (positive? (bitwise-and flags 2))
|
||||||
NSAlternateKeyMask
|
NSAlternateKeyMask
|
||||||
0)
|
0)
|
||||||
(if (positive? (bitwise-and flags 4))
|
(if (positive? (bitwise-and flags 4))
|
||||||
NSControlKeyMask
|
NSControlKeyMask
|
||||||
0)
|
0)
|
||||||
(if (positive? (bitwise-and flags 8))
|
(if (positive? (bitwise-and flags 8))
|
||||||
0
|
0
|
||||||
NSCommandKeyMask))])
|
NSCommandKeyMask))])
|
||||||
(tellv item setKeyEquivalent: #:type _NSString s)
|
(tellv item setKeyEquivalent: #:type _NSString s)
|
||||||
(tellv item setKeyEquivalentModifierMask: #:type _NSUInteger mods)))))
|
(tellv item setKeyEquivalentModifierMask: #:type _NSUInteger mods))
|
||||||
|
(tellv item setKeyEquivalent: #:type _NSString ""))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user