From 2581c25c2d5e118343f340c3e07c3c22e1f88ff5 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Mon, 5 Oct 2009 03:06:39 +0000 Subject: [PATCH] fix e_fm window initial position and size SVN revision: 42884 --- src/modules/fileman/e_fwin.c | 39 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index dbfdba40a..22ab89ce1 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -1685,7 +1685,12 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page, Eina_List *files, int always) if (!found) { - /* No custom info, so just put window near icon */ + int w, h, zw, zh; + + e_zone_useful_geometry_get(fwin2->win->border->zone, + NULL, NULL, &zw, &zh); + + /* No custom info, so just put window near icon */ e_fm2_icon_geometry_get(ici->ic, &ix, &iy, &iw, &ih); nx = (ix + (iw / 2)); ny = (iy + (ih / 2)); @@ -1694,16 +1699,30 @@ _e_fwin_file_open_dialog(E_Fwin_Page *page, Eina_List *files, int always) nx += fwin->win->x; ny += fwin->win->y; } + + /* checking width and height */ + /* TODO add config for preffered + initial size? */ + w = 5 * iw * e_scale; + if (w > 400) + w = 400; + if (w > zw) + w = zw; + + h = 4 * ih * e_scale; + if (h > 300) + h = 300; + if (h > zh) + h = zh; + /* iff going out of zone - adjust to be in */ - if ((fwin2->win->border->zone->x + - fwin2->win->border->zone->w) < - (fwin2->win->border->w + nx)) - nx -= fwin2->win->border->w; - if ((fwin2->win->border->zone->y + - fwin2->win->border->zone->h) < - (fwin2->win->border->h + ny)) - ny -= fwin2->win->border->h; - e_win_move(fwin2->win, nx, ny); + if ((fwin2->win->border->zone->x + fwin2->win->border->zone->w) < (w + nx)) + nx -= w; + if ((fwin2->win->border->zone->y + fwin2->win->border->zone->h) < (h + ny)) + ny -= h; + + e_win_move_resize(fwin2->win, nx, ny, w, h); + fwin2->win->border->placed = 1; } } if (ici->label)