jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=26272bf3a27dd79ffed194896d03f4af60f1b7bd
commit 26272bf3a27dd79ffed194896d03f4af60f1b7bd Author: Hosang Kim <hosang12....@samsung.com> Date: Tue Dec 12 10:02:23 2017 +0900 win: apply conformant features. Summary: - implement indicator enable/disable - implement indicator type - add indicator swallow area to border.edc - add 'test win indicator' sample Test Plan: elementary_test -> win_indicator Reviewers: woohyun, cedric, jpeg Subscribers: taxi2se, jypark, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5418 --- data/elementary/themes/edc/elm/border.edc | 136 ++++++++++++++++++++- src/Makefile_Elementary.am | 1 + src/bin/elementary/test.c | 3 + src/bin/elementary/test_win_indicator.c | 122 +++++++++++++++++++ src/lib/elementary/efl_ui_win.c | 192 ++++++++++++++++++++++++------ src/lib/elementary/efl_ui_win.eo | 26 +--- 6 files changed, 417 insertions(+), 63 deletions(-) diff --git a/data/elementary/themes/edc/elm/border.edc b/data/elementary/themes/edc/elm/border.edc index 83ebdb260b..b788e73115 100644 --- a/data/elementary/themes/edc/elm/border.edc +++ b/data/elementary/themes/edc/elm/border.edc @@ -46,7 +46,7 @@ group { name: "elm/border/base/default"; desc { rel1.to: "elm.swallow.menu"; rel1.relative: 0.0 1.0; - rel2.to: "bottom_clip"; + rel2.to: "elm.swallow.keyboard"; rel2.relative: 1.0 0.0; } } @@ -71,7 +71,9 @@ group { name: "elm/border/base/default"; rect { "bg_clip"; nomouse; desc { "default"; - rel.to: "elm.spacer.content"; + rel1.to: "top_clip"; + rel1.relative: 0.0 1.0; + rel2.to: "bottom_clip"; } } rect { "elm.rect.background"; @@ -108,6 +110,17 @@ group { name: "elm/border/base/default"; visible: 1; } } + spacer { "indicator_spacer"; + desc { "default"; + rel.to: "elm.swallow.indicator"; + } + desc { "hidden"; + rel.to: "top_clip"; + rel1.relative: 0.0 1.0; + align: 0.5 0.0; + fixed: 1 1; + } + } /* main menu */ rect { "menu_bg"; @@ -120,7 +133,7 @@ group { name: "elm/border/base/default"; swallow { "elm.swallow.menu"; required: 1; // since 1.19 desc { "default"; - rel.to: "top_clip"; + rel.to: "indicator_spacer"; rel1.relative: 0.0 1.0; visible: 0; align: 0.5 0.0; @@ -137,7 +150,7 @@ group { name: "elm/border/base/default"; desc { "default"; rel1.to: "elm.swallow.menu"; rel1.relative: 0.0 1.0; - rel2.to: "bottom_clip"; + rel2.to: "elm.swallow.keyboard"; rel2.relative: 1.0 0.0; } } @@ -573,6 +586,14 @@ group { name: "elm/border/base/default"; desc { "hidden"; inherit: "default"; hid; } } /* bottom border - spacer and clipper */ + swallow { "elm.swallow.keyboard"; + desc { "default"; + rel.to: "bottom_clip"; + rel2.relative: 1.0 0.0; + align: 0.0 1.0; + fixed: 0 1; + } + } rect { "bottom_clip"; desc { "default"; rel.to: "shadow_spacer"; @@ -662,6 +683,34 @@ group { name: "elm/border/base/default"; FIXED_SIZE(69, 5) } } + rect { "indicator_bg"; + clip: "bg_clip"; + desc { "default"; + color: 148 23 45 255; + rel.to: "elm.swallow.indicator"; + } + desc { "bg_transparent"; + inherit: "default"; + color: 0 0 0 0; + } + } + swallow { "elm.swallow.indicator"; + clip: "bg_clip"; + desc { "default"; + rel.to: "top_clip"; + rel1.relative: 0.0 1.0; + visible: 0; + align: 0.5 0.0; + fixed: 1 1; + } + desc { "visible"; inherit: "default"; + visible: 1; + fixed: 0 1; + } + desc { "hidden"; inherit: "visible"; + align: 0.5 1.0; + } + } } #define BORDERLESS 1 @@ -670,9 +719,16 @@ group { name: "elm/border/base/default"; #define SET_MODE(a) script { new m = get_int(border_mode); m |= (a); set_int(border_mode, m); eval_mode(m); } #define UNSET_MODE(a) script { new m = get_int(border_mode); m &= ~(a); set_int(border_mode, m); eval_mode(m); } +#define INDICATOR_TYPE_UNKNOWN 0 +#define INDICATOR_TYPE_BG_OPAQUE 1 +#define INDICATOR_TYPE_BG_TRANSPARENT 2 +#define INDICATOR_TYPE_HIDDEN 3 + programs { script { public border_mode; + public indicator_type = 0; + public indicator_enabled = 0; public eval_mode(m) { if (m & (BORDERLESS | MAXIMIZED | UNRESIZABLE)) { set_state(PART:"bottom_clip", "hidden", 0.0); @@ -832,6 +888,78 @@ group { name: "elm/border/base/default"; UNSET_MODE(MAXIMIZED); } + /*indicator*/ + program { + signal: "elm,action,show_indicator"; source: "elm"; + script { + set_int(indicator_enabled, 1); + } + after: "update_indicator"; + } + program { + signal: "elm,action,hide_indicator"; source: "elm"; + script { + set_int(indicator_enabled, 0); + } + after: "update_indicator"; + } + program { + signal: "elm,action,indicator,bg_opaque"; source: "elm"; + script { + set_int(indicator_type, INDICATOR_TYPE_BG_OPAQUE); + } + after: "update_indicator"; + } + program { + signal: "elm,action,indicator,bg_transparent"; source: "elm"; + script { + set_int(indicator_type, INDICATOR_TYPE_BG_TRANSPARENT); + } + after: "update_indicator"; + } + program { + signal: "elm,action,indicator,hidden"; source: "elm"; + script { + set_int(indicator_type, INDICATOR_TYPE_HIDDEN); + } + after: "update_indicator"; + } + program { + signal: "elm,action,indicator,show_effect"; source: "elm"; + action: STATE_SET "visible"; + transition: DECELERATE 0.2; + target: "elm.swallow.indicator"; + } + program { + signal: "elm,action,indicator,hide_effect"; source: "elm"; + action: STATE_SET "hidden"; + transition: DECELERATE 0.2; + target: "elm.swallow.indicator"; + } + program { name: "update_indicator"; + script { + if (get_int(indicator_enabled)) { + if ((get_int(indicator_type) == INDICATOR_TYPE_BG_OPAQUE) || + (get_int(indicator_type) == INDICATOR_TYPE_UNKNOWN)) { + set_state(PART:"elm.swallow.indicator", "visible", 0.0); + set_state(PART:"indicator_spacer", "default", 0.0); + set_state(PART:"indicator_bg", "default", 0.0); + } else if (get_int(indicator_type) == INDICATOR_TYPE_BG_TRANSPARENT) { + set_state(PART:"elm.swallow.indicator", "visible", 0.0); + set_state(PART:"indicator_spacer", "default", 0.0); + set_state(PART:"indicator_bg", "bg_transparent", 0.0); + } else if (get_int(indicator_type) == INDICATOR_TYPE_HIDDEN) { + set_state(PART:"elm.swallow.indicator", "hidden", 0.0); + set_state(PART:"indicator_spacer", "hidden", 0.0); + set_state(PART:"indicator_bg", "default", 0.0); + } + } else { + set_state(PART:"elm.swallow.indicator", "default", 0.0); + set_state(PART:"indicator_spacer", "default", 0.0); + } + } + } + /* application desktop menu */ program { name: "show_menu"; signal: "elm,action,show_menu"; source: "elm"; diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 9fdc6b5120..d10ea956d9 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -933,6 +933,7 @@ bin/elementary/test_win_dialog.c \ bin/elementary/test_win_modal.c \ bin/elementary/test_efl_ui_text.c \ bin/elementary/test_win_stack.c \ +bin/elementary/test_win_indicator.c \ bin/elementary/test_gesture_framework.c \ bin/elementary/test.h diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 05fb022d6b..577f600c91 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -307,6 +307,8 @@ void test_dnd_multi_features(void *data, Evas_Object *obj, void *event_info); void test_dnd_types(void *data, Evas_Object *obj, void *event_info); void test_task_switcher(void *data, Evas_Object *obj, void *event_info); void test_win_dialog(void *data, Evas_Object *obj, void *event_info); +void test_win_indicator(void *data, Evas_Object *obj, void *event_info); +void test_win_modal(void *data, Evas_Object *obj, void *event_info); void test_win_modal(void *data, Evas_Object *obj, void *event_info); void test_box_disable(void *data, Evas_Object *obj, void *event_info); void test_layout_disable(void *data, Evas_Object *obj, void *event_info); @@ -748,6 +750,7 @@ add_tests: ADD_TEST(NULL, "Window / Background", "Window Keygrab Set", test_win_keygrab); ADD_TEST(NULL, "Window / Background", "Window Modal", test_win_modal); ADD_TEST(NULL, "Window / Background", "Window Stack", test_win_stack); + ADD_TEST(NULL, "Window / Background", "Window Indicator", test_win_indicator); ADD_TEST_EO(NULL, "Window / Background", "Efl.Ui.Win (Bg part)", test_bg_window); ADD_TEST_EO(NULL, "Window / Background", "Efl.Ui.Bg", test_bg_scale_type); diff --git a/src/bin/elementary/test_win_indicator.c b/src/bin/elementary/test_win_indicator.c new file mode 100644 index 0000000000..d459a9eeab --- /dev/null +++ b/src/bin/elementary/test_win_indicator.c @@ -0,0 +1,122 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include <Elementary.h> + +static void +_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) +{ + printf("Clock value is changed\n"); +} + +static Evas_Object * +_create_indicator(void) +{ + const char *indi_name; + + Eo *win = efl_add(EFL_UI_WIN_SOCKET_CLASS, NULL, + efl_text_set(efl_added, "indicator"), + efl_ui_win_autodel_set(efl_added, EINA_TRUE), + efl_ui_win_alpha_set(efl_added, EINA_TRUE)); + + if (!win) + { + printf("fail to create a portrait indicator window\n"); + return NULL; + } + + indi_name = "elm_indicator_portrait"; + + if (!efl_ui_win_socket_listen(win, indi_name, 0, EINA_FALSE)) + { + printf("failed to listen portrait window socket.\n"); + efl_del(win); + return NULL; + } + + Eo *bx = efl_add(EFL_UI_BOX_CLASS, win, + efl_content_set(win, efl_added)); + + efl_add(EFL_UI_CLOCK_CLASS, bx, + efl_gfx_size_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), + efl_gfx_size_hint_align_set(efl_added, 0.5, 0.5), + efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_HOUR, EINA_FALSE), + efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_MINUTE, EINA_FALSE), + efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_AMPM, EINA_FALSE), + efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_SECOND, EINA_FALSE), + efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_DAY, EINA_FALSE), + efl_ui_clock_pause_set(efl_added, EINA_TRUE), + efl_event_callback_add(efl_added, EFL_UI_CLOCK_EVENT_CHANGED, _changed_cb, NULL), + efl_pack(bx, efl_added)); + + efl_gfx_size_set(win, EINA_SIZE2D(300, 30)); + return win; +} + +static void +_off_clicked(void *data, const Efl_Event *ev EINA_UNUSED) +{ + efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_OFF); +} + +static void +_opaque_clicked(void *data, const Efl_Event *ev EINA_UNUSED) +{ + efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_BG_OPAQUE); +} + +static void +_transparent_clicked(void *data, const Efl_Event *ev EINA_UNUSED) +{ + efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_BG_TRANSPARENT); +} + +static void +_hidden_clicked(void *data, const Efl_Event *ev EINA_UNUSED) +{ + efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_HIDDEN); +} + +static void +_win_del(void *data, const Efl_Event *ev EINA_UNUSED) +{ + efl_del(data); +} + +void +test_win_indicator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Eo *win, *indicator; + + indicator = _create_indicator(); + + // FIXME: Resizing window should no cause sizing issues! + win = efl_add(EFL_UI_WIN_CLASS, NULL, + efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC), + efl_text_set(efl_added, "Efl.Win.Indicator"), + efl_gfx_size_hint_max_set(efl_added, EINA_SIZE2D(300, -1)), + efl_ui_win_autodel_set(efl_added, EINA_TRUE)); + efl_event_callback_add(win, EFL_EVENT_DEL, _win_del, indicator); + efl_gfx_size_set(win, EINA_SIZE2D(300, 360)); + + Eo *bx = efl_add(EFL_UI_BOX_CLASS, win, + efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(300, 0)), + efl_content_set(win, efl_added)); + + efl_add(EFL_UI_BUTTON_CLASS, win, + efl_text_set(efl_added, "Indicator Off"), + efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _off_clicked, win), + efl_pack(bx, efl_added)); + efl_add(EFL_UI_BUTTON_CLASS, win, + efl_text_set(efl_added, "Bg Opaque"), + efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _opaque_clicked, win), + efl_pack(bx, efl_added)); + efl_add(EFL_UI_BUTTON_CLASS, win, + efl_text_set(efl_added, "Bg Transparent"), + efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _transparent_clicked, win), + efl_pack(bx, efl_added)); + efl_add(EFL_UI_BUTTON_CLASS, win, + efl_text_set(efl_added, "Hidden"), + efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _hidden_clicked, win), + efl_pack(bx, efl_added)); +} diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index b238f66297..397ce28ea5 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -30,6 +30,7 @@ #include "elm_part_helper.h" #include "efl_ui_win_part.eo.h" +#include "elm_plug.eo.h" #define MY_CLASS EFL_UI_WIN_CLASS #define MY_CLASS_NAME "Efl.Ui.Win" @@ -85,6 +86,7 @@ struct _Efl_Ui_Win_Data Evas_Object *img_obj, *frame_obj; Eo /* wref */ *bg, *content; Evas_Object *obj; /* The object itself */ + Evas_Object *indicator; #ifdef HAVE_ELEMENTARY_X struct { @@ -116,8 +118,7 @@ struct _Efl_Ui_Win_Data Efl_Ui_Win_Type type; Efl_Ui_Win_Keyboard_Mode kbdmode; - Elm_Win_Indicator_Mode indmode; - Elm_Win_Indicator_Opacity_Mode ind_o_mode; + Efl_Ui_Win_Indicator_Mode indimode; struct { const char *info; @@ -237,6 +238,7 @@ struct _Efl_Ui_Win_Data Eina_Bool need_bg_standard : 1; Eina_Bool need_menu : 1; Eina_Bool need_unresizable : 1; + Eina_Bool need_indicator : 1; Eina_Bool cur_borderless : 1; Eina_Bool cur_shadow : 1; Eina_Bool cur_focus : 1; @@ -245,11 +247,14 @@ struct _Efl_Ui_Win_Data Eina_Bool cur_bg_standard : 1; Eina_Bool cur_menu : 1; Eina_Bool cur_unresizable : 1; + Eina_Bool cur_indicator : 1; Eina_Bool wayland : 1; } csd; struct { Evas_Object *box, *edje; + Elm_Win_Indicator_Mode indmode; + Elm_Win_Indicator_Opacity_Mode ind_o_mode; Eina_Bool forbidden : 1; /**< Marks some legacy APIs as not allowed. */ Eina_Bool bg_must_swallow : 1; /**< Legacy theme compatibility (elm_bg for standard window) */ Eina_Bool bg_must_swallow_init : 1; @@ -2872,6 +2877,7 @@ _efl_ui_win_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Win_Data *sd) eina_stringshare_del(sd->stack_master_id); evas_object_del(sd->icon); evas_object_del(sd->main_menu); + evas_object_del(sd->indicator); sd->focus_highlight.style = NULL; sd->title = NULL; @@ -3441,10 +3447,10 @@ _elm_win_xwin_update(Efl_Ui_Win_Data *sd) } ecore_x_e_virtual_keyboard_state_set (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode); - if (sd->indmode == ELM_WIN_INDICATOR_SHOW) + if (sd->legacy.indmode == ELM_WIN_INDICATOR_SHOW) ecore_x_e_illume_indicator_state_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); - else if (sd->indmode == ELM_WIN_INDICATOR_HIDE) + else if (sd->legacy.indmode == ELM_WIN_INDICATOR_HIDE) ecore_x_e_illume_indicator_state_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); @@ -3770,7 +3776,7 @@ _elm_win_property_change(void *data, { if (e->win == sd->x.xwin) { - sd->indmode = (Elm_Win_Indicator_Mode)ecore_x_e_illume_indicator_state_get(e->win); + sd->legacy.indmode = (Elm_Win_Indicator_Mode)ecore_x_e_illume_indicator_state_get(e->win); efl_event_callback_legacy_call (sd->obj, EFL_UI_WIN_EVENT_INDICATOR_PROP_CHANGED, NULL); } @@ -4429,7 +4435,7 @@ static void _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool calc) { Eina_Bool borderless, maximized, shadow, focus, bg_solid, menu, unresizable, - alpha, bg_standard; + alpha, bg_standard, indicator; Eina_Bool changed = EINA_FALSE; if (!sd->frame_obj) @@ -4455,6 +4461,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool sd->csd.need_borderless = EINA_TRUE; sd->csd.need_unresizable = EINA_TRUE; sd->csd.need_menu = EINA_FALSE; + sd->csd.need_indicator = EINA_FALSE; } else { @@ -4476,6 +4483,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool bg_standard = sd->csd.need_bg_standard; unresizable = sd->csd.need_unresizable; menu = sd->csd.need_menu; + indicator = sd->csd.need_indicator; /* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME * At the moment, E Wayland uses SSD for its internal windows. Which means @@ -4503,6 +4511,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool STATE_SET(bg_standard, "elm,state,background,standard,on", "elm,state,background,standard,off"); STATE_SET(unresizable, "elm,state,unresizable,on", "elm,state,unresizable,off"); STATE_SET(menu, "elm,action,show_menu", "elm,action,hide_menu"); + STATE_SET(indicator, "elm,action,show_indicator", "elm,action,hide_indicator"); #undef STATE_SET @@ -4651,6 +4660,80 @@ _elm_win_need_frame_adjust(Efl_Ui_Win_Data *sd, const char *engine) sd->csd.need = sd->csd.wayland; } +static void +_indicator_resized(void *data, const Efl_Event *event) +{ + ELM_WIN_DATA_GET_OR_RETURN(data, sd); + Evas_Object *indicator = event->object; + Evas_Coord_Size *size = (Evas_Coord_Size *)event->info; + efl_gfx_size_hint_restricted_min_set(indicator, EINA_SIZE2D(size->w, size->h)); + _elm_win_frame_obj_update(sd); +} + +static Evas_Object* +_create_indicator(Evas_Object *obj) +{ + Evas_Object *indicator = NULL; + const char *indicator_serv_name; + + indicator_serv_name = "elm_indicator_portrait"; + if (!indicator_serv_name) + { + ERR("Conformant cannot get portrait indicator service name"); + return NULL; + } + + indicator = elm_plug_add(obj); + if (!indicator) + { + ERR("Conformant cannot create plug to server[%s]", indicator_serv_name); + return NULL; + } + + if (!elm_plug_connect(indicator, indicator_serv_name, 0, EINA_FALSE)) + { + ERR("Conformant cannot connect to server[%s]", indicator_serv_name); + return NULL; + } + + return indicator; +} + +static void +_indicator_add(Efl_Ui_Win_Data *sd) +{ + Eo *obj = sd->obj; + + sd->indicator = _create_indicator(obj); + + if ((!sd->indicator) || + (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.indicator", sd->indicator))) + return; + + efl_event_callback_add + (sd->indicator, ELM_PLUG_EVENT_IMAGE_RESIZED, _indicator_resized, obj); + + efl_canvas_object_is_frame_object_set(sd->indicator, EINA_TRUE); + sd->csd.need_indicator = EINA_TRUE; + + _elm_win_frame_style_update(sd, 0, 1); +} + +static void +_indicator_del(Efl_Ui_Win_Data *sd) +{ + Eo *obj = sd->obj; + + efl_event_callback_del + (sd->indicator, ELM_PLUG_EVENT_IMAGE_RESIZED, _indicator_resized, obj); + + efl_del(sd->indicator); + sd->indicator = NULL; + + sd->csd.need_indicator = EINA_FALSE; + _elm_win_frame_style_update(sd, 0, 1); +} + static Eo * _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_Ui_Win_Type type) { @@ -5052,7 +5135,8 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U _shot_init(sd); sd->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN; - sd->indmode = ELM_WIN_INDICATOR_UNKNOWN; + sd->legacy.indmode = ELM_WIN_INDICATOR_UNKNOWN; + sd->indimode = EFL_UI_WIN_INDICATOR_OFF; #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); @@ -5310,6 +5394,9 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U } _elm_win_frame_add(sd, element, style); + if (sd->indimode != EFL_UI_WIN_INDICATOR_OFF) + _indicator_add(sd); + if (_elm_config->focus_highlight_enable) elm_win_focus_highlight_enabled_set(obj, EINA_TRUE); if (_elm_config->focus_highlight_animate) @@ -6355,32 +6442,37 @@ _efl_ui_win_keyboard_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) } EOLIAN static void -_efl_ui_win_indicator_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd EINA_UNUSED, Eina_Bool enable EINA_UNUSED) +_efl_ui_win_indicator_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Efl_Ui_Win_Indicator_Mode mode) { - //TODO: this mode will be implemented after removing the conformant. - return; -} + sd->legacy.forbidden = EINA_TRUE; + if (sd->indimode == mode) return; + sd->indimode = mode; -EOLIAN static Eina_Bool -_efl_ui_win_indicator_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd EINA_UNUSED) -{ - //TODO: this mode will be implemented after removing the conformant. - return EINA_FALSE; -} + if (sd->indimode == EFL_UI_WIN_INDICATOR_OFF) + { + _indicator_del(sd); + return; + } -EOLIAN static void -_efl_ui_win_indicator_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd EINA_UNUSED, Efl_Ui_Win_Indicator_Type type EINA_UNUSED) -{ - //TODO: this mode will be implemented after removing the conformant. - return; + if (!sd->indicator) _indicator_add(sd); + + if (sd->indimode == EFL_UI_WIN_INDICATOR_BG_OPAQUE) + edje_object_signal_emit(sd->frame_obj, "elm,action,indicator,bg_opaque", "elm"); + else if (sd->indimode == EFL_UI_WIN_INDICATOR_BG_TRANSPARENT) + edje_object_signal_emit(sd->frame_obj, "elm,action,indicator,bg_transparent", "elm"); + else if (sd->indimode == EFL_UI_WIN_INDICATOR_HIDDEN) + edje_object_signal_emit(sd->frame_obj, "elm,action,indicator,hidden", "elm"); + + edje_object_message_signal_process(sd->frame_obj); + evas_object_smart_calculate(sd->frame_obj); + _elm_win_frame_obj_update(sd); } -EOLIAN static Efl_Ui_Win_Indicator_Type -_efl_ui_win_indicator_type_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd EINA_UNUSED) +EOLIAN static Efl_Ui_Win_Indicator_Mode +_efl_ui_win_indicator_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd EINA_UNUSED) { - //TODO: this mode will be implemented after removing the conformant. - - return EFL_UI_WIN_INDICATOR_TYPE_UNKNOWN; + sd->legacy.forbidden = EINA_TRUE; + return sd->indimode; } EOLIAN static Eina_Bool @@ -7523,19 +7615,25 @@ elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode) { Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); if (!sd) return; + if (sd->legacy.forbidden) + { + CRI("Use of this API is forbidden after calling an EO API on this " + "window. Fix your code!"); + return; + } - if (mode == sd->indmode) return; + if (mode == sd->legacy.indmode) return; #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); #endif - sd->indmode = mode; + sd->legacy.indmode = mode; #ifdef HAVE_ELEMENTARY_X if (sd->x.xwin) { - if (sd->indmode == ELM_WIN_INDICATOR_SHOW) + if (sd->legacy.indmode == ELM_WIN_INDICATOR_SHOW) ecore_x_e_illume_indicator_state_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); - else if (sd->indmode == ELM_WIN_INDICATOR_HIDE) + else if (sd->legacy.indmode == ELM_WIN_INDICATOR_HIDE) ecore_x_e_illume_indicator_state_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); } @@ -7549,8 +7647,14 @@ elm_win_indicator_mode_get(const Evas_Object *obj) { Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); if (!sd) return ELM_WIN_INDICATOR_UNKNOWN; + if (sd->legacy.forbidden) + { + CRI("Use of this API is forbidden after calling an EO API on this " + "window. Fix your code!"); + return ELM_WIN_INDICATOR_UNKNOWN; + } - return sd->indmode; + return sd->legacy.indmode; } EAPI void @@ -7558,20 +7662,26 @@ elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode m { Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); if (!sd) return; + if (sd->legacy.forbidden) + { + CRI("Use of this API is forbidden after calling an EO API on this " + "window. Fix your code!"); + return; + } - if (mode == sd->ind_o_mode) return; - sd->ind_o_mode = mode; + if (mode == sd->legacy.ind_o_mode) return; + sd->legacy.ind_o_mode = mode; #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) { - if (sd->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE) + if (sd->legacy.ind_o_mode == ELM_WIN_INDICATOR_OPAQUE) ecore_x_e_illume_indicator_opacity_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE); - else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT) + else if (sd->legacy.ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT) ecore_x_e_illume_indicator_opacity_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT); - else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT) + else if (sd->legacy.ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT) ecore_x_e_illume_indicator_opacity_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT); } @@ -7585,8 +7695,14 @@ elm_win_indicator_opacity_get(const Evas_Object *obj) { Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); if (!sd) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN; + if (sd->legacy.forbidden) + { + CRI("Use of this API is forbidden after calling an EO API on this " + "window. Fix your code!"); + return ELM_WIN_INDICATOR_OPACITY_UNKNOWN; + } - return sd->ind_o_mode; + return sd->legacy.ind_o_mode; } EAPI void diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index 766913bf34..b39fcbba78 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -73,12 +73,12 @@ enum Efl.Ui.Win.Keyboard_Mode j2me [[J2ME keyboard layout]] } -enum Efl.Ui.Win.Indicator_Type +enum Efl.Ui.Win.Indicator_Mode { [[Defines the type indicator that can be shown]] legacy: efl_ui_win_indicator; - type_unknown, [[Unknown indicator type]] + off, [[Request to deactivate the indicator]] bg_opaque, [[The icon of indicator is opaque, the background of indicator is also opaque. The content of window is located the end of indicator. The area of indicator and window content are not overlapped]] @@ -168,8 +168,8 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Canvas.Pointer, Efl.Access.Window, eo_prefix: efl_ui_win; event_prefix: efl_ui_win; methods { - @property indicator_enabled { - [[In some environments, like phones, you may have an indicator that + @property indicator_mode { + [[In some environments, like phones, you may have an indicator that shows battery status, reception, time etc. This is the indicator. Sometimes you don't want it because you provide the same functionality @@ -187,23 +187,7 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Canvas.Pointer, Efl.Access.Window, legacy: null; } values { - enabled: bool; [[If $true, the indicator is enabled, - If $false, the indicator is disabled.]] - } - } - @property indicator_type { - [[The indicator type of the window. - - @since 1.18 - ]] - set { - legacy: null; - } - get { - legacy: null; - } - values { - type: Efl.Ui.Win.Indicator_Type; [[The type, one of #Efl_Ui_Win_Indicator_Type.]] + type: Efl.Ui.Win.Indicator_Mode; [[The mype, one of #Efl_Ui_Win_Indicator_Mode.]] } } @property keyboard_mode { --