summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-13 16:20:01 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-13 16:22:07 +0100
commitb519c44c6716518f750984f7ff0540173fccbc00 (patch)
tree147a04ea1d74a37f6f75cb9c88fee71b9904e9de /src
parentfd9a7983763076e79f482e67abe8b360f9d85719 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_thumb_main.c37
-rw-r--r--src/modules/pager/e_mod_main.c33
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,
55static Eina_Bool _e_ipc_cb_server_data(void *data, 55static Eina_Bool _e_ipc_cb_server_data(void *data,
56 int type, 56 int type,
57 void *event); 57 void *event);
58static Eina_Bool _e_cb_timer(void *data); 58static Eina_Bool _e_cb_idle_enterer(void *data);
59static void _e_thumb_generate(E_Thumb *eth); 59static void _e_thumb_generate(E_Thumb *eth);
60static char *_e_thumb_file_id(char *file, 60static char *_e_thumb_file_id(char *file,
61 char *key, 61 char *key,
@@ -66,9 +66,9 @@ static char *_e_thumb_file_id(char *file,
66 Eina_List *sigsrc); 66 Eina_List *sigsrc);
67 67
68/* local subsystem globals */ 68/* local subsystem globals */
69static Ecore_Idle_Enterer *_idle_enterer = NULL;
69static Ecore_Ipc_Server *_e_ipc_server = NULL; 70static Ecore_Ipc_Server *_e_ipc_server = NULL;
70static Eina_List *_thumblist = NULL; 71static Eina_List *_thumblist = NULL;
71static Ecore_Timer *_timer = NULL;
72static char _thumbdir[4096] = ""; 72static char _thumbdir[4096] = "";
73 73
74/* externally accessible functions */ 74/* externally accessible functions */
@@ -116,7 +116,13 @@ main(int argc,
116 e_user_dir_concat_static(_thumbdir, "fileman/thumbnails"); 116 e_user_dir_concat_static(_thumbdir, "fileman/thumbnails");
117 ecore_file_mkpath(_thumbdir); 117 ecore_file_mkpath(_thumbdir);
118 118
119 if (_e_ipc_init()) ecore_main_loop_begin(); 119 _idle_enterer = ecore_idle_enterer_add(_e_cb_idle_enterer, NULL);
120 if (_idle_enterer)
121 {
122 if (_e_ipc_init()) ecore_main_loop_begin();
123 ecore_idle_enterer_del(_idle_enterer);
124 _idle_enterer = NULL;
125 }
120 126
121 if (_e_ipc_server) 127 if (_e_ipc_server)
122 { 128 {
@@ -240,7 +246,6 @@ _e_ipc_cb_server_data(void *data EINA_UNUSED,
240 eth->sigsrc = sigsrc; 246 eth->sigsrc = sigsrc;
241 if (key) eth->key = strdup(key); 247 if (key) eth->key = strdup(key);
242 _thumblist = eina_list_append(_thumblist, eth); 248 _thumblist = eina_list_append(_thumblist, eth);
243 if (!_timer) _timer = ecore_timer_loop_add(0.001, _e_cb_timer, NULL);
244 } 249 }
245 } 250 }
246 break; 251 break;
@@ -271,13 +276,15 @@ _e_ipc_cb_server_data(void *data EINA_UNUSED,
271 return ECORE_CALLBACK_PASS_ON; 276 return ECORE_CALLBACK_PASS_ON;
272} 277}
273 278
279static void
280_cb_wakeup(void *data EINA_UNUSED)
281{
282}
283
274static Eina_Bool 284static Eina_Bool
275_e_cb_timer(void *data EINA_UNUSED) 285_e_cb_idle_enterer(void *data EINA_UNUSED)
276{ 286{
277 E_Thumb *eth; 287 E_Thumb *eth;
278 /*
279 Eina_List *del_list = NULL, *l;
280 */
281 288
282 /* take thumb at head of list */ 289 /* take thumb at head of list */
283 if (_thumblist) 290 if (_thumblist)
@@ -291,13 +298,9 @@ _e_cb_timer(void *data EINA_UNUSED)
291 free(eth->file); 298 free(eth->file);
292 free(eth->key); 299 free(eth->key);
293 free(eth); 300 free(eth);
294 301 if (_thumblist) ecore_job_add(_cb_wakeup, NULL);
295 if (_thumblist) _timer = ecore_timer_loop_add(0.01, _e_cb_timer, NULL);
296 else _timer = NULL;
297 } 302 }
298 else 303 return ECORE_CALLBACK_RENEW;
299 _timer = NULL;
300 return ECORE_CALLBACK_CANCEL;
301} 304}
302 305
303typedef struct _Color Color; 306typedef struct _Color Color;
@@ -322,7 +325,11 @@ _e_thumb_generate(E_Thumb *eth)
322 const unsigned int *data = NULL; 325 const unsigned int *data = NULL;
323 time_t mtime_orig, mtime_thumb; 326 time_t mtime_orig, mtime_thumb;
324 327
325 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); 328 id = _e_thumb_file_id(eth->file, eth->key,
329 0, 0, 1, 1,
330// eth->desk_x, eth->desk_y,
331// eth->desk_x_count, eth->desk_y_count,
332 eth->sigsrc);
326 if (!id) return; 333 if (!id) return;
327 334
328 td = strdup(id); 335 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
132static void _pager_desk_cb_drag_finished(E_Drag *drag, int dropped); 132static void _pager_desk_cb_drag_finished(E_Drag *drag, int dropped);
133static void _pager_desk_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); 133static void _pager_desk_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
134static Eina_Bool _pager_popup_cb_timeout(void *data); 134static Eina_Bool _pager_popup_cb_timeout(void *data);
135static Pager *_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc); 135static Pager *_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc, Instance *inst);
136static void _pager_free(Pager *p); 136static void _pager_free(Pager *p);
137static void _pager_fill(Pager *p, E_Gadcon *gc); 137static void _pager_fill(Pager *p, E_Gadcon *gc);
138static void _pager_empty(Pager *p); 138static void _pager_empty(Pager *p);
@@ -169,6 +169,7 @@ static int hold_count = 0;
169static int hold_mod = 0; 169static int hold_mod = 0;
170static E_Desk *current_desk = NULL; 170static E_Desk *current_desk = NULL;
171static Eina_List *pagers = NULL; 171static Eina_List *pagers = NULL;
172static double _pager_start_time = 0.0;
172 173
173EINTERN E_Module *module; 174EINTERN E_Module *module;
174EINTERN E_Config_Dialog *config_dialog; 175EINTERN E_Config_Dialog *config_dialog;
@@ -218,9 +219,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
218 219
219 inst = E_NEW(Instance, 1); 220 inst = E_NEW(Instance, 1);
220 221
221 p = _pager_new(gc->evas, gc->zone, gc); 222 p = _pager_new(gc->evas, gc->zone, gc, inst);
222 p->inst = inst;
223 inst->pager = p;
224 o = p->o_table; 223 o = p->o_table;
225 gcc = e_gadcon_client_new(gc, name, id, style, o); 224 gcc = e_gadcon_client_new(gc, name, id, style, o);
226 gcc->data = inst; 225 gcc->data = inst;
@@ -262,7 +261,7 @@ _gc_shutdown(E_Gadcon_Client *gcc)
262} 261}
263 262
264static void 263static void
265_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED) 264_aspect(E_Gadcon_Client *gcc)
266{ 265{
267 Instance *inst; 266 Instance *inst;
268 int aspect_w, aspect_h; 267 int aspect_w, aspect_h;
@@ -289,6 +288,12 @@ _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
289 e_gadcon_client_min_size_set(gcc, 4, 4 * aspect_ratio); 288 e_gadcon_client_min_size_set(gcc, 4, 4 * aspect_ratio);
290} 289}
291 290
291static void
292_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
293{
294 _aspect(gcc);
295}
296
292static const char * 297static const char *
293_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED) 298_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
294{ 299{
@@ -347,6 +352,7 @@ _pager_recalc(void *data)
347 e_gadcon_client_aspect_set(p->inst->gcc, p->ynum * w, p->xnum * h); 352 e_gadcon_client_aspect_set(p->inst->gcc, p->ynum * w, p->xnum * h);
348 else 353 else
349 e_gadcon_client_aspect_set(p->inst->gcc, p->xnum * w, p->ynum * h); 354 e_gadcon_client_aspect_set(p->inst->gcc, p->xnum * w, p->ynum * h);
355 _aspect(p->inst->gcc);
350 } 356 }
351} 357}
352 358
@@ -360,15 +366,16 @@ _pager_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
360} 366}
361 367
362static Pager * 368static Pager *
363_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc) 369_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc, Instance *inst)
364{ 370{
365 Pager *p; 371 Pager *p;
366 372
367 p = E_NEW(Pager, 1); 373 p = E_NEW(Pager, 1);
368 p->inst = NULL; 374 p->inst = inst;
369 p->popup = NULL; 375 if (inst) inst->pager = p;
370 p->o_table = elm_table_add(e_win_evas_win_get(evas)); 376 p->o_table = elm_table_add(e_win_evas_win_get(evas));
371 evas_object_event_callback_add(p->o_table, EVAS_CALLBACK_RESIZE, _pager_resize, p); 377 evas_object_event_callback_add(p->o_table, EVAS_CALLBACK_RESIZE,
378 _pager_resize, p);
372 elm_table_homogeneous_set(p->o_table, 1); 379 elm_table_homogeneous_set(p->o_table, 1);
373 p->zone = zone; 380 p->zone = zone;
374 _pager_fill(p, gc); 381 _pager_fill(p, gc);
@@ -760,7 +767,7 @@ _pager_popup_new(E_Zone *zone, int keyaction)
760 767
761 /* Show popup */ 768 /* Show popup */
762 769
763 pp->pager = _pager_new(e_comp->evas, zone, NULL); 770 pp->pager = _pager_new(e_comp->evas, zone, NULL, NULL);
764 771
765 pp->pager->popup = pp; 772 pp->pager->popup = pp;
766 pp->urgent = 0; 773 pp->urgent = 0;
@@ -1040,7 +1047,8 @@ _pager_cb_event_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
1040 edje_object_part_text_set(p->popup->o_bg, "e.text.label", ev->desk->name); 1047 edje_object_part_text_set(p->popup->o_bg, "e.text.label", ev->desk->name);
1041 } 1048 }
1042 1049
1043 if ((pager_config->popup) && (!act_popup)) 1050 if ((pager_config->popup) && (!act_popup) &&
1051 ((ecore_time_get() - _pager_start_time) > 0.5)) //. not at start
1044 { 1052 {
1045 if ((pp = _pager_popup_find(ev->desk->zone))) 1053 if ((pp = _pager_popup_find(ev->desk->zone)))
1046 evas_object_show(pp->popup); 1054 evas_object_show(pp->popup);
@@ -1049,7 +1057,7 @@ _pager_cb_event_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
1049 if (pp->timer) 1057 if (pp->timer)
1050 ecore_timer_loop_reset(pp->timer); 1058 ecore_timer_loop_reset(pp->timer);
1051 else 1059 else
1052 pp->timer = ecore_timer_loop_add(pager_config->popup_speed, 1060 pp->timer = ecore_timer_add(pager_config->popup_speed,
1053 _pager_popup_cb_timeout, pp); 1061 _pager_popup_cb_timeout, pp);
1054 } 1062 }
1055 1063
@@ -2082,6 +2090,7 @@ e_modapi_init(E_Module *m)
2082{ 2090{
2083 E_Module *p; 2091 E_Module *p;
2084 2092
2093 _pager_start_time = ecore_time_get();
2085 e_modapi_gadget_init(m); 2094 e_modapi_gadget_init(m);
2086 p = e_module_find("pager_plain"); 2095 p = e_module_find("pager_plain");
2087 if (p && p->enabled) 2096 if (p && p->enabled)