#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);
#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);
*/
#include "back-key.h"
-#include "virtual-input-module.h"
#include "softkey-util.h"
+#include "softkey-container.h"
#include <Elementary.h>
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)
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
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);
}
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;
}
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
#include "home-key.h"
#include "softkey-util.h"
+#include "softkey-container.h"
#include <Elementary.h>
#include <app.h>
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);
}
#include "softkey-container-activate-bar.h"
#include <app.h>
+#include <assert.h>
#include <system_settings.h>
#if !defined(PACKAGE)
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;
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;
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);
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
app_terminate(void *data)
{
/* Release all resources. */
+ appdata_s *ad = data;
+ Finalize_Virtual_Input_Module(ad->virtual_input_device);
}
static void
#include "task-manager-key.h"
#include "softkey-util.h"
+#include "softkey-container.h"
#include <Elementary.h>
#include <app.h>
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
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));
}