From 3c10420b792b5e0a3d695f29edccd305caf90de7 Mon Sep 17 00:00:00 2001 From: Sanghyup Lee Date: Fri, 15 Mar 2013 16:22:32 +0900 Subject: [PATCH] Implement Beep sound when click link [Title] Implement Beep sound when click link [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Implement Beep sound when click link Change-Id: I79c1f2cb2b8fc1a075aca4318a881c63c559f68d --- Source/WTF/wtf/Platform.h | 1 + Source/WebCore/PlatformTizen.cmake | 2 ++ Source/WebCore/html/HTMLAnchorElement.cpp | 7 +++++++ Source/WebCore/html/HTMLButtonElement.cpp | 7 +++++++ Source/WebCore/html/HTMLInputElement.cpp | 7 +++++++ Source/WebCore/platform/Sound.h | 3 +++ Source/WebCore/platform/efl/SoundEfl.cpp | 13 +++++++++++++ Source/cmake/Findfeedback.cmake | 30 ++++++++++++++++++++++++++++++ Source/cmake/OptionsTizen.cmake | 1 + packaging/webkit2-efl.spec | 1 + 10 files changed, 72 insertions(+) create mode 100644 Source/cmake/Findfeedback.cmake diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 158b773..a994739 100755 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -370,6 +370,7 @@ #define ENABLE_TIZEN_CONTEXT_MENU_TEMPORARY_FIX 1 /* Michal Pakula(m.pakula@samsung.com) : Temporary hack to prevent from crash when calling context menu on editable fiedld */ #define ENABLE_TIZEN_CONTEXT_MENU_SELECT 1 /* Michal Pakula(m.pakula@samsung.com) : Adds Select All and Select options to context menu */ #define ENABLE_TIZEN_MEDIA_CONTROL_USER_AGENT_SHEET 1 /* Gyuyoung Kim(gyuyoung.kim@samsung.com) Add media control ui sheet for TIZEN */ +#define ENABLE_TIZEN_LINK_SOUND 1 /* Sanghyup Lee(sh53.lee@samsung.com) For beep on click link*/ #define ENABLE_TIZEN_DAILY_UPVERSIONING 1 /* Krzysztof Czech(k.czech@samsung.com) : Used for fixing building errors while doing daily upversioning, should be deleted before merging to master*/ diff --git a/Source/WebCore/PlatformTizen.cmake b/Source/WebCore/PlatformTizen.cmake index 6dea52e..7be971b 100755 --- a/Source/WebCore/PlatformTizen.cmake +++ b/Source/WebCore/PlatformTizen.cmake @@ -25,6 +25,7 @@ LIST(APPEND WebCore_INCLUDE_DIRECTORIES ${Pmapi_INCLUDE_DIRS} ${SESSION_INCLUDE_DIRS} ${VConf_INCLUDE_DIRS} + ${feedback_INCLUDE_DIR} ) LIST(APPEND WebCore_LIBRARIES @@ -43,6 +44,7 @@ LIST(APPEND WebCore_LIBRARIES ${Pmapi_LIBRARIES} ${SESSION_LIBRARIES} ${VConf_LIBRARIES} + ${feedback_LIBRARY} ) LIST(APPEND WebCore_USER_AGENT_STYLE_SHEETS diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp index 5680a38..63a6e83 100644 --- a/Source/WebCore/html/HTMLAnchorElement.cpp +++ b/Source/WebCore/html/HTMLAnchorElement.cpp @@ -42,6 +42,10 @@ #include "SecurityPolicy.h" #include "Settings.h" +#if ENABLE(TIZEN_LINK_SOUND) +#include "Sound.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -162,6 +166,9 @@ void HTMLAnchorElement::defaultEventHandler(Event* event) } if (isLinkClick(event) && treatLinkAsLiveForEventType(eventType(event))) { +#if ENABLE(TIZEN_LINK_SOUND) + feedbackPlay(); +#endif handleClick(event); return; } diff --git a/Source/WebCore/html/HTMLButtonElement.cpp b/Source/WebCore/html/HTMLButtonElement.cpp index ecb4a21..4c65836 100644 --- a/Source/WebCore/html/HTMLButtonElement.cpp +++ b/Source/WebCore/html/HTMLButtonElement.cpp @@ -36,6 +36,10 @@ #include "ScriptEventListener.h" #include +#if ENABLE(TIZEN_LINK_SOUND) +#include "Sound.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -112,6 +116,9 @@ void HTMLButtonElement::parseAttribute(const Attribute& attribute) void HTMLButtonElement::defaultEventHandler(Event* event) { if (event->type() == eventNames().DOMActivateEvent && !disabled()) { +#if ENABLE(ETIZEN_LINK_SOUND) + feedbackPlay(); +#endif if (form() && m_type == SUBMIT) { m_isActivatedSubmit = true; form()->prepareForSubmission(event); diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 13f1849..40480b4 100755 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -72,6 +72,10 @@ #include "TouchEvent.h" #endif +#if ENABLE(TIZEN_LINK_SOUND) +#include "Sound.h" +#endif + using namespace std; namespace WebCore { @@ -1153,6 +1157,9 @@ void HTMLInputElement::defaultEventHandler(Event* evt) } if (evt->isMouseEvent() && evt->type() == eventNames().mousedownEvent) { +#if ENABLE(TIZEN_LINK_SOUND) + feedbackPlay(); +#endif m_inputType->handleMouseDownEvent(static_cast(evt)); if (evt->defaultHandled()) return; diff --git a/Source/WebCore/platform/Sound.h b/Source/WebCore/platform/Sound.h index 534129b..d78bb56 100644 --- a/Source/WebCore/platform/Sound.h +++ b/Source/WebCore/platform/Sound.h @@ -27,6 +27,9 @@ #define Sound_h namespace WebCore { +#if ENABLE(TIZEN_LINK_SOUND) + void feedbackPlay(); +#endif void systemBeep(); diff --git a/Source/WebCore/platform/efl/SoundEfl.cpp b/Source/WebCore/platform/efl/SoundEfl.cpp index cb63db9..19a56ee 100644 --- a/Source/WebCore/platform/efl/SoundEfl.cpp +++ b/Source/WebCore/platform/efl/SoundEfl.cpp @@ -34,8 +34,21 @@ #include #endif +#if ENABLE(TIZEN_LINK_SOUND) +#include "feedback.h" +#endif + namespace WebCore { +#if ENABLE(TIZEN_LINK_SOUND) +void feedbackPlay() +{ + feedback_initialize(); + feedback_play(FEEDBACK_PATTERN_TAP); + feedback_deinitialize(); +} +#endif + void systemBeep() { // FIXME: The ecore_x_bell() uses XBell() which works in the current Display. diff --git a/Source/cmake/Findfeedback.cmake b/Source/cmake/Findfeedback.cmake new file mode 100644 index 0000000..6d2b5c9 --- /dev/null +++ b/Source/cmake/Findfeedback.cmake @@ -0,0 +1,30 @@ +# - Try to find feedback +# Once done, this will define +# +# feedback_FOUND - system has feedback +# feedback_INCLUDE_DIRS - the feedback include directories +# feedback_LIBRARIES - link these to use feedback + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(feedback_PKGCONF feedback) + +# Include dir +find_path(feedback_INCLUDE_DIR + NAMES feedback.h + PATHS ${feedback_PKGCONF_INCLUDE_DIRS} + PATH_SUFFIXES feedback +) + +# Finally the library itself +find_library(feedback_LIBRARY + NAMES feedback + PATHS ${feedback_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(feedback_PROCESS_INCLUDES feedback_INCLUDE_DIR feddback_INCLUDE_DIRS) +set(feedback_PROCESS_LIBS feedback_LIBRARY feedback_LIBRARIES) +libfind_process(libfeedback) diff --git a/Source/cmake/OptionsTizen.cmake b/Source/cmake/OptionsTizen.cmake index 02480a7..355cab7 100644 --- a/Source/cmake/OptionsTizen.cmake +++ b/Source/cmake/OptionsTizen.cmake @@ -233,6 +233,7 @@ FIND_PACKAGE(GLES REQUIRED) FIND_PACKAGE(Media-Utils 0.1.35 REQUIRED) FIND_PACKAGE(UIGadget REQUIRED) FIND_PACKAGE(VConf REQUIRED) +FIND_PACKAGE(feedback REQUIRED) ADD_DEFINITIONS(-DENABLE_GESTURE_EVENTS=1) diff --git a/packaging/webkit2-efl.spec b/packaging/webkit2-efl.spec index c0eee64..21a924e 100644 --- a/packaging/webkit2-efl.spec +++ b/packaging/webkit2-efl.spec @@ -25,6 +25,7 @@ BuildRequires: pkgconfig(eina) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(enchant) BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(feedback) BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(glib-2.0) -- 2.7.4