|
|
@@ -31,7 +31,12 @@ namespace Atomic
|
|
|
void* GetNSWindowContentView(void* window);
|
|
|
#endif
|
|
|
|
|
|
-class WebClientPrivate : public CefClient, public CefLifeSpanHandler, public CefLoadHandler, public CefDisplayHandler, public CefRequestHandler
|
|
|
+class WebClientPrivate : public CefClient,
|
|
|
+ public CefLifeSpanHandler,
|
|
|
+ public CefLoadHandler,
|
|
|
+ public CefDisplayHandler,
|
|
|
+ public CefRequestHandler,
|
|
|
+ public CefKeyboardHandler
|
|
|
{
|
|
|
friend class WebClient;
|
|
|
|
|
|
@@ -84,6 +89,23 @@ public:
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE
|
|
|
+ {
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // CefKeyboardHandler
|
|
|
+
|
|
|
+ virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
|
|
+ const CefKeyEvent& event,
|
|
|
+ CefEventHandle os_event,
|
|
|
+ bool* is_keyboard_shortcut) OVERRIDE
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// CefRequestHandler methods
|
|
|
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
|
|
@@ -480,7 +502,30 @@ void WebClient::SendKeyEvent(const StringHash eventType, VariantMap& eventData)
|
|
|
|
|
|
host->SendKeyEvent(keyEvent);
|
|
|
|
|
|
+#ifdef ATOMIC_PLATFORM_WINDOWS
|
|
|
+
|
|
|
+ // RETURN KEY: We need to send both keydown and char for return key
|
|
|
+ // this allows it to be used both to confirm entry on popups,
|
|
|
+ // while also being used for text input
|
|
|
+ if (keyEvent.windows_key_code == 13)
|
|
|
+ {
|
|
|
+ keyEvent.type = KEYEVENT_CHAR;
|
|
|
+ host->SendKeyEvent(keyEvent);
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef ATOMIC_PLATFORM_OSX
|
|
|
+
|
|
|
+ // RETURN KEY: We need to send both keydown and char for return key
|
|
|
+ // this allows it to be used both to confirm entry on popups,
|
|
|
+ // while also being used for text input
|
|
|
+ if (keyEvent.native_key_code == 36)
|
|
|
+ {
|
|
|
+ keyEvent.type = KEYEVENT_CHAR;
|
|
|
+ host->SendKeyEvent(keyEvent);
|
|
|
+ }
|
|
|
+
|
|
|
// Send an empty key event on OSX, which seems to fix
|
|
|
// keyboard problems on OSX with cefclient
|
|
|
// ./cefclient --off-screen-rendering-enabled
|
|
|
@@ -490,10 +535,7 @@ void WebClient::SendKeyEvent(const StringHash eventType, VariantMap& eventData)
|
|
|
|
|
|
memset((void*)&keyEvent, 0, sizeof(keyEvent));
|
|
|
|
|
|
- if (eventType == "KeyDown")
|
|
|
- keyEvent.type = KEYEVENT_KEYDOWN;
|
|
|
- else
|
|
|
- keyEvent.type = KEYEVENT_KEYUP;
|
|
|
+ keyEvent.type = KEYEVENT_KEYDOWN;
|
|
|
keyEvent.modifiers = 0;
|
|
|
keyEvent.native_key_code = 0;
|
|
|
host->SendKeyEvent(keyEvent);
|