Skip to content

Commit

Permalink
Use camel case key for key event messages (#15)
Browse files Browse the repository at this point in the history
* Use camel case key for key event messages

* Update DEPS file
  • Loading branch information
swift-kim authored and GitHub Enterprise committed Oct 5, 2020
1 parent 2e3a159 commit 075d0a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ allowed_hosts = [

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a6c0959d1ac8cdfe6f9ff87892bc4905a73699fe',
'src/third_party/tizen_tools' :'git@github.sec.samsung.net:f-project/tizen_tools.git' + '@' + 'f2d2461da1c0a3192019c475c7210456cb8ec715',
'src/third_party/tizen_tools' :'git@github.sec.samsung.net:f-project/tizen_tools.git' + '@' + 'dcd6fbaaa68da4225ab1482e60e6e6ee157664b6',

# Fuchsia compatibility
#
Expand Down
24 changes: 9 additions & 15 deletions shell/platform/tizen/key_event_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ static constexpr char kKeyMapKey[] = "keymap";
static constexpr char kKeyCodeKey[] = "keyCode";
static constexpr char kTypeKey[] = "type";
static constexpr char kModifiersKey[] = "modifiers";
static constexpr char kKeynameKey[] = "keyname";
static constexpr char kKeySymbolKey[] = "keysymbol";
static constexpr char kKeyNameKey[] = "keyName";
static constexpr char kComposeKey[] = "compose";
static constexpr char kTizenKeyMap[] = "tizen";
static constexpr char kKeyUp[] = "keyup";
Expand Down Expand Up @@ -71,36 +70,31 @@ KeyEventChannel::~KeyEventChannel() {
}

void KeyEventChannel::OnKeyDown(Ecore_Event_Key* keyDownEvent) {
LoggerD("OnKeyDown##keycode == %d, keyname == %s", keyDownEvent->keycode,
LoggerD("OnKeyDown keyCode == %d, keyName == %s", keyDownEvent->keycode,
keyDownEvent->keyname);
rapidjson::Document event(rapidjson::kObjectType);
auto& allocator = event.GetAllocator();
rapidjson::Value keyName_code, key_code;
rapidjson::Value keyNameValue;
event.AddMember(kKeyMapKey, kTizenKeyMap, allocator);
event.AddMember(kTypeKey, kKeyDown, allocator);
event.AddMember(kKeyCodeKey, keyDownEvent->keycode, allocator);
event.AddMember(kModifiersKey, keyDownEvent->modifiers, allocator);
keyName_code.SetString(keyDownEvent->keyname, allocator);
event.AddMember(kKeynameKey, keyName_code, allocator);
key_code.SetString(keyDownEvent->keyname, allocator);
event.AddMember(kKeySymbolKey, key_code, allocator);
keyNameValue.SetString(keyDownEvent->keyname, allocator);
event.AddMember(kKeyNameKey, keyNameValue, allocator);
channel_->Send(event);
}

void KeyEventChannel::OnKeyUp(Ecore_Event_Key* keyUpEvent) {
LoggerD("OnKeyUp##keycode == %d, keyname == %s", keyUpEvent->keycode,
LoggerD("OnKeyUp keyCode == %d, keyName == %s", keyUpEvent->keycode,
keyUpEvent->keyname);
rapidjson::Document event(rapidjson::kObjectType);
auto& allocator = event.GetAllocator();
rapidjson::Value keyName_code, key_code;
rapidjson::Value keyNameValue;
event.AddMember(kKeyMapKey, kTizenKeyMap, allocator);
event.AddMember(kTypeKey, kKeyUp, allocator);
event.AddMember(kKeyCodeKey, keyUpEvent->keycode, allocator);
event.AddMember(kModifiersKey, keyUpEvent->modifiers, allocator);
keyName_code.SetString(keyUpEvent->keyname, allocator);
event.AddMember(kKeynameKey, keyName_code, allocator);
key_code.SetString(keyUpEvent->keyname, allocator);
event.AddMember(kKeySymbolKey, key_code, allocator);

keyNameValue.SetString(keyUpEvent->keyname, allocator);
event.AddMember(kKeyNameKey, keyNameValue, allocator);
channel_->Send(event);
}

0 comments on commit 075d0a7

Please sign in to comment.