From 2ef227e1a73787a6afc27ed7f816a45d164daf2f Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Fri, 7 Jun 2013 23:32:18 +0900 Subject: [PATCH] [Release] wrt-plugins-common_0.3.95 --- packaging/wrt-plugins-common.spec | 2 +- src/dispatch-event/dispatch_event_support.cpp | 27 +++++++++++++++++++++++---- src/dispatch-event/dispatch_event_support.h | 7 ++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packaging/wrt-plugins-common.spec b/packaging/wrt-plugins-common.spec index 9454329..d1b93dc 100644 --- a/packaging/wrt-plugins-common.spec +++ b/packaging/wrt-plugins-common.spec @@ -1,7 +1,7 @@ #git:framework/web/wrt-plugins-common Name: wrt-plugins-common Summary: wrt-plugins common library -Version: 0.3.94 +Version: 0.3.95 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/src/dispatch-event/dispatch_event_support.cpp b/src/dispatch-event/dispatch_event_support.cpp index b73a2fb..24c9f84 100644 --- a/src/dispatch-event/dispatch_event_support.cpp +++ b/src/dispatch-event/dispatch_event_support.cpp @@ -24,10 +24,6 @@ #ifndef _DISPATCH_EVENT_SUPPORT_CPP_ #define _DISPATCH_EVENT_SUPPORT_CPP_ -#include -#include -#include - #include "dispatch_event_support.h" namespace DispatchEventSupport { @@ -152,5 +148,28 @@ void dispatchStorageEvent(JSContextRef context, const std::string key, const std } } +void dispatchHwKeyEvent(Evas_Object* ewkView, const std::string key) +{ + LogDebug("dispatchHwKeyEvent(" << ewkView << ", " << key << ")"); + + if (ewkView != NULL && !key.empty()) + { + std::stringstream script; + + script << "var __event = document.createEvent(\"CustomEvent\");\n" + << "__event.initCustomEvent(\"tizenhwkey\", true, true);\n" + << "__event.keyName = \"" << key << "\";\n" + << "document.dispatchEvent(__event);\n" + << "\n" + << "for (var i=0; i < window.frames.length; i++)\n" + << "{ window.frames[i].document.dispatchEvent(__event); }"; + + // just for debugging + // LogDebug("script :\n" << script.str()); + + ewk_view_script_execute(ewkView, script.str().c_str(), NULL, NULL); + } +} + } #endif //_DISPATCH_EVENT_SUPPORT_CPP_ diff --git a/src/dispatch-event/dispatch_event_support.h b/src/dispatch-event/dispatch_event_support.h index a267e2c..df74b4b 100644 --- a/src/dispatch-event/dispatch_event_support.h +++ b/src/dispatch-event/dispatch_event_support.h @@ -24,11 +24,16 @@ #ifndef _DISPATCH_EVENT_SUPPORT_H_ #define _DISPATCH_EVENT_SUPPORT_H_ +#include +#include +#include +#include + namespace DispatchEventSupport { void dispatchAppServiceEvent(JSContextRef context, const float scale, const std::string bundle); void dispatchSoftKeyboardChangeEvent(JSContextRef context, const std::string state, const int width, const int height); void dispatchStorageEvent(JSContextRef context, const std::string key, const std::string oldValue, const std::string newValue, const std::string url); - +void dispatchHwKeyEvent(Evas_Object* ewkView, const std::string key); } #endif //_DISPATCH_EVENT_SUPPORT_H_ -- 2.7.4