illogict pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=b4a58ad874bb1f0f9dfb85fdcb38f781f3b42d37
commit b4a58ad874bb1f0f9dfb85fdcb38f781f3b42d37 Author: Chidambar Zinnoury <chidambar.zinno...@zefla.fr> Date: Mon Apr 21 21:54:15 2014 +0200 Bugfix: e fileman: Correct automagic window size computation. When available width is less than minimum width, the height was computed according to the available width, but the window width was effectively the minimum width: its height was thus more than needed. The function now takes the minimum dimensions so that correct height and width are computed. --- src/bin/e_fm.c | 25 +++++++++++++++---------- src/bin/e_fm.h | 2 +- src/modules/fileman/e_fwin.c | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 0028ae2..7d5c20a 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -11470,34 +11470,39 @@ e_fm2_operation_abort(int id) } EAPI Eina_Bool -e_fm2_optimal_size_calc(Evas_Object *obj, int maxw, int maxh, int *w, int *h) +e_fm2_optimal_size_calc(Evas_Object *obj, int minw, int minh, int maxw, int maxh, int *w, int *h) { - int x, y, minw, minh; + int x, y, step_w, step_h; EFM_SMART_CHECK(EINA_FALSE); if ((!w) || (!h)) return EINA_FALSE; if (!sd->icons) return EINA_FALSE; if (maxw < 0) maxw = 0; if (maxh < 0) maxh = 0; - minw = sd->min.w + 5, minh = sd->min.h + 5; + step_w = sd->min.w + 5, step_h = sd->min.h + 5; switch (_e_fm2_view_mode_get(sd)) { case E_FM2_VIEW_MODE_LIST: - *w = MIN(minw, maxw); - *h = MIN(minh * eina_list_count(sd->icons), (unsigned int)maxh); + *w = MIN(step_w, maxw); + *h = MIN(step_h * eina_list_count(sd->icons), (unsigned int)maxh); return EINA_TRUE; default: break; } y = x = (int)sqrt(eina_list_count(sd->icons)); - if (maxw && (x * minw > maxw)) + if (maxw && (x * step_w > maxw)) { - x = maxw / minw; - y = (eina_list_count(sd->icons) / x) + ((maxw % minw) ? 1 : 0); + x = maxw / step_w; + y = (eina_list_count(sd->icons) / x) + ((maxw % step_w) ? 1 : 0); } - *w = minw * x; + if (minw && (x * step_w < minw)) + { + x = minw / step_w; + y = (eina_list_count(sd->icons) / x) + ((minw % step_w) ? 1 : 0); + } + *w = step_w * x; *w = MIN(*w, maxw); - *h = minh * y; + *h = step_h * y; *h = MIN(*h, maxh); return EINA_TRUE; } diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index ed66421..2a07d54 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -203,7 +203,7 @@ EAPI void e_fm2_overlay_clip_to(Evas_Object *fm, Evas_Object *clip); EAPI void e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e); EAPI void e_fm2_client_del(Ecore_Ipc_Event_Client_Del *e); EAPI E_Fm2_View_Mode e_fm2_view_mode_get(Evas_Object *obj); -EAPI Eina_Bool e_fm2_optimal_size_calc(Evas_Object *obj, int maxw, int maxh, int *w, int *h); +EAPI Eina_Bool e_fm2_optimal_size_calc(Evas_Object *obj, int minw, int minh, int maxw, int maxh, int *w, int *h); EAPI const char *e_fm2_real_path_map(const char *dev, const char *path); EAPI void e_fm2_favorites_init(void); EAPI unsigned int e_fm2_selected_count(Evas_Object *obj); diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index ab31ad5..6203ef5 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -654,7 +654,7 @@ _e_fwin_bg_mouse_down(E_Fwin *fwin, Evas_Object *obj __UNUSED__, void *event __U if (fwin->win->client->fullscreen) e_client_unfullscreen(fwin->win->client); e_zone_useful_geometry_get(fwin->win->client->zone, &zx, &zy, &zw, &zh); x = fwin->win->client->x, y = fwin->win->client->y; - if (!e_fm2_optimal_size_calc(fwin->cur_page->fm_obj, zw + zx - x, zh + zy - y, &w, &h)) return; + if (!e_fm2_optimal_size_calc(fwin->cur_page->fm_obj, MINIMUM_WIDTH, MINIMUM_HEIGHT, zw + zx - x, zh + zy - y, &w, &h)) return; evas_object_geometry_get(fwin->cur_page->fm_obj, &cx, &cy, &cw, &ch); if (x + w > zx + zw) w = zx + zw - x; --