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 begin
cb.KeyEvPrepare(event); cb.KeyEvPrepare(event);
cb.KeyEvBefore(res); 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; cb.KeyEvAfter;
end else end else
inherited keyDown(event); inherited keyDown(event);

View File

@ -52,6 +52,7 @@ type
Owner: NSObject; Owner: NSObject;
HandleFrame: NSView; // HWND and "frame" (rectangle) of the a control HandleFrame: NSView; // HWND and "frame" (rectangle) of the a control
BlockCocoaUpDown: Boolean; BlockCocoaUpDown: Boolean;
BlockCocoaKeyDown: Boolean;
SuppressTabDown: Boolean; // all tabs should be suppressed, so Cocoa would not switch focus SuppressTabDown: Boolean; // all tabs should be suppressed, so Cocoa would not switch focus
class constructor Create; class constructor Create;
@ -962,8 +963,13 @@ begin
AllowCocoaHandle := true; AllowCocoaHandle := true;
if _IsKeyDown then begin if _IsKeyDown then begin
KeyEvBeforeDown(AllowCocoaHandle); KeyEvBeforeDown(AllowCocoaHandle);
if AllowCocoaHandle and SuppressTabDown and (_KeyMsg.CharCode = VK_TAB) then if AllowCocoaHandle then
AllowCocoaHandle := false; begin
if SuppressTabDown and (_KeyMsg.CharCode = VK_TAB) then
AllowCocoaHandle := false
else if BlockCocoaKeyDown then
AllowCocoaHandle := false;
end;
end else end else
KeyEvBeforeUp(AllowCocoaHandle); KeyEvBeforeUp(AllowCocoaHandle);
end; end;
@ -1902,6 +1908,7 @@ begin
ctrl := TCocoaCustomControl(TCocoaCustomControl.alloc.lclInitWithCreateParams(AParams)); ctrl := TCocoaCustomControl(TCocoaCustomControl.alloc.lclInitWithCreateParams(AParams));
lcl := TLCLCommonCallback.Create(ctrl, AWinControl); lcl := TLCLCommonCallback.Create(ctrl, AWinControl);
lcl.BlockCocoaUpDown := true; lcl.BlockCocoaUpDown := true;
lcl.BlockCocoaKeyDown := true; // prevent "dings" on keyDown for custom controls (i.e. SynEdit)
ctrl.callback := lcl; ctrl.callback := lcl;
sl := EmbedInManualScrollView(ctrl); sl := EmbedInManualScrollView(ctrl);