Browse Source

Adding Chromium Embedded Framework license, also cleaning up some keyboard handling

Josh Engebretson 10 years ago
parent
commit
741bfd37a8

+ 31 - 0
Licenses/LICENSE_THIRDPARTY.md

@@ -1109,3 +1109,34 @@ The externally maintained libraries used by Node.js are:
      * Hudson ([email protected]).
      * Hudson ([email protected]).
      *
      *
      */
      */
+     
+#### Chromium Embedded Framework
+    // Copyright (c) 2008-2014 Marshall A. Greenblatt. Portions Copyright (c)
+    // 2006-2009 Google Inc. All rights reserved.
+    //
+    // Redistribution and use in source and binary forms, with or without
+    // modification, are permitted provided that the following conditions are
+    // met:
+    //
+    //    * Redistributions of source code must retain the above copyright
+    // notice, this list of conditions and the following disclaimer.
+    //    * Redistributions in binary form must reproduce the above
+    // copyright notice, this list of conditions and the following disclaimer
+    // in the documentation and/or other materials provided with the
+    // distribution.
+    //    * Neither the name of Google Inc. nor the name Chromium Embedded
+    // Framework nor the names of its contributors may be used to endorse
+    // or promote products derived from this software without specific prior
+    // written permission.
+    //
+    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 13 - 33
Source/AtomicWebView/WebClient.cpp

@@ -102,24 +102,6 @@ public:
                                CefEventHandle os_event,
                                CefEventHandle os_event,
                                bool* is_keyboard_shortcut) OVERRIDE
                                bool* is_keyboard_shortcut) OVERRIDE
     {
     {
-
-        /*
-#ifdef ATOMIC_PLATFORM_OSX
-
-        if (!event.native_key_code)
-            return false;
-
-        if (event.native_key_code == 36)
-        {
-            if (event.focus_on_editable_field && event.type != KEYEVENT_CHAR)
-                return true;
-
-            if (!event.focus_on_editable_field && event.type == KEYEVENT_CHAR)
-                return true;
-        }
-
-#endif */
-
         return false;
         return false;
     }
     }
 
 
@@ -522,6 +504,9 @@ void WebClient::SendKeyEvent(const StringHash eventType, VariantMap& eventData)
 
 
 #ifdef ATOMIC_PLATFORM_WINDOWS
 #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)
     if (keyEvent.windows_key_code == 13)
     {
     {
         keyEvent.type = KEYEVENT_CHAR;
         keyEvent.type = KEYEVENT_CHAR;
@@ -531,31 +516,26 @@ void WebClient::SendKeyEvent(const StringHash eventType, VariantMap& eventData)
 #endif
 #endif
 
 
 #ifdef ATOMIC_PLATFORM_OSX
 #ifdef ATOMIC_PLATFORM_OSX
-    // Send an empty key event on OSX, which seems to fix
-    // keyboard problems on OSX with cefclient
-    // ./cefclient --off-screen-rendering-enabled
-    // return does not work at all on cef client with offscreen
-    // bad interaction with arrow keys (for example here, after
-    // hitting arrow keys, return/text takes a couple presses to register
 
 
+    // 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)
     if (keyEvent.native_key_code == 36)
     {
     {
         keyEvent.type = KEYEVENT_CHAR;
         keyEvent.type = KEYEVENT_CHAR;
         host->SendKeyEvent(keyEvent);
         host->SendKeyEvent(keyEvent);
     }
     }
 
 
-    //if (keyEvent.native_key_code == 125)
-    //{
-    //    keyEvent.type = KEYEVENT_KEYUP;
-    //    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
+    // return does not work at all on cef client with offscreen
+    // bad interaction with arrow keys (for example here, after
+    // hitting arrow keys, return/text takes a couple presses to register
 
 
     memset((void*)&keyEvent, 0, sizeof(keyEvent));
     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.modifiers = 0;
     keyEvent.native_key_code = 0;
     keyEvent.native_key_code = 0;
     host->SendKeyEvent(keyEvent);
     host->SendKeyEvent(keyEvent);

+ 2 - 1
Source/AtomicWebView/WebKeyboardMac.cpp

@@ -54,6 +54,8 @@ bool ConvertKeyEvent(Input* input, const StringHash eventType, VariantMap& event
     if (eventType == "KeyUp")
     if (eventType == "KeyUp")
         return false;
         return false;
 
 
+    memset((void*)&keyEvent, 0, sizeof(keyEvent));
+
     WebKeyEvent wk(eventType, eventData);
     WebKeyEvent wk(eventType, eventData);
 
 
     if (wk.scanCode == SDL_SCANCODE_RETURN)
     if (wk.scanCode == SDL_SCANCODE_RETURN)
@@ -80,7 +82,6 @@ bool ConvertKeyEvent(Input* input, const StringHash eventType, VariantMap& event
     if (superdown)
     if (superdown)
         keyEvent.modifiers |= EVENTFLAG_COMMAND_DOWN;
         keyEvent.modifiers |= EVENTFLAG_COMMAND_DOWN;
 
 
-
     int darwinScanCode;
     int darwinScanCode;
     if (SDLScanCodeToDarwinScanCode((SDL_Scancode) wk.scanCode, darwinScanCode))
     if (SDLScanCodeToDarwinScanCode((SDL_Scancode) wk.scanCode, darwinScanCode))
     {
     {