bool UKismetInputLibrary::Key_IsModifierKey(const FKey& Key) { return Key.IsModifierKey(); }
void FCEFWebBrowserWindow::PopulateCefKeyEvent(const FKeyEvent& InKeyEvent, CefKeyEvent& OutKeyEvent) { #if PLATFORM_MAC OutKeyEvent.native_key_code = InKeyEvent.GetKeyCode(); FKey Key = InKeyEvent.GetKey(); if (Key == EKeys::BackSpace) { OutKeyEvent.unmodified_character = kBackspaceCharCode; } else if (Key == EKeys::Tab) { OutKeyEvent.unmodified_character = kTabCharCode; } else if (Key == EKeys::Enter) { OutKeyEvent.unmodified_character = kReturnCharCode; } else if (Key == EKeys::Pause) { OutKeyEvent.unmodified_character = NSPauseFunctionKey; } else if (Key == EKeys::Escape) { OutKeyEvent.unmodified_character = kEscapeCharCode; } else if (Key == EKeys::PageUp) { OutKeyEvent.unmodified_character = NSPageUpFunctionKey; } else if (Key == EKeys::PageDown) { OutKeyEvent.unmodified_character = NSPageDownFunctionKey; } else if (Key == EKeys::End) { OutKeyEvent.unmodified_character = NSEndFunctionKey; } else if (Key == EKeys::Home) { OutKeyEvent.unmodified_character = NSHomeFunctionKey; } else if (Key == EKeys::Left) { OutKeyEvent.unmodified_character = NSLeftArrowFunctionKey; } else if (Key == EKeys::Up) { OutKeyEvent.unmodified_character = NSUpArrowFunctionKey; } else if (Key == EKeys::Right) { OutKeyEvent.unmodified_character = NSRightArrowFunctionKey; } else if (Key == EKeys::Down) { OutKeyEvent.unmodified_character = NSDownArrowFunctionKey; } else if (Key == EKeys::Insert) { OutKeyEvent.unmodified_character = NSInsertFunctionKey; } else if (Key == EKeys::Delete) { OutKeyEvent.unmodified_character = kDeleteCharCode; } else if (Key == EKeys::F1) { OutKeyEvent.unmodified_character = NSF1FunctionKey; } else if (Key == EKeys::F2) { OutKeyEvent.unmodified_character = NSF2FunctionKey; } else if (Key == EKeys::F3) { OutKeyEvent.unmodified_character = NSF3FunctionKey; } else if (Key == EKeys::F4) { OutKeyEvent.unmodified_character = NSF4FunctionKey; } else if (Key == EKeys::F5) { OutKeyEvent.unmodified_character = NSF5FunctionKey; } else if (Key == EKeys::F6) { OutKeyEvent.unmodified_character = NSF6FunctionKey; } else if (Key == EKeys::F7) { OutKeyEvent.unmodified_character = NSF7FunctionKey; } else if (Key == EKeys::F8) { OutKeyEvent.unmodified_character = NSF8FunctionKey; } else if (Key == EKeys::F9) { OutKeyEvent.unmodified_character = NSF9FunctionKey; } else if (Key == EKeys::F10) { OutKeyEvent.unmodified_character = NSF10FunctionKey; } else if (Key == EKeys::F11) { OutKeyEvent.unmodified_character = NSF11FunctionKey; } else if (Key == EKeys::F12) { OutKeyEvent.unmodified_character = NSF12FunctionKey; } else if (Key == EKeys::CapsLock) { OutKeyEvent.unmodified_character = 0; OutKeyEvent.native_key_code = kVK_CapsLock; } else if (Key.IsModifierKey()) { // Setting both unmodified_character and character to 0 tells CEF that it needs to generate a NSFlagsChanged event instead of NSKeyDown/Up OutKeyEvent.unmodified_character = 0; // CEF expects modifier key codes as one of the Carbon kVK_* key codes. if (Key == EKeys::LeftCommand) { OutKeyEvent.native_key_code = kVK_Command; } else if (Key == EKeys::LeftShift) { OutKeyEvent.native_key_code = kVK_Shift; } else if (Key == EKeys::LeftAlt) { OutKeyEvent.native_key_code = kVK_Option; } else if (Key == EKeys::LeftControl) { OutKeyEvent.native_key_code = kVK_Control; } else if (Key == EKeys::RightCommand) { // There isn't a separate code for the right hand command key defined, but CEF seems to use the unused value before the left command keycode OutKeyEvent.native_key_code = kVK_Command-1; } else if (Key == EKeys::RightShift) { OutKeyEvent.native_key_code = kVK_RightShift; } else if (Key == EKeys::RightAlt) { OutKeyEvent.native_key_code = kVK_RightOption; } else if (Key == EKeys::RightControl) { OutKeyEvent.native_key_code = kVK_RightControl; } } else { OutKeyEvent.unmodified_character = InKeyEvent.GetCharacter(); } OutKeyEvent.character = OutKeyEvent.unmodified_character; #else OutKeyEvent.windows_key_code = InKeyEvent.GetKeyCode(); #endif OutKeyEvent.modifiers = GetCefKeyboardModifiers(InKeyEvent); }