[TIZENIOT-2408] Applied Hardware Keycodes instead of app-control on pressing Softkeys 86/253686/7 tizen_6.5 tizen_7.0 tizen_7.0_hotfix tizen_8.0 tizen_9.0 submit/tizen/20210226.110420 submit/tizen/20210301.044820 submit/tizen/20210303.022748 submit/tizen/20210310.072408 submit/tizen_6.5/20211028.164201 submit/tizen_6.5/20211029.123901 tizen_6.5_src.m2_release tizen_7.0_src.m2_release tizen_8.0_m2_release tizen_9.0_src.m2_release
authormohitkr1 <mohit.kr1@samsung.com>
Tue, 16 Feb 2021 10:25:23 +0000 (15:55 +0530)
committermohitkr1 <mohit.kr1@samsung.com>
Fri, 26 Feb 2021 10:39:39 +0000 (16:09 +0530)
Change-Id: I5aa2550e107077b1359e8ef13eaff765687625d3
Signed-off-by: mohitkr1 <mohit.kr1@samsung.com>
inc/softkey-container.h
inc/virtual-input-module.h
src/back-key.c [changed mode: 0755->0644]
src/home-key.c [changed mode: 0755->0644]
src/softkey-container.c [changed mode: 0755->0644]
src/task-manager-key.c [changed mode: 0755->0644]
src/virtual-input-module.c

index 159dc46146af93ce384eb30d382ec7277ae7f751..6c330ba20e86079a49b551536a486fb4e12fcb52 100644 (file)
 #include <Elementary.h>
 
 #include "softkey-common.h"
+#include "virtual-input-module.h"
 
 Eina_Bool softkey_container_is_visible();
 
+efl_util_inputgen_h softkey_container_get_virtual_device();
+
+
 softkey_container_mode softkey_container_current_mode_get();
 softkey_container_visible_state softkey_container_current_visible_state_get();
 void softkey_container_current_visible_state_set(softkey_container_visible_state state);
index 9c58df101eb4c1c43d63d3125fdd9b9699736c2c..b4a4d9c72dd34c54e3f64e5653b227b28e0f6fd5 100644 (file)
 
 #include <efl_util.h>
 
+#define KEY_BACK "XF86Back"
+#define KEY_HOME "XF86Home"
+#define KEY_TASKMANAGER "XF86TaskPane"
+
 efl_util_inputgen_h Init_Virtual_Input_Module();
 
-void Send_Virtual_Backspace_Press(efl_util_inputgen_h dev);
+void Send_Virtual_Press(efl_util_inputgen_h dev, const char* keyname);
 
-void Send_Virtual_Backspace_Release(efl_util_inputgen_h dev);
+void Send_Virtual_Release(efl_util_inputgen_h dev, const char* keyname);
 
 int Finalize_Virtual_Input_Module(efl_util_inputgen_h dev);
 
old mode 100755 (executable)
new mode 100644 (file)
index 585990d..1f2a47c
@@ -15,8 +15,8 @@
  */
 
 #include "back-key.h"
-#include "virtual-input-module.h"
 #include "softkey-util.h"
+#include "softkey-container.h"
 
 #include <Elementary.h>
 
@@ -45,7 +45,6 @@ typedef struct
        Evas_Object *event_rect;
        Evas_Object *image;
        softkey_container_icon_state i_state;
-       efl_util_inputgen_h virtual_input_device;
 }back_key_data;
 
 void back_key_icon_state_set(Evas_Object *back_key, softkey_container_icon_state ic_state, back_key_data *pd)
@@ -76,18 +75,20 @@ static void
 back_key_mouse_up(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
        LOG_D("backspace key release\n");
+       efl_util_inputgen_h virtual_device = softkey_container_get_virtual_device();
        back_key_data *pd = evas_object_data_get(obj, BACK_KEY_DATA);
        back_key_icon_state_set(pd->image, ICON_STATE_NORMAL, pd);
-       Send_Virtual_Backspace_Release(pd->virtual_input_device);
+       Send_Virtual_Release(virtual_device, KEY_BACK);
 }
 
 static void
 back_key_mouse_down(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
        LOG_D("backspace key pressed\n");
+       efl_util_inputgen_h virtual_device = softkey_container_get_virtual_device();
        back_key_data *pd = evas_object_data_get(obj, BACK_KEY_DATA);
        back_key_icon_state_set(pd->image, ICON_STATE_SELECTED, pd);
-       Send_Virtual_Backspace_Press(pd->virtual_input_device);
+       Send_Virtual_Press(virtual_device, KEY_BACK);
 }
 
 static void
@@ -96,11 +97,6 @@ back_key_del_cb(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_
        LOG_I("back key image delete callback called\n");
        back_key_data *bk_data = evas_object_data_get(obj, BACK_KEY_DATA);;
        evas_object_data_set(obj, BACK_KEY_DATA,  NULL);
-       //Finalizing virtual input module
-       if(Finalize_Virtual_Input_Module(bk_data->virtual_input_device) < 0)
-       {
-               LOG_E("Failed to finalized virtual input device");
-       }
        free(bk_data);
 }
 
@@ -137,21 +133,11 @@ create_back_key(Evas_Object *parent_grid, softkey_container_mode mode, softkey_c
                return NULL;
        }
 
-       //Initialize virtual input module
-       efl_util_inputgen_h virtual_device = Init_Virtual_Input_Module();
-       if(virtual_device == NULL)
-       {
-               LOG_E("Failed to initialized virtual input module for back key.");
-               free(bk_data);
-               return NULL;
-       }
-
        // Create base grid for back grid
        Evas_Object *grid = elm_grid_add(parent_grid);
        if(grid == NULL)
        {
                LOG_E("Failed to create elm_grid for back key");
-               Finalize_Virtual_Input_Module(virtual_device);
                free(bk_data);
                return NULL;
        }
@@ -195,7 +181,6 @@ create_back_key(Evas_Object *parent_grid, softkey_container_mode mode, softkey_c
        bk_data->grid = grid;
        bk_data->event_rect = event_rect;
        bk_data->image = back_img;
-       bk_data->virtual_input_device = virtual_device;
        evas_object_data_set(grid, BACK_KEY_DATA, bk_data);
 
        // Create event handlers
old mode 100755 (executable)
new mode 100644 (file)
index 85462d1..a06048c
@@ -16,6 +16,7 @@
 
 #include "home-key.h"
 #include "softkey-util.h"
+#include "softkey-container.h"
 
 #include <Elementary.h>
 #include <app.h>
@@ -78,50 +79,20 @@ static void
 home_key_mouse_up(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
        // whether we should call the icon state function or set the image directly ?
+       efl_util_inputgen_h virtual_device = softkey_container_get_virtual_device();
        home_key_data *pd = evas_object_data_get(obj, HOME_KEY_DATA);
        home_key_icon_state_set(pd->image, ICON_STATE_NORMAL, pd);
+       Send_Virtual_Release(virtual_device, KEY_HOME);
 }
 
 static void
 home_key_mouse_down(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
        LOG_I("home mouse up called\n");
+       efl_util_inputgen_h virtual_device = softkey_container_get_virtual_device();
        home_key_data *pd = evas_object_data_get(obj, HOME_KEY_DATA);
        home_key_icon_state_set(pd->image, ICON_STATE_SELECTED, pd);
-
-       app_control_h app_control_handle = NULL;
-       int ret = 0;
-
-       ret = app_control_create(&app_control_handle);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to create app-control to launch home-screen app [error-code : %d]", ret);
-                       return;
-               }
-
-       ret = app_control_set_operation(app_control_handle, APP_CONTROL_OPERATION_DEFAULT);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to set operation to app-control to launch home-screen app [error-code : %d]", ret);
-                       app_control_destroy(app_control_handle);
-                       return;
-               }
-
-       ret = app_control_set_app_id(app_control_handle, HOMESCREEN_PKG_NAME);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to set app id to app-control to launch home-screen app [error-code : %d]", ret);
-                       app_control_destroy(app_control_handle);
-                       return;
-               }
-
-       ret = app_control_send_launch_request(app_control_handle, NULL, NULL);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to send launch request : %s, [error code: %d]", HOMESCREEN_PKG_NAME, ret);
-                       app_control_destroy(app_control_handle);
-       }
-       if(ret == 0)
-       {
-               LOG_I("Successfully launched Home-Screen");
-       }
-
+       Send_Virtual_Press(virtual_device, KEY_HOME);
 }
 
 
old mode 100755 (executable)
new mode 100644 (file)
index 41f473d..cc6f0ab
@@ -24,6 +24,7 @@
 #include "softkey-container-activate-bar.h"
 
 #include <app.h>
+#include <assert.h>
 #include <system_settings.h>
 
 #if !defined(PACKAGE)
@@ -45,6 +46,7 @@ typedef struct appdata {
        softkey_visible_state_anim_data anim_data;
        softkey_container_mode current_mode;
        softkey_container_visible_state current_visible_state;
+       efl_util_inputgen_h virtual_input_device;
 } appdata_s;
 
 
@@ -56,6 +58,12 @@ appdata_s* softkey_container_appdata_get()
        return &g_appdata;
 }
 
+efl_util_inputgen_h softkey_container_get_virtual_device()
+{
+    return  g_appdata.virtual_input_device;
+}
+
+
 Evas_Object* softkey_appdata_layout_item_obj_get(softkey_appdata_layout_item_type type)
 {
        Evas_Object *result = NULL;
@@ -282,6 +290,17 @@ window_mouse_down_callback(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN
 static void
 create_base_gui(appdata_s *ad)
 {
+       //Initialize virtual input module
+       efl_util_inputgen_h virtual_device = Init_Virtual_Input_Module();
+       if(virtual_device == NULL)
+       {
+               LOG_E("Failed to initialized virtual input module.");
+               assert(virtual_device != NULL && "Failed to initialize virtual_input module.");
+               return;
+       }
+
+       ad->virtual_input_device = virtual_device;
+
        // Setting default animation state.
        ad->anim_data.isAnimating = EINA_FALSE;
        softkey_container_current_mode_set(SOFTKEY_MODE_NORMAL);
@@ -309,6 +328,7 @@ create_base_gui(appdata_s *ad)
        ad->back_key = create_back_key(root_grid, ad->current_mode, back_key_state);
 
        ad->activate_bar = create_activate_bar(ad->win, ad->current_mode);
+
 }
 
 static bool
@@ -347,6 +367,8 @@ static void
 app_terminate(void *data)
 {
        /* Release all resources. */
+       appdata_s *ad = data;
+       Finalize_Virtual_Input_Module(ad->virtual_input_device);
 }
 
 static void
old mode 100755 (executable)
new mode 100644 (file)
index 1c0ab4d..f44433e
@@ -16,6 +16,7 @@
 
 #include "task-manager-key.h"
 #include "softkey-util.h"
+#include "softkey-container.h"
 
 #include <Elementary.h>
 #include <app.h>
@@ -77,49 +78,20 @@ static void
 taskmanager_key_mouse_up(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
        LOG_I("task-manager mouse down called\n");
+       efl_util_inputgen_h virtual_device = softkey_container_get_virtual_device();
        taskmanager_key_data *pd =  evas_object_data_get(obj, TASKMANAGER_KEY_DATA);
        taskmanager_key_icon_state_set(pd->image, ICON_STATE_NORMAL, pd);
+       Send_Virtual_Release(virtual_device, KEY_TASKMANAGER);
 }
 
 static void
 taskmanager_key_mouse_down(void *data , Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
        LOG_I("task-manager mouse up called\n");
+       efl_util_inputgen_h virtual_device = softkey_container_get_virtual_device();
        taskmanager_key_data *pd =  evas_object_data_get(obj, TASKMANAGER_KEY_DATA);
        taskmanager_key_icon_state_set(pd->image, ICON_STATE_SELECTED, pd);
-
-       app_control_h app_control_handle = NULL;
-       int ret = 0;
-
-       ret = app_control_create(&app_control_handle);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to create app-control to launch task-manager[error code: %d]", ret);
-                       return;
-               }
-
-       ret = app_control_set_operation(app_control_handle, APP_CONTROL_OPERATION_DEFAULT);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to set operation to app-control to launch task-manager[error code : %d]", ret);
-                       app_control_destroy(app_control_handle);
-                       return;
-               }
-
-       ret = app_control_set_app_id(app_control_handle, TASKMGR_PKG_NAME);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to set app id to app-control to launch task-manager[error code : %d]", ret);
-                       app_control_destroy(app_control_handle);
-                       return;
-               }
-
-       ret = app_control_send_launch_request(app_control_handle, NULL, NULL);
-               if (ret != APP_CONTROL_ERROR_NONE) {
-                       LOG_E("Failed to send launch request : %s [error code: %d]", TASKMGR_PKG_NAME, ret);
-                       app_control_destroy(app_control_handle);
-       }
-       if(ret == 0)
-       {
-               LOG_I("Successfully launched Task-Manager");
-       }
+       Send_Virtual_Press(virtual_device, KEY_TASKMANAGER);
 }
 
 static void
index e808f958fb45d2f768b2acd5e712dfaf0653f986..52dc6c764b13324a08d830314734691a48d1b5aa 100644 (file)
@@ -55,17 +55,17 @@ int Finalize_Virtual_Input_Module(efl_util_inputgen_h dev)
        return err_code;
 }
 
-void Send_Virtual_Backspace_Press(efl_util_inputgen_h dev)
+void Send_Virtual_Press(efl_util_inputgen_h dev, const char* keyname)
 {
-       LOG_D("Sending backspace key press event");
-       int err_code = efl_util_input_generate_key(dev, "XF86Back", 1);
-       LOG_D("Send_Virtual_Backspace_Press Result : %s", get_error_string(err_code));
+       LOG_D("Sending key press event");
+       int err_code = efl_util_input_generate_key(dev, keyname, 1);
+       LOG_D("Send_Virtual_Press Result : %s", get_error_string(err_code));
 }
 
-void Send_Virtual_Backspace_Release(efl_util_inputgen_h dev)
+void Send_Virtual_Release(efl_util_inputgen_h dev, const char* keyname)
 {
-       LOG_D("Sending backspace key release event");
-       int err_code = efl_util_input_generate_key(dev, "XF86Back", 0);
-       LOG_D("Send_Virtual_Backspace_Release Result : %s", get_error_string(err_code));
+       LOG_D("Sending key release event");
+       int err_code = efl_util_input_generate_key(dev, keyname, 0);
+       LOG_D("Send_Virtual_Release Result : %s", get_error_string(err_code));
 }