summaryrefslogtreecommitdiff
path: root/src/hw_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hw_key.c')
-rw-r--r--src/hw_key.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/hw_key.c b/src/hw_key.c
index b5470b3..deccb9b 100644
--- a/src/hw_key.c
+++ b/src/hw_key.c
@@ -24,6 +24,7 @@
#include <syspopup_caller.h>
#include <utilX.h>
#include <vconf.h>
+#include <system/media_key.h>
#include "hw_key.h"
#include "util.h"
@@ -79,7 +80,7 @@ static Eina_Bool _launch_home_screen(void *data)
syspopup_destroy_all();
key_info.single_timer = NULL;
- package = vconf_get_str(MENU_PKG_VCONF_KEY);
+ package = vconf_get_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME);
if (package) {
int ret;
@@ -89,6 +90,9 @@ static Eina_Bool _launch_home_screen(void *data)
_E("Default homescreen is not able to launch");
} else {
_E("Package %s is not exists, rollback to default home", package);
+ if (0 != vconf_set_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME)) {
+ _E("Cannot set value(%s) into key(%s)", VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME);
+ }
ret = aul_open_app(HOME_SCREEN_PKG_NAME);
if (ret < 0)
_E("Failed to launch default home");
@@ -97,6 +101,10 @@ static Eina_Bool _launch_home_screen(void *data)
free(package);
} else {
+ if (0 != vconf_set_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME)) {
+ _E("Cannot set value(%s) into key(%s)", VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME);
+ }
+
if (aul_open_app(HOME_SCREEN_PKG_NAME) < 0)
_E("Cannot open default home");
}
@@ -177,6 +185,21 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event)
} else if (!strcmp(ev->keyname, KEY_CAMERA)) {
} else if (!strcmp(ev->keyname, KEY_SEND)) {
} else if (!strcmp(ev->keyname, KEY_SELECT)) {
+ if (EINA_TRUE == key_info.cancel) {
+ _D("Cancel key is activated");
+ if (key_info.long_press) {
+ ecore_timer_del(key_info.long_press);
+ key_info.long_press = NULL;
+ }
+
+ if (key_info.single_timer) {
+ ecore_timer_del(key_info.single_timer);
+ key_info.single_timer = NULL;
+ }
+
+ return ECORE_CALLBACK_RENEW;
+ }
+
_release_home_key();
} else if (!strcmp(ev->keyname, KEY_PAUSE)) {
} else if (!strcmp(ev->keyname, KEY_VOLUMEDOWN)) {
@@ -184,8 +207,9 @@ static Eina_Bool _key_release_cb(void *data, int type, void *event)
ecore_timer_del(key_info.volume_down_long_press);
key_info.volume_down_long_press = NULL;
}
- if (key_info.cancel == EINA_TRUE) {
- _D("Cancel key is deactivating");
+
+ if (EINA_TRUE == key_info.cancel) {
+ _D("Cancel key is activated");
return ECORE_CALLBACK_RENEW;
}
if (syspopup_launch("volume", NULL) < 0)
@@ -243,7 +267,7 @@ static Eina_Bool _volume_down_cb(void* data)
_D("Long press : Volume down");
key_info.volume_down_long_press = NULL;
- if (key_info.cancel == EINA_TRUE)
+ if (EINA_TRUE == key_info.cancel)
return ECORE_CALLBACK_CANCEL;
b = bundle_create();
@@ -326,6 +350,20 @@ static Eina_Bool _key_press_cb(void *data, int type, void *event)
+void _media_key_event_cb(media_key_e key, media_key_event_e status, void *user_data)
+{
+ _D("MEDIA KEY EVENT");
+ if (MEDIA_KEY_STATUS_PRESSED == status) return;
+
+ if (MEDIA_KEY_PAUSE == key) {
+ _release_multimedia_key("KEY_PAUSECD");
+ } else if (MEDIA_KEY_PLAY == key) {
+ _release_multimedia_key("KEY_PLAYCD");
+ }
+}
+
+
+
void create_key_window(void)
{
key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
@@ -353,6 +391,8 @@ void create_key_window(void)
key_info.key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL);
if (!key_info.key_down)
_D("Failed to register a key down event handler");
+
+ media_key_reserve(_media_key_event_cb, NULL);
}
@@ -377,8 +417,10 @@ void destroy_key_window(void)
key_info.key_down = NULL;
}
- ecore_x_window_delete_request_send(key_info.win);
+ ecore_x_window_delete_request_send(key_info.win);
key_info.win = 0x0;
+
+ media_key_release();
}