Add support for HW more/back keys on input pickers
authorKwangYong Choi <ky0.choi@samsung.com>
Thu, 27 Jun 2013 07:18:51 +0000 (16:18 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 27 Jun 2013 10:05:08 +0000 (10:05 +0000)
[Title] Add support for HW more/back keys on input pickers.
[Issue#] N_SE-43128
[Problem] HW keys are not handled by input pickers.
[Cause] Not handled.
[Solution] Add support for HW more/back keys on input pickers.

Change-Id: Ia2cf709e050a9b3342915bbedad68b422c1710a0

Source/WTF/wtf/Platform.h
Source/WebKit2/PlatformTizen.cmake
Source/WebKit2/UIProcess/API/efl/tizen/InputPicker.cpp
Source/WebKit2/UIProcess/API/efl/tizen/InputPicker.h
Source/cmake/FindEFL_ASSIST.cmake [new file with mode: 0644]
Source/cmake/OptionsTizen.cmake
packaging/webkit2-efl.spec

index 10db9d4..19de3f2 100755 (executable)
@@ -817,6 +817,9 @@ com) : Patch to do not adjust cover rect as fixed pixel size*/
 #if ENABLE(WORKERS)
 #define ENABLE_TIZEN_WORKERS 1 /* Jihye Kang(jye.kang@samsung.com) : Use allowUniversalAccessFromFileURLs setting for workers */
 #endif
+
+#define ENABLE_TIZEN_HW_MORE_BACK_KEY 1 /* Kwangyong Choi (ky0.choi@samsung.net) : Add support for HW more/back keys */
+
 #endif /* OS(TIZEN) */
 
 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like 
index 35daa64..86d4c69 100755 (executable)
@@ -31,6 +31,7 @@ LIST(APPEND WebKit2StaticForDebug_INCLUDE_DIRECTORIES
     ${TTS_INCLUDE_DIRS}
     ${Tizen-Location-Manager_INCLUDE_DIRS}
     ${UIGadget_INCLUDE_DIRS}
+    ${EFL_ASSIST_INCLUDE_DIRS}
 )
 
 LIST(APPEND WebKit2_LIBRARIES
@@ -39,6 +40,7 @@ LIST(APPEND WebKit2_LIBRARIES
     ${TTS_LIBRARIES}
     ${Tizen-Location-Manager_LIBRARIES}
     ${UIGadget_LIBRARY}
+    ${EFL_ASSIST_LIBRARIES}
 )
 
 ADD_DEFINITIONS(-DWTF_USE_CROSS_PLATFORM_CONTEXT_MENUS=0)
index a848788..6405fdd 100755 (executable)
@@ -28,6 +28,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+#include <efl_assist.h>
+#endif
 
 #if OS(TIZEN) && ENABLE(TIZEN_INPUT_TAG_EXTENSION)
 
@@ -40,6 +43,11 @@ Input_Picker_Layout::Input_Picker_Layout(Evas_Object* ewkView)
     , colorRect(0)
     , okButton(0)
     , dataListEditField(0)
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    , initial_r(0)
+    , initial_g(0)
+    , initial_b(0)
+#endif
     , datetimeLocal(false)
 {
     evas_object_focus_set(m_ewkView, false);
@@ -219,6 +227,10 @@ void InputPicker::showDataList(Ewk_Input_Type inputType, Eina_List* optionList)
     m_pickerLayout->popup = elm_popup_add(win);
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select data list");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _data_list_popup_response_cancel_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","data_list_picker");
     evas_object_size_hint_weight_set(m_pickerLayout->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -358,6 +370,13 @@ void InputPicker::ewk_color_popup(int r, int g, int b)
     m_pickerLayout->popup = elm_popup_add(win);
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select color");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    m_pickerLayout->initial_r = r;
+    m_pickerLayout->initial_g = g;
+    m_pickerLayout->initial_b = b;
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _color_back_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","color_picker");
     evas_object_size_hint_weight_set(m_pickerLayout->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -368,8 +387,6 @@ void InputPicker::ewk_color_popup(int r, int g, int b)
     evas_object_size_hint_weight_set(m_pickerLayout->colorRect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_show(m_pickerLayout->colorRect);
 
-    printf("\n<<<<<<<< r = [%d], g = [%d], b = [%d] >>>>>>>>>>\n", r, g, b);
-
     evas_object_color_set(m_pickerLayout->colorRect, r, g, b, 255);
     elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color_rect", m_pickerLayout->colorRect);
 #if ENABLE(ELM_COLORPALLETE)
@@ -519,6 +536,21 @@ void InputPicker::_color_popup_response_cb(void* data,  Evas_Object* obj, void*
     inputPicker->hideColorPicker();
 }
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+void InputPicker::_color_back_cb(void* data,  Evas_Object* obj, void* event_info)
+{
+    InputPicker* inputPicker = static_cast<InputPicker*>(data);
+
+    int r = inputPicker->m_pickerLayout->initial_r;
+    int g = inputPicker->m_pickerLayout->initial_g;
+    int b = inputPicker->m_pickerLayout->initial_b;
+    int a = 255;
+    ewk_view_color_picker_color_set(inputPicker->m_ewkView, r, g, b, a);
+
+    inputPicker->hideColorPicker();
+}
+#endif
+
 void InputPicker::ewk_date_popup(const char* inputValue)
 {
     struct tm* currentTime;
@@ -573,6 +605,10 @@ void InputPicker::ewk_date_popup(const char* inputValue)
     m_pickerLayout->popup = elm_popup_add(win);
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select date");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _popup_back_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","elm/datepicker");
     evas_object_size_hint_weight_set(m_pickerLayout->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -764,6 +800,10 @@ void InputPicker::ewk_week_popup(const char* inputValue)
     m_pickerLayout->popup = elm_popup_add(win);
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select date");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _popup_back_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","elm/datepicker");
     evas_object_size_hint_weight_set(m_pickerLayout->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -838,6 +878,10 @@ void InputPicker::ewk_time_popup(const char* inputValue)
     m_pickerLayout->popup = elm_popup_add(win);
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select time");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _popup_back_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","elm/datepicker");
     evas_object_size_hint_weight_set(m_pickerLayout->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -911,9 +955,12 @@ void InputPicker::ewk_month_popup(const char* inputValue)
         win = m_ewkView;
 
     m_pickerLayout->popup = elm_popup_add(win);
-
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select month");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _popup_back_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","elm/datepicker");
 
@@ -1005,6 +1052,10 @@ void InputPicker::ewk_datetime_popup(const char* inputValue, bool local)
     m_pickerLayout->popup = elm_popup_add(win);
     elm_object_part_text_set(m_pickerLayout->popup, "title,text", "Select datetime");
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    ea_object_event_callback_add(m_pickerLayout->popup, EA_CALLBACK_BACK, _popup_back_cb, this);
+#endif
+
     m_pickerLayout->layout = elm_layout_add(m_pickerLayout->popup);
     elm_layout_file_set(m_pickerLayout->layout, EDJE_DIR"/control.edj","datepicker_popup");
     evas_object_size_hint_weight_set(m_pickerLayout->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1207,6 +1258,24 @@ void InputPicker::_datetime_popup_response_cb(void* data,  Evas_Object* obj, voi
     inputPicker->m_pickerLayout = 0;
 }
 
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+void InputPicker::_popup_back_cb(void* data,  Evas_Object* obj, void* event_info)
+{
+    InputPicker* inputPicker = static_cast<InputPicker*>(data);
+
+    if (!inputPicker->m_pickerLayout)
+        return;
+
+    if (inputPicker->m_pickerLayout->popup) {
+        evas_object_del(inputPicker->m_pickerLayout->popup);
+        inputPicker->m_pickerLayout->popup = 0;
+    }
+
+    delete inputPicker->m_pickerLayout;
+    inputPicker->m_pickerLayout = 0;
+}
+#endif
+
 } // namespace WebKit
 
 #endif // OS(TIZEN) && ENABLE(TIZEN_INPUT_TAG_EXTENSION)
index ec4cb06..3865cdc 100644 (file)
@@ -58,52 +58,63 @@ public:
     Evas_Object* colorRect;
     Evas_Object* okButton;
     Evas_Object* dataListEditField;
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    int initial_r;
+    int initial_g;
+    int initial_b;
+#endif
     bool datetimeLocal;
 };
 
 namespace WebKit {
 
-    class InputPicker {
-    public:
-        InputPicker(Evas_Object*);
-        ~InputPicker();
+class InputPicker {
+public:
+    InputPicker(Evas_Object*);
+    ~InputPicker();
 
-        void show(Ewk_Input_Type, const char*);
+    void show(Ewk_Input_Type, const char*);
 
 #if ENABLE(TIZEN_DATALIST_ELEMENT)
-        void showDataList(Ewk_Input_Type inputType, Eina_List* optionList);
-        void hideDataList(Ewk_Input_Type inputType);
+    void showDataList(Ewk_Input_Type inputType, Eina_List* optionList);
+    void hideDataList(Ewk_Input_Type inputType);
 #endif
 
 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
-        void showColorPicker(int, int, int, int);
-        void hideColorPicker();
-        bool isColorPickerShown() { return m_isColorPickerShown; }
+    void showColorPicker(int, int, int, int);
+    void hideColorPicker();
+    bool isColorPickerShown() { return m_isColorPickerShown; }
 #endif
 
-        void ewk_date_popup(const char*);
-        void ewk_time_popup(const char*);
-        void ewk_month_popup(const char*);
-        void ewk_week_popup(const char*);
-        void ewk_datetime_popup(const char*, bool);
-        void ewk_color_popup(int, int, int);
-    private:
-        static void _date_popup_response_cb(void*, Evas_Object*, void*);
-        static void _time_popup_response_cb(void*, Evas_Object*, void*);
-        static void _month_popup_response_cb(void*, Evas_Object*, void*);
-        static void _week_popup_response_cb(void*, Evas_Object*, void*);
-        static void _datetime_popup_response_cb(void*, Evas_Object*, void*);
-        static void _color_popup_response_cb(void*, Evas_Object*, void*);
-        static void _data_list_popup_response_cb(void*, Evas_Object*, void*);
-        static void _data_list_popup_response_cancel_cb(void*, Evas_Object*, void*);
-        static void _data_list_selected_cb(void*, Evas_Object*, void*);
-        static void _color_selected_cb(void*, Evas*, Evas_Object*, void*);
-
-        Evas_Object* m_ewkView;
-        Input_Picker_Layout* m_pickerLayout;
-        Eina_List* m_dataList;
+    void ewk_date_popup(const char*);
+    void ewk_time_popup(const char*);
+    void ewk_month_popup(const char*);
+    void ewk_week_popup(const char*);
+    void ewk_datetime_popup(const char*, bool);
+    void ewk_color_popup(int, int, int);
+
+private:
+    static void _date_popup_response_cb(void*, Evas_Object*, void*);
+    static void _time_popup_response_cb(void*, Evas_Object*, void*);
+    static void _month_popup_response_cb(void*, Evas_Object*, void*);
+    static void _week_popup_response_cb(void*, Evas_Object*, void*);
+    static void _datetime_popup_response_cb(void*, Evas_Object*, void*);
+    static void _color_popup_response_cb(void*, Evas_Object*, void*);
+    static void _data_list_popup_response_cb(void*, Evas_Object*, void*);
+    static void _data_list_popup_response_cancel_cb(void*, Evas_Object*, void*);
+    static void _data_list_selected_cb(void*, Evas_Object*, void*);
+    static void _color_selected_cb(void*, Evas*, Evas_Object*, void*);
+
+#if ENABLE(TIZEN_HW_MORE_BACK_KEY)
+    static void _color_back_cb(void*, Evas_Object*, void*);
+    static void _popup_back_cb(void*, Evas_Object*, void*);
+#endif
+
+    Evas_Object* m_ewkView;
+    Input_Picker_Layout* m_pickerLayout;
+    Eina_List* m_dataList;
 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
-        bool m_isColorPickerShown;
+    bool m_isColorPickerShown;
 #endif
     };
 } // namespace WebKit
diff --git a/Source/cmake/FindEFL_ASSIST.cmake b/Source/cmake/FindEFL_ASSIST.cmake
new file mode 100644 (file)
index 0000000..1c86598
--- /dev/null
@@ -0,0 +1,21 @@
+# - Try to find efl-assist
+# Once done, this will define
+#
+#  EFL_ASSIST_FOUND - system has efl-assist
+#  EFL_ASSIST_INCLUDE_DIRS - the efl-assist include directories
+#  EFL_ASSIST_LIBRARIES - link these to use efl-assist
+
+INCLUDE(FindPkgConfig)
+
+PKG_CHECK_MODULES(PC_EFL_ASSIST efl-assist)
+
+FIND_PATH(EFL_ASSIST_INCLUDE_DIRS NAMES efl_assist.h
+  HINTS ${PC_EFL_ASSIST_INCLUDE_DIRS} ${PC_EFL_ASSIST_INCLUDEDIR}
+)
+
+FIND_LIBRARY(EFL_ASSIST_LIBRARIES NAMES efl-assist
+  HINTS ${PC_EFL_ASSIST_LIBRARY_DIRS} ${PC_EFL_ASSIST_LIBDIR}
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(EFL_ASSIST DEFAULT_MSG EFL_ASSIST_INCLUDE_DIRS EFL_ASSIST_LIBRARIES)
index 2275741..6f25ba2 100644 (file)
@@ -232,6 +232,7 @@ FIND_PACKAGE(Media-Utils 0.1.35 REQUIRED)
 FIND_PACKAGE(UIGadget REQUIRED)
 FIND_PACKAGE(VConf REQUIRED)
 FIND_PACKAGE(feedback REQUIRED)
+FIND_PACKAGE(EFL_ASSIST REQUIRED)
 
 ADD_DEFINITIONS(-DENABLE_GESTURE_EVENTS=1)
 
index 54eb28a..0690a1c 100644 (file)
@@ -21,6 +21,7 @@ BuildRequires: pkgconfig(ecore-file)
 BuildRequires: pkgconfig(edbus)
 BuildRequires: pkgconfig(edje)
 BuildRequires: pkgconfig(eeze)
+BuildRequires: pkgconfig(efl-assist)
 BuildRequires: pkgconfig(eina)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(enchant)