From f851be724f22cace06c93f1362c5b69b191c71df Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Thu, 8 Dec 2016 21:09:00 +0900 Subject: [PATCH] conformant: Add quickpanel callback to postpone hiding indicator In case of transparent mode of conformant, indicator will hide in 3 seconds later after scrolled down by flicking. and If user flicks one more time before it get hided, quickpanel will be scrolled down. However, no matter what the quickpanel is visible or not, indicator will hide in 3 seconds. this patch makes conformant postpond hiding it's indicator, if quickpanel is visible. @related packages efl-modules efl-misc @tizen_fix Change-Id: I2a541c42eae3c3c68110a06684cc03de51ecc0f1 Signed-off-by: Wonki Kim --- src/lib/elm_conform.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ src/lib/elm_widget_conform.h | 28 ++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c index d8a6fec..819c335 100644 --- a/src/lib/elm_conform.c +++ b/src/lib/elm_conform.c @@ -56,6 +56,73 @@ static Evas_Object *_precreated_conform_obj = NULL; * ILLUME_IND="0, 0, 800, 32" * ILLUME_STK="0, 568, 800, 32" */ + +// TIZEN_ONLY(20161208): Support quickpanel callback +static void _indicator_hide_effect_del(void *data); +static void _indicator_hide_effect_set(void *data, double duration); + +static int conform_mod_init_cnt = 0; +static Elm_Conformant_Mod_Api *qp_mod = NULL; + +static void +_conform_mod_init(void) +{ + Elm_Module *mod = NULL; + + if (conform_mod_init_cnt++ > 0) return; + + if(!(mod = _elm_module_find_as("quickpanel_callback/api"))) goto on_init_fail; + + if (!mod->init_func) goto on_init_fail; + mod->init_func(mod); + + mod->api = malloc(sizeof(Elm_Conformant_Mod_Api)); + if (!mod->api) goto on_init_fail; + + + ((Elm_Conformant_Mod_Api *)(mod->api))->quickpanel_callback_add = + _elm_module_symbol_get(mod, "module_quickpanel_status_callback_add"); + + ((Elm_Conformant_Mod_Api *)(mod->api))->quickpanel_event_visible_get = + _elm_module_symbol_get(mod, "module_quickpanel_event_visible_get"); + + qp_mod = mod->api; + return; + + on_init_fail: + conform_mod_init_cnt--; +} + +static void +_quickpanel_visibility_changed_cb(int type, void *event_info, void *user_data) +{ + Evas_Object *conform = user_data; + Elm_Win_Indicator_Mode indmode = ELM_WIN_INDICATOR_UNKNOWN; + Elm_Win_Indicator_Opacity_Mode ind_o_mode = ELM_WIN_INDICATOR_OPACITY_UNKNOWN; + int visible = -1; + + ELM_CONFORMANT_DATA_GET_OR_RETURN(conform, sd); + + indmode = elm_win_indicator_mode_get(sd->win); + ind_o_mode = elm_win_indicator_opacity_get(sd->win); + + // This callback works only when transparent indicator is showing + if (!((indmode == ELM_WIN_INDICATOR_SHOW) && (ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT))) return; + + if(qp_mod && qp_mod->quickpanel_event_visible_get) + qp_mod->quickpanel_event_visible_get(event_info, &visible); + + if (visible == CONFORM_QUICKPANEL_STATE_VISIBLE_SHOWN) + { + _indicator_hide_effect_del(conform); + } + else if( visible == CONFORM_QUICKPANEL_STATE_VISIBLE_HIDDEN) + { + _indicator_hide_effect_set(conform, 0.5); + } +} +// END + #ifdef HAVE_ELEMENTARY_X static Eina_Bool _conformant_part_geometry_get_from_env(const char *part, @@ -1349,6 +1416,15 @@ _elm_conformant_eo_base_constructor(Eo *obj, Elm_Conformant_Data *sd) // END #endif + // TIZEN_ONLY(20161208): Support quickpanel callback + _conform_mod_init(); + if(sd->win && qp_mod && qp_mod->quickpanel_callback_add) + { + qp_mod->quickpanel_callback_add + (sd->win, CONFORM_QUICKPANEL_EVENT_VISIBLE, _quickpanel_visibility_changed_cb, obj); + } + // END + return obj; } diff --git a/src/lib/elm_widget_conform.h b/src/lib/elm_widget_conform.h index dece905..9503cc0 100644 --- a/src/lib/elm_widget_conform.h +++ b/src/lib/elm_widget_conform.h @@ -70,6 +70,34 @@ enum _Conformant_Part_Type ELM_CONFORMANT_CLIPBOARD_PART = 8 }; + +// TIZEN_ONLY(20161208): Support quickpanel callback +// +typedef void (*quickpanel_callback_cb)(int type, void *event_info, void *user_data); + +typedef enum _Conformant_Quickpanel_Event Conformant_Quickpanel_Event; +enum _Conformant_Quickpanel_Event +{ + CONFORM_QUICKPANEL_EVENT_VISIBLE = 1, + CONFORM_QUICKPANEL_EVENT_ORIENTATION = 2, +}; + +typedef enum _Conformant_Quickpanel_State Conformant_Quickpanel_State; +enum _Conformant_Quickpanel_State +{ + CONFORM_QUICKPANEL_STATE_VISIBLE_UNKNOWN = 0x0, /**< Unknown state. There is no quickpanel service. */ + CONFORM_QUICKPANEL_STATE_VISIBLE_SHOWN = 0x1, /**< Shown state. */ + CONFORM_QUICKPANEL_STATE_VISIBLE_HIDDEN = 0x2, /**< Hidden state. */ +}; + +typedef struct _Elm_Conformant_Mod_Api Elm_Conformant_Mod_Api; +struct _Elm_Conformant_Mod_Api +{ + void (*quickpanel_callback_add)(Evas_Object *win, int callback_type, quickpanel_callback_cb callback_cb, void *user_data); + void (*quickpanel_event_visible_get)(void *event_info, void *visible); +}; +// END + /** * @} */ -- 2.7.4