按“Command +”会导致两个 -performKeyEquivalent 调用。这是第一次调用的堆栈跟踪片段:
1 AppKit 0x00007fff903da2f9 -[NSView _performKeyEquivalent:conditionally:] + 41
2 AppKit 0x00007fff903da442 -[NSView performKeyEquivalent:] + 166
3 AppKit 0x00007fff903da2f9 -[NSView _performKeyEquivalent:conditionally:] + 41
4 AppKit 0x00007fff903da259 -[NSWindow performKeyEquivalent:] + 64
5 AppKit 0x00007fff903da044 -[NSApplication _handleKeyEquivalent:] + 462
6 AppKit 0x00007fff90297173 -[NSApplication sendEvent:] + 4480
对于第二个电话:
1 AppKit 0x00007fff903da2f9 -[NSView _performKeyEquivalent:conditionally:] + 41
2 AppKit 0x00007fff903da442 -[NSView performKeyEquivalent:] + 166
3 AppKit 0x00007fff903da2f9 -[NSView _performKeyEquivalent:conditionally:] + 41
4 AppKit 0x00007fff903da259 -[NSWindow performKeyEquivalent:] + 64
5 AppKit 0x00007fff903da044 -[NSApplication _handleKeyEquivalent:] + 462
6 AppKit 0x00007fff900e3927 -[NSApplication _handleSpecialAlternateKeyEquivalent:] + 656
7 AppKit 0x00007fff9029718e -[NSApplication sendEvent:] + 4507
如您所见,第二个 -performKeyEquivalent 调用由 -[NSApplication _handleSpecialAlternateKeyEquivalent:] 发起。那么,谁能告诉我“Command +”击键有什么特别之处,它保证不是一个,而是两个 -performKeyEquivalent 调用,以及如何过滤掉第二个调用?