Cocoa: fix ESC/ENTER with ModifierFlag handle in TCocoaWindowContent.performKeyEquivalent

This commit is contained in:
rich2014 2023-08-02 22:18:47 +08:00
parent dd6cb894c8
commit 5d31c9aebb

View File

@ -380,6 +380,11 @@ var
resp : NSResponder; resp : NSResponder;
wn : NSWindow; wn : NSWindow;
ch : System.WideChar; ch : System.WideChar;
flags: NSEventModifierFlags;
const
NSModsMask = NSControlKeyMask
or NSAlternateKeyMask
or NSCommandKeyMask;
begin begin
Result := false; Result := false;
@ -387,7 +392,8 @@ begin
// prevent further processing. Actually clicking the buttons is handled in // prevent further processing. Actually clicking the buttons is handled in
// the LCL in response to the keyUp // the LCL in response to the keyUp
// add NumericPadEnter supported. // add NumericPadEnter supported.
if Assigned(wincallback) and ((event.modifierFlags=0) or (event.modifierFlags=$200000)) then flags:= event.modifierFlags and NSModsMask;
if Assigned(wincallback) and (flags=0) then
begin begin
ch := NSEventRawKeyChar(event); ch := NSEventRawKeyChar(event);
if (((ch = System.WideChar(NSCarriageReturnCharacter)) and wincallback.HasDefaultControl) if (((ch = System.WideChar(NSCarriageReturnCharacter)) and wincallback.HasDefaultControl)