Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        main.c prefs.c prefs.h 


Log Message:
Entice remembers its geometry and attempts placing itself back there the
next time you run it.


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/main.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- main.c      14 Oct 2003 18:33:29 -0000      1.14
+++ main.c      18 Oct 2003 06:59:04 -0000      1.15
@@ -44,15 +44,13 @@
 static void
 win_resize_cb(Ecore_Evas * ee)
 {
-   int w, h;
-   Evas *e = NULL;
-
-   if ((e = ecore_evas_get(ee)))
+   int x, y, w, h;
+   if (ee)
    {
-      ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+      ecore_evas_geometry_get(ee, &x, &y, &w, &h);
+      entice_config_geometry_set(x, y, w, h);
       entice_resize(w, h);
    }
-
 }
 
 /**
@@ -62,8 +60,12 @@
 static void
 win_move_cb(Ecore_Evas * ee)
 {
-   return;
-   ee = NULL;
+   int x, y, w, h;
+   if (ee)
+   {
+      ecore_evas_geometry_get(ee, &x, &y, &w, &h);
+      entice_config_geometry_set(x, y, w, h);
+   }
 }
 
 /**
@@ -73,6 +75,12 @@
 static void
 win_del_cb(Ecore_Evas * ee)
 {
+   int x, y, w, h;
+   if (ee)
+   {
+      ecore_evas_geometry_get(ee, &x, &y, &w, &h);
+      entice_config_geometry_set(x, y, w, h);
+   }
    ecore_main_loop_quit();
    return;
    ee = NULL;
@@ -126,6 +134,7 @@
 main(int argc, char *argv[])
 {
    int i = 0;
+   int x, y, w, h;
 
    ecore_init();
    ecore_app_args_set(argc, (const char **) argv);
@@ -140,10 +149,11 @@
       edje_frametime_set(1.0 / 60.0);
 
       entice_config_init();
+      entice_config_geometry_get(&x, &y, &w, &h);
       if (entice_config_engine_get() == GL_X11)
-         ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 320, 240);
+         ee = ecore_evas_gl_x11_new(NULL, 0, x, y, w, h);
       else
-         ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 320, 240);
+         ee = ecore_evas_software_x11_new(NULL, 0, x, y, w, h);
 
       if (ee)
       {
@@ -186,7 +196,7 @@
               default:
                  break;
             }
-            ecore_evas_resize(ee, 640, 480);
+            ecore_evas_move_resize(ee, x, y, w, h);
             ecore_evas_show(ee);
             ecore_main_loop_begin();
          }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- prefs.c     14 Oct 2003 18:33:29 -0000      1.4
+++ prefs.c     18 Oct 2003 06:59:04 -0000      1.5
@@ -96,6 +96,36 @@
    return (result);
 }
 
+void
+entice_config_geometry_get(int *x, int *y, int *w, int *h)
+{
+    if(econfig)
+    {
+       if(x) *x = econfig->x;
+       if(y) *y = econfig->y;
+       if(w) *w = econfig->w;
+       if(h) *h = econfig->h;
+    }
+}
+void
+entice_config_geometry_set(int x, int y, int w, int h)
+{
+    if(econfig)
+    {
+       char file[PATH_MAX];
+       econfig->x = x;
+       econfig->y = y;
+       econfig->w = w;
+       econfig->h = h;
+       
+       snprintf(file, PATH_MAX, "%s/.entice.db", getenv("HOME"));
+       E_DB_INT_SET(file, "/entice/x", x)
+       E_DB_INT_SET(file, "/entice/y", y)
+       E_DB_INT_SET(file, "/entice/w", w)
+       E_DB_INT_SET(file, "/entice/h", h)
+       e_db_flush();
+    }
+}
 /**
  * entice_config_new - allocate a new 0'd out Entice_Config
  * Returns a valid 0'd out Entice_Config
@@ -195,6 +225,14 @@
             if (!e_db_int_get
                 (db, "/entice/cache/image", &econfig->cache.image))
                econfig->cache.image = 4;
+            if (!e_db_int_get(db, "/entice/x", &econfig->x))
+               econfig->x = 0;
+            if (!e_db_int_get(db, "/entice/y", &econfig->y))
+               econfig->y = 0;
+            if (!e_db_int_get(db, "/entice/w", &econfig->w))
+               econfig->y = 320;
+            if (!e_db_int_get(db, "/entice/h", &econfig->h))
+               econfig->y = 120;
 
             e_db_close(db);
          }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- prefs.h     14 Oct 2003 18:33:29 -0000      1.2
+++ prefs.h     18 Oct 2003 06:59:04 -0000      1.3
@@ -17,6 +17,7 @@
    {
       int image, font;
    } cache;
+   int x, y, w, h;
 };
 typedef struct _Entice_Config Entice_Config;
 
@@ -27,5 +28,7 @@
 int entice_config_engine_get(void);
 int entice_config_font_cache_get(void);
 int entice_config_image_cache_get(void);
+void entice_config_geometry_get(int *x, int *y, int *w, int *h);
+void entice_config_geometry_set(int x, int y, int w, int h);
 
 #endif




-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to