diff --git a/lcl/interfaces/cocoa/cocoaprivate.pas b/lcl/interfaces/cocoa/cocoaprivate.pas index b016296d80..38379a9d15 100644 --- a/lcl/interfaces/cocoa/cocoaprivate.pas +++ b/lcl/interfaces/cocoa/cocoaprivate.pas @@ -614,8 +614,7 @@ begin begin cb.KeyEvPrepare(event); cb.KeyEvBefore(res); - //there's no keyDown below! expect for *ding* - //if res then inherited keyDown(event); + if res then inherited keyDown(event); cb.KeyEvAfter; end else inherited keyDown(event); diff --git a/lcl/interfaces/cocoa/cocoawscommon.pas b/lcl/interfaces/cocoa/cocoawscommon.pas index 7ca573b924..84d8d18c26 100644 --- a/lcl/interfaces/cocoa/cocoawscommon.pas +++ b/lcl/interfaces/cocoa/cocoawscommon.pas @@ -52,6 +52,7 @@ type Owner: NSObject; HandleFrame: NSView; // HWND and "frame" (rectangle) of the a control BlockCocoaUpDown: Boolean; + BlockCocoaKeyDown: Boolean; SuppressTabDown: Boolean; // all tabs should be suppressed, so Cocoa would not switch focus class constructor Create; @@ -962,8 +963,13 @@ begin AllowCocoaHandle := true; if _IsKeyDown then begin KeyEvBeforeDown(AllowCocoaHandle); - if AllowCocoaHandle and SuppressTabDown and (_KeyMsg.CharCode = VK_TAB) then - AllowCocoaHandle := false; + if AllowCocoaHandle then + begin + if SuppressTabDown and (_KeyMsg.CharCode = VK_TAB) then + AllowCocoaHandle := false + else if BlockCocoaKeyDown then + AllowCocoaHandle := false; + end; end else KeyEvBeforeUp(AllowCocoaHandle); end; @@ -1902,6 +1908,7 @@ begin ctrl := TCocoaCustomControl(TCocoaCustomControl.alloc.lclInitWithCreateParams(AParams)); lcl := TLCLCommonCallback.Create(ctrl, AWinControl); lcl.BlockCocoaUpDown := true; + lcl.BlockCocoaKeyDown := true; // prevent "dings" on keyDown for custom controls (i.e. SynEdit) ctrl.callback := lcl; sl := EmbedInManualScrollView(ctrl);