Hello, All.

It is my patch for 'fm2 "favorites" doesn't remember window geometry' issue in 
release plan of E17.
In code I saw that all fm2 windows created with 'e_fwin_new' call affected to 
this problem. Therefore, I have added code for reading window geometry 
settings from fm2 custom file.

Please, any comments, wishes.

Sincerely yours, Sergey.

--
Jabber/XMPP: sergey.semer...@gmail.com
Cellular: +7-909-206-5992
Index: e/src/modules/fileman/e_fwin.c
===================================================================
--- e/src/modules/fileman/e_fwin.c	(revision 39796)
+++ e/src/modules/fileman/e_fwin.c	(working copy)
@@ -148,8 +148,54 @@ EAPI void
 e_fwin_new(E_Container *con, const char *dev, const char *path)
 {
    E_Fwin *fwin;
+   E_Fm2_Custom_File *cf;
+   char buf[PATH_MAX];
+   int x, y, w, h;
 
    fwin = _e_fwin_new(con, dev, path);
+
+   if (fwin)
+     {
+        snprintf(buf, sizeof(buf), "dir::%s", e_fm2_real_path_get(fwin->fm_obj));
+        cf = e_fm2_custom_file_get(buf);
+        if ((cf) && (cf->geom.valid))
+          {
+             x = cf->geom.x;
+             y = cf->geom.y;
+             w = cf->geom.w;
+             h = cf->geom.h;
+
+             /* checking width and height */
+             if (w < 24)
+                w = 280 * e_scale;
+             else if (w > fwin->win->border->zone->w)
+                w = fwin->win->border->zone->w;
+             if (h < 24)
+                h = 200 * e_scale;
+             else if (h > fwin->win->border->zone->h)
+                h = fwin->win->border->zone->h;
+
+             /* checking left-top corner */
+             if (x < fwin->win->border->zone->x)
+               x = fwin->win->border->zone->x + fwin->win->border->client_inset.l;
+             if (y < fwin->win->border->zone->y)
+               y = fwin->win->border->zone->y + fwin->win->border->client_inset.t;
+
+             /* checking right-bottom corner */
+             if ((fwin->win->border->zone->x + fwin->win->border->zone->w) < (x + w))
+               x = fwin->win->border->zone->x + fwin->win->border->zone->w - w - fwin->win->border->client_inset.l;
+             if ((fwin->win->border->zone->y + fwin->win->border->zone->h) < (y + h))
+               y = fwin->win->border->zone->y + fwin->win->border->zone->h - h - fwin->win->border->client_inset.t;
+
+             e_win_move_resize
+               (fwin->win,
+                x - fwin->win->border->client_inset.l,
+                y - fwin->win->border->client_inset.t,
+                w, h);
+          }
+
+        fwin->geom_save_ready = 1;
+     }
 }
 
------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to