cocoa: restore key processing, to let hot keys to triggers... odd

git-svn-id: trunk@59141 -
This commit is contained in:
dmitry 2018-09-23 05:41:04 +00:00
parent fdfa68c0e2
commit 56723694f9
2 changed files with 10 additions and 4 deletions

View File

@ -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);

View File

@ -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);