parent
40ef1763d3
commit
7c7324c7de
1
src/E.h
1
src/E.h
|
@ -1308,6 +1308,7 @@ typedef struct
|
|||
int last_button;
|
||||
Time last_time;
|
||||
char queue_up;
|
||||
char save_ok;
|
||||
}
|
||||
EMode;
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ SignalHandler(int sig)
|
|||
|
||||
EDBUG(7, "SignalHandler");
|
||||
|
||||
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||
Eprintf("SignalHandler signal=%d\n", sig);
|
||||
|
||||
switch (sig)
|
||||
{
|
||||
case SIGHUP:
|
||||
|
|
|
@ -265,7 +265,9 @@ main(int argc, char **argv)
|
|||
|
||||
/* retreive stuff from last time we were loaded if we're restarting */
|
||||
ICCCM_GetMainEInfo();
|
||||
|
||||
SetupEnv();
|
||||
|
||||
if (Conf.mapslide)
|
||||
CreateStartupDisplay(0);
|
||||
|
||||
|
@ -288,6 +290,8 @@ main(int argc, char **argv)
|
|||
/* 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 @@ main(int argc, char **argv)
|
|||
/* 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 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
101
src/session.c
101
src/session.c
|
@ -212,57 +212,56 @@ SaveWindowStates(void)
|
|||
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);
|
||||
}
|
||||
x = desks.desk[ewin->desktop].current_area_x * root.w;
|
||||
y = desks.desk[ewin->desktop].current_area_y * root.h;
|
||||
}
|
||||
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"));
|
||||
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 @@ MatchEwinToSM(EWin * ewin)
|
|||
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 @@ autosave(void)
|
|||
* 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 @@ static void
|
|||
doSMExit(const void *params)
|
||||
{
|
||||
char s[1024];
|
||||
char do_master_kill;
|
||||
|
||||
do_master_kill = 1;
|
||||
|
||||
restarting = True;
|
||||
|
||||
|
@ -1124,9 +1126,6 @@ doSMExit(const void *params)
|
|||
char *real_exec;
|
||||
char sss[FILEPATH_LEN_MAX];
|
||||
Window w;
|
||||
char do_master_kill;
|
||||
|
||||
do_master_kill = 1;
|
||||
|
||||
if (!params)
|
||||
SaveSession(1);
|
||||
|
|
49
src/setup.c
49
src/setup.c
|
@ -570,14 +570,20 @@ MakeExtInitWin(void)
|
|||
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 @@ MakeExtInitWin(void)
|
|||
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 @@ MakeExtInitWin(void)
|
|||
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 @@ MakeExtInitWin(void)
|
|||
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 @@ MakeExtInitWin(void)
|
|||
* XNextEvent(d2, &ev);
|
||||
* }
|
||||
* } */
|
||||
|
||||
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||
Eprintf("MakeExtInitWin - child exit\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -864,15 +864,15 @@ SaveSnapInfo(void)
|
|||
|
||||
/* 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 @@ Real_SaveSnapInfo(int dumval, void *dumdat)
|
|||
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"));
|
||||
|
|
Loading…
Reference in New Issue