diff --git a/CefSharp.Core/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp index 071a2d31ae..2fa3b7aa1e 100644 --- a/CefSharp.Core/Internals/ClientAdapter.cpp +++ b/CefSharp.Core/Internals/ClientAdapter.cpp @@ -112,23 +112,6 @@ namespace CefSharp _browserControl->OnStatusMessage(valueStr); } - KeyType KeyTypeToManaged(cef_key_event_type_t keytype) - { - switch (keytype) - { - case KEYEVENT_RAWKEYDOWN: - return KeyType::RawKeyDown; - case KEYEVENT_KEYDOWN: - return KeyType::KeyDown; - case KEYEVENT_KEYUP: - return KeyType::KeyUp; - case KEYEVENT_CHAR: - return KeyType::Char; - default: - throw gcnew ArgumentOutOfRangeException("keytype", String::Format("'{0}' is not a valid keytype", gcnew array(keytype))); - } - } - bool ClientAdapter::OnKeyEvent(CefRefPtr browser, const CefKeyEvent& event, CefEventHandle os_event) { IKeyboardHandler^ handler = _browserControl->KeyboardHandler; @@ -140,7 +123,7 @@ namespace CefSharp // TODO: windows_key_code could possibly be the wrong choice here (the OnKeyEvent signature has changed since CEF1). The // other option would be native_key_code. - return handler->OnKeyEvent(_browserControl, KeyTypeToManaged(event.type), event.windows_key_code, event.modifiers, event.is_system_key == 1); + return handler->OnKeyEvent(_browserControl, (KeyType)event.type, event.windows_key_code, (CefEventFlags)event.modifiers, event.is_system_key == 1); } bool ClientAdapter::OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, CefEventHandle os_event, bool* is_keyboard_shortcut) @@ -152,7 +135,7 @@ namespace CefSharp return false; } - return handler->OnPreKeyEvent(_browserControl, (KeyType)event.type, event.windows_key_code, event.native_key_code, event.modifiers, event.is_system_key == 1, *is_keyboard_shortcut); + return handler->OnPreKeyEvent(_browserControl, (KeyType)event.type, event.windows_key_code, event.native_key_code, (CefEventFlags)event.modifiers, event.is_system_key == 1, *is_keyboard_shortcut); } void ClientAdapter::OnLoadStart(CefRefPtr browser, CefRefPtr frame) diff --git a/CefSharp/IKeyboardHandler.cs b/CefSharp/IKeyboardHandler.cs index 27904f0fea..1b7e322141 100644 --- a/CefSharp/IKeyboardHandler.cs +++ b/CefSharp/IKeyboardHandler.cs @@ -6,7 +6,7 @@ namespace CefSharp { public interface IKeyboardHandler { - bool OnKeyEvent(IWebBrowser browser, KeyType type, int code, int modifiers, bool isSystemKey); - bool OnPreKeyEvent(IWebBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, int modifiers, bool isSystemKey, bool isKeyboardShortcut); + bool OnKeyEvent(IWebBrowser browser, KeyType type, int code, CefEventFlags modifiers, bool isSystemKey); + bool OnPreKeyEvent(IWebBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, bool isKeyboardShortcut); } } diff --git a/CefSharp/KeyType.cs b/CefSharp/KeyType.cs index 80e9b2ef28..684cb9c3b9 100644 --- a/CefSharp/KeyType.cs +++ b/CefSharp/KeyType.cs @@ -6,7 +6,7 @@ namespace CefSharp { public enum KeyType { - RawKeyDown, + RawKeyDown = 0, KeyDown, KeyUp, Char,