From 123ec7ffae46212e4ccb71508a7e6c2b4f75a18c Mon Sep 17 00:00:00 2001 From: dmitry Date: Sun, 29 Jul 2018 06:31:20 +0000 Subject: [PATCH] cocoa: adding a direct call of .keyDown when handling sendEvent() of NSWindow (not NSPanel). Cocoa prevents call to .keyDown() with Control+Arrow Keys in IDE configuration git-svn-id: trunk@58648 - --- lcl/interfaces/cocoa/cocoawindows.pas | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoawindows.pas b/lcl/interfaces/cocoa/cocoawindows.pas index db56038680..b3dacecfc6 100644 --- a/lcl/interfaces/cocoa/cocoawindows.pas +++ b/lcl/interfaces/cocoa/cocoawindows.pas @@ -851,6 +851,20 @@ begin else inherited sendEvent(event); end + else if event.type_ = NSKeyDown then + begin + if Assigned(firstResponder) and (firstResponder.isKindOfClass_(TCocoaCustomControl)) then + begin + //todo: (hack!) for whatever Cocoa prevents the processing of Control+Left, Control+Right (Control+Arrow Keys) + // events in IDE configuration. The standalone test is working just fine. + // presumably NSWindow.sendEvent() should call keyDown() directly + // (the only keys supressesed by Cocoa are Tab or Shift+Tab) + // So, instead of figuring out why Cocoa suppresses the navigation + // the overrride method simply forces keyDown() call + firstResponder.keyDown(event); + end else + inherited sendEvent(event); + end else inherited sendEvent(event); end;