Browse Source

Fixes not being able to send UTF8 characters anymore

Heilig Benedek 8 years ago
parent
commit
af80b9a7df

+ 2 - 1
atom/common/keyboard_util.cc

@@ -159,7 +159,8 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s,
       return ui::VKEY_UNKNOWN;
     }
   } else {
-    LOG(WARNING) << "Invalid accelerator token: " << str;
+    if (str.size() > 2)
+      LOG(WARNING) << "Invalid accelerator token: " << str;
     return ui::VKEY_UNKNOWN;
   }
 }

+ 4 - 3
atom/common/native_mate_converters/blink_converter.cc

@@ -176,9 +176,10 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
   out->setKeyIdentifierFromWindowsKeyCode();
   if ((out->type == blink::WebInputEvent::Char ||
        out->type == blink::WebInputEvent::RawKeyDown) &&
-      str.size() == 1) {
-    out->text[0] = str[0];
-    out->unmodifiedText[0] = str[0];
+      str.size() <= 2) {
+    base::string16 code = base::UTF8ToUTF16(str);
+    out->text[0] = code[0];
+    out->unmodifiedText[0] = code[0];
   }
   return true;
 }