From ef43d6bd4cc5cabd4111daaca9c696a8c596b5d3 Mon Sep 17 00:00:00 2001 From: Stephen 'Okra' Houston Date: Fri, 1 Sep 2017 13:51:13 -0500 Subject: [PATCH] Luncher: Remove the engage feature The engage feature was mainly there as a demo of the capabilities of bryce. Now that we are nearing release we need to clean up our gadgets. The engage style for the luncher gadget is not complete, and does not work adequately, and quite honestly better belongs as a feature of bryce itself not luncher. --- src/modules/luncher/bar.c | 155 ++++------------------------------ src/modules/luncher/config.c | 73 ---------------- src/modules/luncher/grid.c | 1 - src/modules/luncher/luncher.h | 5 -- src/modules/luncher/mod.c | 3 - 5 files changed, 17 insertions(+), 220 deletions(-) diff --git a/src/modules/luncher/bar.c b/src/modules/luncher/bar.c index cf1fbcd44..4cd7da4cc 100644 --- a/src/modules/luncher/bar.c +++ b/src/modules/luncher/bar.c @@ -5,32 +5,22 @@ static Eina_Bool _bar_icon_preview_hide(void *data); static void _bar_icon_del(Instance *inst, Icon *ic); static void _bar_exec_new_show(void *data, Evas *e, Evas_Object *obj, void *event_data); -static float -_bar_size_calc(Instance *inst) -{ - Icon *ic; - Eina_List *l; - float tot = 0.0; - - EINA_LIST_FOREACH(inst->icons, l, ic) - tot += ic->scale; - - return tot; -} - static void _bar_aspect(Instance *inst) { - float tot = _bar_size_calc(inst); + Evas_Coord w, h; switch (e_gadget_site_orient_get(e_gadget_site_get(inst->o_main))) { case E_GADGET_SITE_ORIENT_VERTICAL: - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, ceil(tot)); + h = eina_list_count(inst->icons); + w = 1; break; default: - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, ceil(tot), 1); + w = eina_list_count(inst->icons); + h = 1; } + evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); } static Eina_Bool @@ -470,6 +460,8 @@ _bar_icon_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *eve { Icon *ic = data; + elm_layout_signal_emit(ic->o_layout, "e,state,default", "e"); + elm_layout_signal_emit(ic->o_layout, "e,state,unfocused", "e"); ic->active = EINA_FALSE; elm_object_tooltip_hide(obj); E_FREE_FUNC(ic->mouse_in_timer, ecore_timer_del); @@ -488,42 +480,8 @@ _bar_icon_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS if (_bar_check_modifiers(ev->modifiers)) return; if (!ic->drag.start) - { - Icon *ico = NULL; - Eina_List *l = NULL; - Evas_Coord px, py; - const char *position = _bar_location_get(ic->inst); - int pos; + return; - if (eina_streq(position, "left")) - pos = 0; - else if (eina_streq(position, "top")) - pos = 1; - else if (eina_streq(position, "right")) - pos = 2; - else - pos = 3; - - evas_pointer_canvas_xy_get(evas_object_evas_get(ic->inst->o_main), &px, &py); - EINA_LIST_FOREACH(ic->inst->icons, l, ico) - { - Edje_Message_Int_Set *msg; - Evas_Coord x, y, w, h; - - evas_object_geometry_get(ico->o_icon, &x, &y, &w, &h); - msg = alloca(sizeof(Edje_Message_Int_Set) + (7 * sizeof(int))); - msg->count = 7; - msg->val[0] = px; - msg->val[1] = py; - msg->val[2] = x; - msg->val[3] = y; - msg->val[4] = w; - msg->val[5] = h; - msg->val[6] = pos; - edje_object_message_send(elm_layout_edje_get(ico->o_layout), EDJE_MESSAGE_INT_SET, 2, msg); - } - return; - } dx = ev->cur.output.x - ic->drag.x; dy = ev->cur.output.y - ic->drag.y; if (((dx * dx) + (dy * dy)) > @@ -962,9 +920,12 @@ _bar_icon_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *even if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if (_bar_check_modifiers(ev->modifiers)) return; - elm_object_tooltip_show(obj); - ic->active = EINA_TRUE; - + if (!ic->active) + { + elm_object_tooltip_show(obj); + ic->active = EINA_TRUE; + elm_layout_signal_emit(ic->o_layout, "e,state,focused", "e"); + } E_FREE_FUNC(ic->mouse_out_timer, ecore_timer_del); E_FREE_FUNC(ic->mouse_in_timer, ecore_timer_del); if (eina_list_count(ic->execs) || eina_list_count(ic->clients)) @@ -1110,56 +1071,8 @@ static void _bar_resized_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { Instance *inst = data; - float tot = _bar_size_calc(inst); - switch (e_gadget_site_orient_get(e_gadget_site_get(inst->o_main))) - { - case E_GADGET_SITE_ORIENT_VERTICAL: - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, ceil(tot)); - break; - default: - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, ceil(tot), 1); - } -} - -static void -_bar_icon_scale_message(void *data, Evas_Object *obj EINA_UNUSED, Edje_Message_Type type EINA_UNUSED, int id EINA_UNUSED, void *msg) -{ - Edje_Message_String_Float_Set *mmsg = msg; - Evas_Coord add = 0, w, h; - Icon *ic = data; - double total = 0.0; - - ic->scale = mmsg->val[0]; - if (ic->scale > 1.0) - { - evas_object_geometry_get(ic->o_layout, 0, 0, &w, &h); - switch (e_gadget_site_orient_get(e_gadget_site_get(ic->inst->o_main))) - { - case E_GADGET_SITE_ORIENT_VERTICAL: - total = (((double)h * (double)ic->scale) - (double)h); - add = ceil(total / 2.0); - evas_object_resize(ic->o_spacerb, w, add); - evas_object_size_hint_min_set(ic->o_spacerb, w, add); - evas_object_resize(ic->o_spacera, w, add); - evas_object_size_hint_min_set(ic->o_spacera, w, add); - break; - default: - total = (((double)w * (double)ic->scale) - (double)w); - add = ceil(total / 2.0); - evas_object_resize(ic->o_spacerb, add, h); - evas_object_size_hint_min_set(ic->o_spacerb, add, h); - evas_object_resize(ic->o_spacera, add, h); - evas_object_size_hint_min_set(ic->o_spacera, add, h); - } - } - else - { - evas_object_resize(ic->o_spacerb, 0, 0); - evas_object_resize(ic->o_spacera, 0, 0); - evas_object_size_hint_min_set(ic->o_spacerb, 0, 0); - evas_object_size_hint_min_set(ic->o_spacera, 0, 0); - } + _bar_aspect(inst); } static Icon * @@ -1168,7 +1081,6 @@ _bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_cli char ori[32]; Icon *ic; const Eina_List *l; - Edje_Message_String *msg; ic = E_NEW(Icon, 1); if (desktop) @@ -1184,38 +1096,19 @@ _bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_cli ic->starting = EINA_FALSE; ic->preview_dismissed = EINA_FALSE; ic->exec = NULL; - ic->scale = 1.0; ic->o_layout = elm_layout_add(inst->o_icon_con); + edje_object_update_hints_set(elm_layout_edje_get(ic->o_layout), EINA_TRUE); e_theme_edje_object_set(ic->o_layout, "e/gadget/luncher/icon", "e/gadget/luncher/icon"); E_EXPAND(ic->o_layout); E_FILL(ic->o_layout); edje_object_signal_callback_add(elm_layout_edje_get(ic->o_layout), "e,state,resized", "e", _bar_resized_cb, inst); - edje_object_message_handler_set(elm_layout_edje_get(ic->o_layout), _bar_icon_scale_message, ic); elm_box_pack_end(inst->o_icon_con, ic->o_layout); evas_object_show(ic->o_layout); - ic->o_spacerb = evas_object_rectangle_add(evas_object_evas_get(ic->inst->o_icon_con)); - ic->o_spacera = evas_object_rectangle_add(evas_object_evas_get(ic->inst->o_icon_con)); - evas_object_color_set(ic->o_spacerb, 0, 0, 0, 0); - evas_object_color_set(ic->o_spacera, 0, 0, 0, 0); - evas_object_resize(ic->o_spacerb, 0, 0); - evas_object_resize(ic->o_spacera, 0, 0); - evas_object_size_hint_min_set(ic->o_spacerb, 0, 0); - evas_object_size_hint_min_set(ic->o_spacera, 0, 0); - elm_box_pack_before(inst->o_icon_con, ic->o_spacerb, ic->o_layout); - elm_box_pack_after(inst->o_icon_con, ic->o_spacera, ic->o_layout); - evas_object_show(ic->o_spacerb); - evas_object_show(ic->o_spacera); - snprintf(ori, sizeof(ori), "e,state,off,%s", _bar_location_get(inst)); elm_layout_signal_emit(ic->o_layout, ori, "e"); - msg = alloca(sizeof(Edje_Message_String)); - if (inst->cfg->style) - msg->str = strdup(inst->cfg->style); - edje_object_message_send(elm_layout_edje_get(ic->o_layout), EDJE_MESSAGE_STRING, 1, msg); - free(msg->str); ic->o_icon = elm_icon_add(ic->o_layout); E_EXPAND(ic->o_icon); @@ -1246,10 +1139,6 @@ _bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_cli _bar_icon_mouse_down, ic); evas_object_event_callback_add(ic->o_icon, EVAS_CALLBACK_MOUSE_MOVE, _bar_icon_mouse_move, ic); - evas_object_event_callback_add(ic->o_spacera, EVAS_CALLBACK_MOUSE_MOVE, - _bar_icon_mouse_move, ic); - evas_object_event_callback_add(ic->o_spacerb, EVAS_CALLBACK_MOUSE_MOVE, - _bar_icon_mouse_move, ic); evas_object_event_callback_add(ic->o_icon, EVAS_CALLBACK_MOUSE_IN, _bar_icon_mouse_in, ic); evas_object_event_callback_add(ic->o_icon, EVAS_CALLBACK_MOUSE_OUT, @@ -1751,13 +1640,8 @@ _bar_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo EINA_LIST_FOREACH(inst->icons, l, ic) { - ic->scale = 1.0; elm_layout_signal_emit(ic->o_layout, "e,state,default", "e"); elm_layout_signal_emit(ic->o_layout, "e,state,unfocused", "e"); - evas_object_resize(ic->o_spacera, 0, 0); - evas_object_resize(ic->o_spacerb, 0, 0); - evas_object_size_hint_min_set(ic->o_spacera, 0, 0); - evas_object_size_hint_min_set(ic->o_spacerb, 0, 0); _bar_icon_mouse_out(ic, NULL, ic->o_icon, NULL); } _bar_aspect(inst); @@ -1776,7 +1660,6 @@ _bar_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data) E_FREE_FUNC(inst->iconify_provider, e_comp_object_effect_mover_del); luncher_config->items = eina_list_remove(luncher_config->items, inst->cfg); - eina_stringshare_del(inst->cfg->style); eina_stringshare_del(inst->cfg->dir); E_FREE(inst->cfg); } @@ -1994,9 +1877,6 @@ _bar_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) else eina_strlcpy(buf, inst->cfg->dir, sizeof(buf)); - if (!inst->cfg->style) - inst->cfg->style = eina_stringshare_add("default"); - inst->order = e_order_new(buf); e_order_update_callback_set(inst->order, _bar_order_update, inst); @@ -2040,7 +1920,6 @@ _conf_item_get(int *id) ci->id = -1; ci->preview_size = 64; ci->dir = eina_stringshare_add("default"); - ci->style = eina_stringshare_add("default"); ci->type = E_LUNCHER_MODULE_FULL; luncher_config->items = eina_list_append(luncher_config->items, ci); diff --git a/src/modules/luncher/config.c b/src/modules/luncher/config.c index 92087c17b..c4043c0a4 100644 --- a/src/modules/luncher/config.c +++ b/src/modules/luncher/config.c @@ -14,7 +14,6 @@ static void _config_show_general(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { evas_object_hide(luncher_config->contents); - evas_object_hide(luncher_config->style); evas_object_show(luncher_config->general); } @@ -22,18 +21,9 @@ static void _config_show_contents(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { evas_object_hide(luncher_config->general); - evas_object_hide(luncher_config->style); evas_object_show(luncher_config->contents); } -static void -_config_show_style(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - evas_object_hide(luncher_config->general); - evas_object_hide(luncher_config->contents); - evas_object_show(luncher_config->style); -} - static void _type_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { @@ -59,20 +49,6 @@ _type_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) bar_config_updated(inst); } -static void -_config_style_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Instance *inst = data; - const char *style = elm_object_item_text_get(elm_list_selected_item_get(luncher_config->slist)); - - if (eina_streq(inst->cfg->style, style)) - return; - if (inst->cfg->style) eina_stringshare_del(inst->cfg->style); - inst->cfg->style = NULL; - inst->cfg->style = eina_stringshare_ref(style); - bar_reorder(inst); -} - static void _config_source_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -87,35 +63,6 @@ _config_source_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_inf bar_reorder(inst); } -static void -_config_populate_style_list(Evas_Object *list, Instance *inst) -{ - const char *str = edje_object_data_get(elm_layout_edje_get(inst->o_main), "styles"); - const char *s, *b; - Elm_Object_Item *it; - - if (!str) return; - for (b = s = str; 1; s++) - { - if ((*s == ' ') || (!*s)) - { - char *t = malloc(s - b + 1); - if (t) - { - strncpy(t, b, s - b); - t[s - b] = 0; - it = elm_list_item_append(list, t, NULL, NULL, _config_style_changed, inst); - printf("%s x %s\n", inst->cfg->style, t); - if ((inst->cfg->style) && (eina_streq(inst->cfg->style, t))) - elm_list_item_selected_set(it, EINA_TRUE); - free(t); - } - b = s + 1; - } - if (!*s) break; - } -} - static void _config_populate_order_list(Evas_Object *list, Instance *inst) { @@ -365,8 +312,6 @@ config_luncher(E_Zone *zone, Instance *inst, Eina_Bool bar) elm_list_item_selected_set(it, 1); it = elm_list_item_append(mlist, _("Contents"), NULL, NULL, _config_show_contents, inst); - it = elm_list_item_append(mlist, _("Style"), NULL, NULL, - _config_show_style, inst); elm_list_go(mlist); evas_object_show(mlist); @@ -464,24 +409,6 @@ config_luncher(E_Zone *zone, Instance *inst, Eina_Bool bar) elm_object_content_set(fr, box); - fr = elm_frame_add(tb); - elm_object_text_set(fr, _("Style")); - E_EXPAND(fr); - evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_table_pack(tb, fr, 1, 1, 1, 1); - evas_object_show(fr); - luncher_config->style = fr; - - list = elm_list_add(fr); - E_ALIGN(list, EVAS_HINT_FILL, EVAS_HINT_FILL); - E_WEIGHT(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_content_set(fr, list); - elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_scroller_content_min_limit(list, 1, 1); - evas_object_show(list); - luncher_config->slist = list; - _config_populate_style_list(list, inst); - fr = elm_frame_add(tb); elm_object_text_set(fr, _("Contents")); E_EXPAND(fr); diff --git a/src/modules/luncher/grid.c b/src/modules/luncher/grid.c index 8d98cac97..d3e26a82c 100644 --- a/src/modules/luncher/grid.c +++ b/src/modules/luncher/grid.c @@ -646,7 +646,6 @@ _conf_item_get(int *id) else ci->id = -1; ci->dir = eina_stringshare_add("default"); - ci->style = NULL; luncher_config->items = eina_list_append(luncher_config->items, ci); return ci; diff --git a/src/modules/luncher/luncher.h b/src/modules/luncher/luncher.h index f33625c55..ba2b4e252 100644 --- a/src/modules/luncher/luncher.h +++ b/src/modules/luncher/luncher.h @@ -32,7 +32,6 @@ struct _Config Evas_Object *list; Evas_Object *general; Evas_Object *contents; - Evas_Object *style; Eina_Bool bar; }; @@ -41,7 +40,6 @@ struct _Config_Item int id; int version; int preview_size; - Eina_Stringshare *style; Eina_Stringshare *dir; Luncher_Type type; }; @@ -74,8 +72,6 @@ struct _Icon Instance *inst; Evas_Object *o_layout; Evas_Object *o_icon; - Evas_Object *o_spacera; - Evas_Object *o_spacerb; Evas_Object *preview; Evas_Object *preview_box; Evas_Object *preview_scroller; @@ -93,7 +89,6 @@ struct _Icon Eina_Bool active; Eina_Bool starting; Eina_Bool preview_dismissed; - double scale; struct { unsigned char start : 1; diff --git a/src/modules/luncher/mod.c b/src/modules/luncher/mod.c index 919d63f55..78a9b3502 100644 --- a/src/modules/luncher/mod.c +++ b/src/modules/luncher/mod.c @@ -21,7 +21,6 @@ luncher_init(void) E_CONFIG_VAL(D, T, id, INT); E_CONFIG_VAL(D, T, version, INT); E_CONFIG_VAL(D, T, preview_size, INT); - E_CONFIG_VAL(D, T, style, STR); E_CONFIG_VAL(D, T, dir, STR); E_CONFIG_VAL(D, T, type, INT); @@ -41,7 +40,6 @@ luncher_init(void) ci->id = 0; ci->version = CONFIG_VERSION; ci->preview_size = 64; - ci->style = eina_stringshare_add("default"); ci->dir = eina_stringshare_add("default"); ci->type = E_LUNCHER_MODULE_FULL; luncher_config->items = eina_list_append(luncher_config->items, ci); @@ -66,7 +64,6 @@ luncher_shutdown(void) Config_Item *ci; EINA_LIST_FREE(luncher_config->items, ci) { - eina_stringshare_del(ci->style); eina_stringshare_del(ci->dir); free(ci); }