From b519c44c6716518f750984f7ff0540173fccbc00 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 13 Jun 2020 16:20:01 +0100 Subject: [PATCH] pager+thumb - speed up thumb generation and pager aspect pager didnt reset aspect after setting min size. fixed. also improve thumb generation by having no artifical delays. use idle enterer + job wakeups instead. now thumbs appear almost instantly. also remove initial pager popup on starup that is just not needed. fixes T8314 @fix --- src/bin/e_thumb_main.c | 37 ++++++++++++++++++++-------------- src/modules/pager/e_mod_main.c | 33 +++++++++++++++++++----------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/bin/e_thumb_main.c b/src/bin/e_thumb_main.c index 15385291a..7ba1ed0cd 100644 --- a/src/bin/e_thumb_main.c +++ b/src/bin/e_thumb_main.c @@ -55,7 +55,7 @@ static Eina_Bool _e_ipc_cb_server_del(void *data, static Eina_Bool _e_ipc_cb_server_data(void *data, int type, void *event); -static Eina_Bool _e_cb_timer(void *data); +static Eina_Bool _e_cb_idle_enterer(void *data); static void _e_thumb_generate(E_Thumb *eth); static char *_e_thumb_file_id(char *file, char *key, @@ -66,9 +66,9 @@ static char *_e_thumb_file_id(char *file, Eina_List *sigsrc); /* local subsystem globals */ +static Ecore_Idle_Enterer *_idle_enterer = NULL; static Ecore_Ipc_Server *_e_ipc_server = NULL; static Eina_List *_thumblist = NULL; -static Ecore_Timer *_timer = NULL; static char _thumbdir[4096] = ""; /* externally accessible functions */ @@ -116,7 +116,13 @@ main(int argc, e_user_dir_concat_static(_thumbdir, "fileman/thumbnails"); ecore_file_mkpath(_thumbdir); - if (_e_ipc_init()) ecore_main_loop_begin(); + _idle_enterer = ecore_idle_enterer_add(_e_cb_idle_enterer, NULL); + if (_idle_enterer) + { + if (_e_ipc_init()) ecore_main_loop_begin(); + ecore_idle_enterer_del(_idle_enterer); + _idle_enterer = NULL; + } if (_e_ipc_server) { @@ -240,7 +246,6 @@ _e_ipc_cb_server_data(void *data EINA_UNUSED, eth->sigsrc = sigsrc; if (key) eth->key = strdup(key); _thumblist = eina_list_append(_thumblist, eth); - if (!_timer) _timer = ecore_timer_loop_add(0.001, _e_cb_timer, NULL); } } break; @@ -271,13 +276,15 @@ _e_ipc_cb_server_data(void *data EINA_UNUSED, return ECORE_CALLBACK_PASS_ON; } +static void +_cb_wakeup(void *data EINA_UNUSED) +{ +} + static Eina_Bool -_e_cb_timer(void *data EINA_UNUSED) +_e_cb_idle_enterer(void *data EINA_UNUSED) { E_Thumb *eth; - /* - Eina_List *del_list = NULL, *l; - */ /* take thumb at head of list */ if (_thumblist) @@ -291,13 +298,9 @@ _e_cb_timer(void *data EINA_UNUSED) free(eth->file); free(eth->key); free(eth); - - if (_thumblist) _timer = ecore_timer_loop_add(0.01, _e_cb_timer, NULL); - else _timer = NULL; + if (_thumblist) ecore_job_add(_cb_wakeup, NULL); } - else - _timer = NULL; - return ECORE_CALLBACK_CANCEL; + return ECORE_CALLBACK_RENEW; } typedef struct _Color Color; @@ -322,7 +325,11 @@ _e_thumb_generate(E_Thumb *eth) const unsigned int *data = NULL; time_t mtime_orig, mtime_thumb; - id = _e_thumb_file_id(eth->file, eth->key, eth->desk_x, eth->desk_y, eth->desk_x_count, eth->desk_y_count, eth->sigsrc); + id = _e_thumb_file_id(eth->file, eth->key, + 0, 0, 1, 1, +// eth->desk_x, eth->desk_y, +// eth->desk_x_count, eth->desk_y_count, + eth->sigsrc); if (!id) return; td = strdup(id); diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index a99be300b..4a81aec99 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -132,7 +132,7 @@ static void _pager_desk_cb_mouse_move(void *data, Evas *e EINA_UNUSE static void _pager_desk_cb_drag_finished(E_Drag *drag, int dropped); static void _pager_desk_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); static Eina_Bool _pager_popup_cb_timeout(void *data); -static Pager *_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc); +static Pager *_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc, Instance *inst); static void _pager_free(Pager *p); static void _pager_fill(Pager *p, E_Gadcon *gc); static void _pager_empty(Pager *p); @@ -169,6 +169,7 @@ static int hold_count = 0; static int hold_mod = 0; static E_Desk *current_desk = NULL; static Eina_List *pagers = NULL; +static double _pager_start_time = 0.0; EINTERN E_Module *module; EINTERN E_Config_Dialog *config_dialog; @@ -218,9 +219,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) inst = E_NEW(Instance, 1); - p = _pager_new(gc->evas, gc->zone, gc); - p->inst = inst; - inst->pager = p; + p = _pager_new(gc->evas, gc->zone, gc, inst); o = p->o_table; gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; @@ -262,7 +261,7 @@ _gc_shutdown(E_Gadcon_Client *gcc) } static void -_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED) +_aspect(E_Gadcon_Client *gcc) { Instance *inst; int aspect_w, aspect_h; @@ -289,6 +288,12 @@ _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED) e_gadcon_client_min_size_set(gcc, 4, 4 * aspect_ratio); } +static void +_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED) +{ + _aspect(gcc); +} + static const char * _gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED) { @@ -347,6 +352,7 @@ _pager_recalc(void *data) e_gadcon_client_aspect_set(p->inst->gcc, p->ynum * w, p->xnum * h); else e_gadcon_client_aspect_set(p->inst->gcc, p->xnum * w, p->ynum * h); + _aspect(p->inst->gcc); } } @@ -360,15 +366,16 @@ _pager_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi } static Pager * -_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc) +_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc, Instance *inst) { Pager *p; p = E_NEW(Pager, 1); - p->inst = NULL; - p->popup = NULL; + p->inst = inst; + if (inst) inst->pager = p; p->o_table = elm_table_add(e_win_evas_win_get(evas)); - evas_object_event_callback_add(p->o_table, EVAS_CALLBACK_RESIZE, _pager_resize, p); + evas_object_event_callback_add(p->o_table, EVAS_CALLBACK_RESIZE, + _pager_resize, p); elm_table_homogeneous_set(p->o_table, 1); p->zone = zone; _pager_fill(p, gc); @@ -760,7 +767,7 @@ _pager_popup_new(E_Zone *zone, int keyaction) /* Show popup */ - pp->pager = _pager_new(e_comp->evas, zone, NULL); + pp->pager = _pager_new(e_comp->evas, zone, NULL, NULL); pp->pager->popup = pp; pp->urgent = 0; @@ -1040,7 +1047,8 @@ _pager_cb_event_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev edje_object_part_text_set(p->popup->o_bg, "e.text.label", ev->desk->name); } - if ((pager_config->popup) && (!act_popup)) + if ((pager_config->popup) && (!act_popup) && + ((ecore_time_get() - _pager_start_time) > 0.5)) //. not at start { if ((pp = _pager_popup_find(ev->desk->zone))) evas_object_show(pp->popup); @@ -1049,7 +1057,7 @@ _pager_cb_event_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev if (pp->timer) ecore_timer_loop_reset(pp->timer); else - pp->timer = ecore_timer_loop_add(pager_config->popup_speed, + pp->timer = ecore_timer_add(pager_config->popup_speed, _pager_popup_cb_timeout, pp); } @@ -2082,6 +2090,7 @@ e_modapi_init(E_Module *m) { E_Module *p; + _pager_start_time = ecore_time_get(); e_modapi_gadget_init(m); p = e_module_find("pager_plain"); if (p && p->enabled)