From 24396031a720054dcb92aff06849683ab5ff56b2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 17 May 2023 17:27:41 +0200 Subject: [PATCH] Fix keyboard input in various cases on macOS --- Source/Engine/Platform/Mac/MacWindow.cpp | 13 +++++++++++++ Source/Engine/UI/GUI/Tooltip.cs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Platform/Mac/MacWindow.cpp b/Source/Engine/Platform/Mac/MacWindow.cpp index fe99b4fdd..90bb07279 100644 --- a/Source/Engine/Platform/Mac/MacWindow.cpp +++ b/Source/Engine/Platform/Mac/MacWindow.cpp @@ -255,6 +255,15 @@ NSDragOperation GetDragDropOperation(DragDropEffect dragDropEffect) @implementation MacWindowImpl +- (BOOL)canBecomeKeyWindow +{ + if (Window && !Window->GetSettings().AllowInput) + { + return NO; + } + return YES; +} + - (void)windowDidBecomeKey:(NSNotification*)notification { // Handle resizing to be sure that content has valid size when window was resized @@ -377,6 +386,10 @@ static void ConvertNSRect(NSScreen *screen, NSRect *r) // Ignore text from special keys case KeyboardKeys::Delete: case KeyboardKeys::Backspace: + case KeyboardKeys::ArrowLeft: + case KeyboardKeys::ArrowRight: + case KeyboardKeys::ArrowUp: + case KeyboardKeys::ArrowDown: return; } NSString* text = [event characters]; diff --git a/Source/Engine/UI/GUI/Tooltip.cs b/Source/Engine/UI/GUI/Tooltip.cs index 5089e0211..0a54610fd 100644 --- a/Source/Engine/UI/GUI/Tooltip.cs +++ b/Source/Engine/UI/GUI/Tooltip.cs @@ -99,7 +99,7 @@ namespace FlaxEngine.GUI desc.SupportsTransparency = false; desc.ShowInTaskbar = false; desc.ActivateWhenFirstShown = false; - desc.AllowInput = true; + desc.AllowInput = false; desc.AllowMinimize = false; desc.AllowMaximize = false; desc.AllowDragAndDrop = false;