From c81c5cbfc1a4266af0b8419132300b53a4e75b60 Mon Sep 17 00:00:00 2001 From: junkyu han Date: Wed, 6 Jul 2016 15:29:17 +0900 Subject: [PATCH] Add keygrab privilege & fix tzsh region Change-Id: Id06652b799d85c61422ca02e65af2e552c98fab3 --- include/view.h | 1 + org.tizen.volume.xml | 3 ++- src/bt.c | 1 + src/control.c | 14 +++++++++++--- src/view.c | 18 +++++++++++------- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/include/view.h b/include/view.h index 2d14fec..8b917c0 100755 --- a/include/view.h +++ b/include/view.h @@ -48,6 +48,7 @@ extern Evas_Object *volume_view_window_create(void); extern Evas_Object* show_lockscreen_splash(const char *bg_path); extern volume_error_e hide_lockscreen_splash(void); +extern void volume_service_region_set(Evas_Object *win, Eina_Bool is_warning_visible); #endif /* __VOLUME_VIEW_H__ */ diff --git a/org.tizen.volume.xml b/org.tizen.volume.xml index 304cd31..f67e70a 100755 --- a/org.tizen.volume.xml +++ b/org.tizen.volume.xml @@ -1,5 +1,5 @@ - + junkyu Han Volume Application @@ -15,6 +15,7 @@ http://tizen.org/privilege/internal/default/public http://tizen.org/privilege/systemsettings.admin http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/keygrab diff --git a/src/bt.c b/src/bt.c index 7f99354..94ed31c 100644 --- a/src/bt.c +++ b/src/bt.c @@ -104,6 +104,7 @@ static void _bt_volume_changed_cb(int volume, void *user_data) if (bt_opened == true && sound_type == SOUND_TYPE_CALL) { _bt_display_bt_volume_view(sound_type, sound, vibration, bt_opened); + _D("BT SCO volume level is : %d", volume); if (VOLUME_ERROR_OK != volume_view_slider_value_set(volume)) _E("Failed to set slider value"); diff --git a/src/control.c b/src/control.c index 238ffec..b780f83 100755 --- a/src/control.c +++ b/src/control.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "main.h" #include "_util_efl.h" @@ -280,6 +281,15 @@ void volume_control_show_hide_worning() } } +static Eina_Bool _volume_region_set_timer_cb(void *data) +{ + Evas_Object *win = data; + + volume_service_region_set(win, EINA_FALSE); + + return EINA_FALSE; +} + Eina_Bool volume_control_show_view(int status, sound_type_e sound_type, int sound, bool bt_opened) { _D("Volume control show"); @@ -327,6 +337,7 @@ Eina_Bool volume_control_show_view(int status, sound_type_e sound_type, int soun if(VOLUME_ERROR_OK != volume_view_window_show(sound_type)) { _E("Failed to show volume window"); } + ecore_timer_add(1.0f, _volume_region_set_timer_cb, win); } control_info.is_launching = EINA_TRUE; @@ -364,8 +375,6 @@ Eina_Bool volume_control_show_view(int status, sound_type_e sound_type, int soun //@TODO: need to check volume_view_volume_icon_set(sound_type, sound, vibration, bt_opened); - volume_service_region_set(win, false); - return EINA_TRUE; } } @@ -541,7 +550,6 @@ volume_error_e volume_control_initialize(void) elm_win_screen_size_get(win, NULL, NULL, &(control_info.viewport_width), &(control_info.viewport_height)); - /* Set available rotations */ _control_set_window_rotation(win); diff --git a/src/view.c b/src/view.c index 3227b2c..668da6c 100755 --- a/src/view.c +++ b/src/view.c @@ -336,7 +336,9 @@ Evas_Object *add_slider(Evas_Object *parent, int min, int max, int val) volume_error_e volume_view_window_show(sound_type_e type) { _D("Volume view window SHOW is [%p]", view_info.win); + elm_win_iconified_set(view_info.win, EINA_FALSE); + if (type == SOUND_TYPE_CALL) { _D("Sound type is Call"); } else { @@ -470,14 +472,15 @@ Evas_Object *add_volume_window(const char *name) static Eina_Bool _key_grab_cb(void *data) { - int ret = 0; + int ret_up = 0; + int ret_down = 0; Evas_Object *win = data; _D("keygrab window is [%p]", win); - ret = elm_win_keygrab_set(win, KEY_VOLUMEUP, 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); - _D("Result of volume up keygrab set : %d", ret); - ret = elm_win_keygrab_set(win, KEY_VOLUMEDOWN, 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); - _D("Result of volume down keygrab set : %d", ret); + ret_up = elm_win_keygrab_set(win, KEY_VOLUMEUP, 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); + _D("Result of volume up keygrab set : %d", ret_up); + ret_down = elm_win_keygrab_set(win, KEY_VOLUMEDOWN, 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); + _D("Result of volume down keygrab set : %d", ret_down); return EINA_FALSE; } @@ -491,13 +494,14 @@ Evas_Object *volume_view_window_create(void) view_info.win = win; _D("view_info.win is [%p]", view_info.win); - elm_win_iconified_set(win, EINA_TRUE); + evas_object_show(win); ecore_timer_add(1.0f, _key_grab_cb, win); - evas_object_show(win); _connect_to_wm(win); + elm_win_iconified_set(win, EINA_TRUE); + return win; } -- 2.7.4