Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h handlers.c main.c session.c setup.c snaps.c
Log Message:
Avoid trashing the configuration.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.253
retrieving revision 1.254
diff -u -3 -r1.253 -r1.254
--- E.h 25 Apr 2004 08:29:52 -0000 1.253
+++ E.h 25 Apr 2004 18:47:59 -0000 1.254
@@ -1308,6 +1308,7 @@
int last_button;
Time last_time;
char queue_up;
+ char save_ok;
}
EMode;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/handlers.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- handlers.c 20 Mar 2004 15:49:05 -0000 1.37
+++ handlers.c 25 Apr 2004 18:48:30 -0000 1.38
@@ -32,6 +32,9 @@
EDBUG(7, "SignalHandler");
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("SignalHandler signal=%d\n", sig);
+
switch (sig)
{
case SIGHUP:
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- main.c 21 Apr 2004 20:51:42 -0000 1.88
+++ main.c 25 Apr 2004 18:48:30 -0000 1.89
@@ -265,7 +265,9 @@
/* retreive stuff from last time we were loaded if we're restarting */
ICCCM_GetMainEInfo();
+
SetupEnv();
+
if (Conf.mapslide)
CreateStartupDisplay(0);
@@ -288,6 +290,8 @@
/* Kill the E process owning the "init window" */
if (Mode.wm.master && init_win_ext)
{
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("Kill init window %#lx\n", init_win_ext);
XKillClient(disp, init_win_ext);
init_win_ext = 0;
}
@@ -299,6 +303,7 @@
/* hello! we don't have a resizemode of 5! */
if (Conf.resizemode == 5)
Conf.resizemode = 0;
+
/* of course, we have to set the cursors */
ec = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_ECURSOR);
if (ec)
@@ -309,9 +314,11 @@
}
Mode.startup = 0;
+ Mode.save_ok = Mode.wm.master;
/* ok - paranoia - save current settings to disk */
if (root.scr == 0)
autosave();
+
/* let's make sure we set this up and go to our desk anyways */
ICCCM_GetMainEInfo();
GotoDesktop(desks.current);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- session.c 7 Apr 2004 14:32:36 -0000 1.64
+++ session.c 25 Apr 2004 18:48:32 -0000 1.65
@@ -212,57 +212,56 @@
FILE *f;
char s[4096], ss[4096];
+ if (!Mode.save_ok)
+ return;
+
+ Etmp(s);
+ f = fopen(s, "w");
+ if (f == NULL)
+ return;
+
lst = EwinListGetAll(&num);
- if (lst)
+ for (i = 0; i < num; i++)
{
- Etmp(s);
- f = fopen(s, "w");
- if (f)
+ ewin = lst[i];
+ if ((!(ewin->internal))
+ && ((ewin->icccm.wm_command) || (ewin->session_id)))
{
- for (i = 0; i < num; i++)
+ x = 0;
+ y = 0;
+ if (!ewin->sticky)
{
- ewin = lst[i];
- if ((!(ewin->internal))
- && ((ewin->icccm.wm_command) || (ewin->session_id)))
- {
- x = 0;
- y = 0;
- if (!ewin->sticky)
- {
- x = desks.desk[ewin->desktop].current_area_x *
- root.w;
- y = desks.desk[ewin->desktop].current_area_y *
- root.h;
- }
- fprintf(f, "[CLIENT] %i %i %i %i %i %i %i %i %i\n",
- ewin->x + x, ewin->y + y, ewin->client.w,
- ewin->client.h, ewin->desktop, ewin->iconified,
- ewin->shaded, ewin->sticky, ewin->layer);
- if (ewin->session_id)
- fprintf(f, " [SESSION_ID] %s\n", ewin->session_id);
- if (ewin->icccm.wm_res_name)
- fprintf(f, " [NAME] %s\n", ewin->icccm.wm_res_name);
- if (ewin->icccm.wm_res_class)
- fprintf(f, " [CLASS] %s\n",
- ewin->icccm.wm_res_class);
- if (ewin->icccm.wm_role)
- fprintf(f, " [ROLE] %s\n", ewin->icccm.wm_role);
- if (ewin->icccm.wm_command)
- fprintf(f, " [COMMAND] %s\n",
- ewin->icccm.wm_command);
- }
- }
- fclose(f);
- Esnprintf(ss, sizeof(ss), "%s.clients.%i", GetSMFile(), root.scr);
- E_mv(s, ss);
- if (!isfile(ss))
- Alert(_("There was an error writing the clients "
- "session save file.\n" "You may have run out of disk "
- "space, not have permission\n"
- "to write to your filing system "
- "or other similar problems.\n"));
- }
- }
+ x = desks.desk[ewin->desktop].current_area_x * root.w;
+ y = desks.desk[ewin->desktop].current_area_y * root.h;
+ }
+ fprintf(f, "[CLIENT] %i %i %i %i %i %i %i %i %i\n",
+ ewin->x + x, ewin->y + y, ewin->client.w,
+ ewin->client.h, ewin->desktop, ewin->iconified,
+ ewin->shaded, ewin->sticky, ewin->layer);
+ if (ewin->session_id)
+ fprintf(f, " [SESSION_ID] %s\n", ewin->session_id);
+ if (ewin->icccm.wm_res_name)
+ fprintf(f, " [NAME] %s\n", ewin->icccm.wm_res_name);
+ if (ewin->icccm.wm_res_class)
+ fprintf(f, " [CLASS] %s\n", ewin->icccm.wm_res_class);
+ if (ewin->icccm.wm_role)
+ fprintf(f, " [ROLE] %s\n", ewin->icccm.wm_role);
+ if (ewin->icccm.wm_command)
+ fprintf(f, " [COMMAND] %s\n", ewin->icccm.wm_command);
+ }
+ }
+ fclose(f);
+
+ Esnprintf(ss, sizeof(ss), "%s.clients.%i", GetSMFile(), root.scr);
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("SaveWindowStates: %s\n", ss);
+ E_mv(s, ss);
+ if (!isfile(ss))
+ Alert(_("There was an error writing the clients "
+ "session save file.\n" "You may have run out of disk "
+ "space, not have permission\n"
+ "to write to your filing system "
+ "or other similar problems.\n"));
}
static void
@@ -427,15 +426,19 @@
void
autosave(void)
{
- if (Mode.startup)
+ if (!Mode.save_ok)
return;
+
if (Conf.autosave)
{
char s[4096];
Real_SaveSnapInfo(0, NULL);
+
Etmp(s);
SaveUserControlConfig(fopen(s, "w"));
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("autosave: save %s\n", GetGenericSMFile());
E_mv(s, GetGenericSMFile());
if (!isfile(GetGenericSMFile()))
Alert(_("There was an error saving your autosave data - filing\n"
@@ -456,6 +459,8 @@
* Esnprintf(buf, sizeof(buf) / sizeof(char), "rm %s*", GetSMFile());
* system(buf); */
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("autosave: kill %s\n", GetGenericSMFile());
E_rm(GetGenericSMFile());
}
}
@@ -971,9 +976,6 @@
doSMExit(const void *params)
{
char s[1024];
- char do_master_kill;
-
- do_master_kill = 1;
restarting = True;
@@ -1124,9 +1126,6 @@
char *real_exec;
char sss[FILEPATH_LEN_MAX];
Window w;
- char do_master_kill;
-
- do_master_kill = 1;
if (!params)
SaveSession(1);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- setup.c 24 Apr 2004 13:16:38 -0000 1.123
+++ setup.c 25 Apr 2004 18:48:34 -0000 1.124
@@ -570,14 +570,20 @@
Atom a;
CARD32 val;
int i;
- Window *retval;
XSetWindowAttributes attr;
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("MakeExtInitWin\n");
+
a = XInternAtom(disp, "ENLIGHTENMENT_RESTART_SCREEN", False);
XSync(disp, False);
if (fork())
{
UngrabX();
+
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("MakeExtInitWin - parent\n");
+
for (;;)
{
Atom aa;
@@ -585,22 +591,32 @@
unsigned long bytes_after, num_ret;
unsigned char *puc;
+ /* Hack to give the child some space. Not foolproof. */
+ sleep(1);
+
puc = NULL;
XGetWindowProperty(disp, root.win, a, 0, 0x7fffffff, True,
XA_CARDINAL, &aa, &format_ret, &num_ret,
&bytes_after, &puc);
- retval = (Window *) puc;
XSync(disp, False);
- if (retval)
- break;
+ if (puc)
+ {
+ win = *((Window *) puc);
+ XFree(puc);
+ break;
+ }
}
- win = *retval;
fflush(stdout);
- XFree(retval);
+
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("MakeExtInitWin - parent - %#lx\n", win);
return win;
}
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("MakeExtInitWin - child\n");
+
/* on solairs connection stays up - close */
XSetErrorHandler((XErrorHandler) NULL);
XSetIOErrorHandler((XIOErrorHandler) NULL);
@@ -628,11 +644,10 @@
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = True;
- win =
- XCreateWindow(d2, root.win, 0, 0, root.w, root.h, 0, root.depth,
- InputOutput, root.vis,
- CWOverrideRedirect | CWSaveUnder | CWBackingStore |
- CWColormap | CWBackPixel | CWBorderPixel, &attr);
+ win = XCreateWindow(d2, root.win, 0, 0, root.w, root.h, 0, root.depth,
+ InputOutput, root.vis,
+ CWOverrideRedirect | CWSaveUnder | CWBackingStore |
+ CWColormap | CWBackPixel | CWBorderPixel, &attr);
pmap = ECreatePixmap(d2, win, root.w, root.h, root.depth);
gcv.subwindow_mode = IncludeInferiors;
gc = XCreateGC(d2, win, GCSubwindowMode, &gcv);
@@ -697,15 +712,15 @@
cs = XCreatePixmapCursor(d2, pmap, mask, &cl, &cl, 0, 0);
XDefineCursor(d2, win, cs);
XDefineCursor(d2, w2, cs);
- i = 1;
- for (;;)
- {
- i++;
+ for (i = 1;; i++)
+ {
if (i > 12)
i = 1;
Esnprintf(s, sizeof(s), "pix/wait%i.png", i);
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("MakeExtInitWin - child %s\n", s);
f = FindFile(s);
im = NULL;
@@ -749,6 +764,10 @@
* XNextEvent(d2, &ev);
* }
* } */
+
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("MakeExtInitWin - child exit\n");
+
exit(0);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- snaps.c 21 Mar 2004 01:39:40 -0000 1.65
+++ snaps.c 25 Apr 2004 18:48:36 -0000 1.66
@@ -864,15 +864,15 @@
/* save out all snapped info to disk */
void
-Real_SaveSnapInfo(int dumval, void *dumdat)
+Real_SaveSnapInfo(int dumval __UNUSED__, void *dumdat __UNUSED__)
{
Snapshot **lst, *sn;
int i, j, num;
char buf[4096], s[4096];
FILE *f;
- if (dumdat)
- dumval = 0;
+ if (!Mode.save_ok)
+ return;
Etmp(s);
f = fopen(s, "w");
@@ -933,6 +933,8 @@
fclose(f);
Esnprintf(buf, sizeof(buf), "%s.snapshots.%i", GetGenericSMFile(), root.scr);
+ if (EventDebug(EDBUG_TYPE_SESSION))
+ Eprintf("Real_SaveSnapInfo: %s\n", buf);
E_mv(s, buf);
if (!isfile(buf))
Alert(_("Error saving snaps file\n"));
-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs