Fix keyboard input in various cases on macOS

This commit is contained in:
Wojtek Figat
2023-05-17 17:27:41 +02:00
parent 4a165d0661
commit 24396031a7
2 changed files with 14 additions and 1 deletions

View File

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

View File

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