parent
40ef1763d3
commit
7c7324c7de
1
src/E.h
1
src/E.h
|
@ -1308,6 +1308,7 @@ typedef struct
|
||||||
int last_button;
|
int last_button;
|
||||||
Time last_time;
|
Time last_time;
|
||||||
char queue_up;
|
char queue_up;
|
||||||
|
char save_ok;
|
||||||
}
|
}
|
||||||
EMode;
|
EMode;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ SignalHandler(int sig)
|
||||||
|
|
||||||
EDBUG(7, "SignalHandler");
|
EDBUG(7, "SignalHandler");
|
||||||
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("SignalHandler signal=%d\n", sig);
|
||||||
|
|
||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
|
|
|
@ -265,7 +265,9 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* retreive stuff from last time we were loaded if we're restarting */
|
/* retreive stuff from last time we were loaded if we're restarting */
|
||||||
ICCCM_GetMainEInfo();
|
ICCCM_GetMainEInfo();
|
||||||
|
|
||||||
SetupEnv();
|
SetupEnv();
|
||||||
|
|
||||||
if (Conf.mapslide)
|
if (Conf.mapslide)
|
||||||
CreateStartupDisplay(0);
|
CreateStartupDisplay(0);
|
||||||
|
|
||||||
|
@ -288,6 +290,8 @@ main(int argc, char **argv)
|
||||||
/* Kill the E process owning the "init window" */
|
/* Kill the E process owning the "init window" */
|
||||||
if (Mode.wm.master && init_win_ext)
|
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);
|
XKillClient(disp, init_win_ext);
|
||||||
init_win_ext = 0;
|
init_win_ext = 0;
|
||||||
}
|
}
|
||||||
|
@ -299,6 +303,7 @@ main(int argc, char **argv)
|
||||||
/* hello! we don't have a resizemode of 5! */
|
/* hello! we don't have a resizemode of 5! */
|
||||||
if (Conf.resizemode == 5)
|
if (Conf.resizemode == 5)
|
||||||
Conf.resizemode = 0;
|
Conf.resizemode = 0;
|
||||||
|
|
||||||
/* of course, we have to set the cursors */
|
/* of course, we have to set the cursors */
|
||||||
ec = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_ECURSOR);
|
ec = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_ECURSOR);
|
||||||
if (ec)
|
if (ec)
|
||||||
|
@ -309,9 +314,11 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode.startup = 0;
|
Mode.startup = 0;
|
||||||
|
Mode.save_ok = Mode.wm.master;
|
||||||
/* ok - paranoia - save current settings to disk */
|
/* ok - paranoia - save current settings to disk */
|
||||||
if (root.scr == 0)
|
if (root.scr == 0)
|
||||||
autosave();
|
autosave();
|
||||||
|
|
||||||
/* let's make sure we set this up and go to our desk anyways */
|
/* let's make sure we set this up and go to our desk anyways */
|
||||||
ICCCM_GetMainEInfo();
|
ICCCM_GetMainEInfo();
|
||||||
GotoDesktop(desks.current);
|
GotoDesktop(desks.current);
|
||||||
|
|
101
src/session.c
101
src/session.c
|
@ -212,57 +212,56 @@ SaveWindowStates(void)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char s[4096], ss[4096];
|
char s[4096], ss[4096];
|
||||||
|
|
||||||
|
if (!Mode.save_ok)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Etmp(s);
|
||||||
|
f = fopen(s, "w");
|
||||||
|
if (f == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
lst = EwinListGetAll(&num);
|
lst = EwinListGetAll(&num);
|
||||||
if (lst)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
Etmp(s);
|
ewin = lst[i];
|
||||||
f = fopen(s, "w");
|
if ((!(ewin->internal))
|
||||||
if (f)
|
&& ((ewin->icccm.wm_command) || (ewin->session_id)))
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
if (!ewin->sticky)
|
||||||
{
|
{
|
||||||
ewin = lst[i];
|
x = desks.desk[ewin->desktop].current_area_x * root.w;
|
||||||
if ((!(ewin->internal))
|
y = desks.desk[ewin->desktop].current_area_y * root.h;
|
||||||
&& ((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);
|
fprintf(f, "[CLIENT] %i %i %i %i %i %i %i %i %i\n",
|
||||||
Esnprintf(ss, sizeof(ss), "%s.clients.%i", GetSMFile(), root.scr);
|
ewin->x + x, ewin->y + y, ewin->client.w,
|
||||||
E_mv(s, ss);
|
ewin->client.h, ewin->desktop, ewin->iconified,
|
||||||
if (!isfile(ss))
|
ewin->shaded, ewin->sticky, ewin->layer);
|
||||||
Alert(_("There was an error writing the clients "
|
if (ewin->session_id)
|
||||||
"session save file.\n" "You may have run out of disk "
|
fprintf(f, " [SESSION_ID] %s\n", ewin->session_id);
|
||||||
"space, not have permission\n"
|
if (ewin->icccm.wm_res_name)
|
||||||
"to write to your filing system "
|
fprintf(f, " [NAME] %s\n", ewin->icccm.wm_res_name);
|
||||||
"or other similar problems.\n"));
|
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
|
static void
|
||||||
|
@ -427,15 +426,19 @@ MatchEwinToSM(EWin * ewin)
|
||||||
void
|
void
|
||||||
autosave(void)
|
autosave(void)
|
||||||
{
|
{
|
||||||
if (Mode.startup)
|
if (!Mode.save_ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Conf.autosave)
|
if (Conf.autosave)
|
||||||
{
|
{
|
||||||
char s[4096];
|
char s[4096];
|
||||||
|
|
||||||
Real_SaveSnapInfo(0, NULL);
|
Real_SaveSnapInfo(0, NULL);
|
||||||
|
|
||||||
Etmp(s);
|
Etmp(s);
|
||||||
SaveUserControlConfig(fopen(s, "w"));
|
SaveUserControlConfig(fopen(s, "w"));
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("autosave: save %s\n", GetGenericSMFile());
|
||||||
E_mv(s, GetGenericSMFile());
|
E_mv(s, GetGenericSMFile());
|
||||||
if (!isfile(GetGenericSMFile()))
|
if (!isfile(GetGenericSMFile()))
|
||||||
Alert(_("There was an error saving your autosave data - filing\n"
|
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());
|
* Esnprintf(buf, sizeof(buf) / sizeof(char), "rm %s*", GetSMFile());
|
||||||
* system(buf); */
|
* system(buf); */
|
||||||
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("autosave: kill %s\n", GetGenericSMFile());
|
||||||
E_rm(GetGenericSMFile());
|
E_rm(GetGenericSMFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -971,9 +976,6 @@ static void
|
||||||
doSMExit(const void *params)
|
doSMExit(const void *params)
|
||||||
{
|
{
|
||||||
char s[1024];
|
char s[1024];
|
||||||
char do_master_kill;
|
|
||||||
|
|
||||||
do_master_kill = 1;
|
|
||||||
|
|
||||||
restarting = True;
|
restarting = True;
|
||||||
|
|
||||||
|
@ -1124,9 +1126,6 @@ doSMExit(const void *params)
|
||||||
char *real_exec;
|
char *real_exec;
|
||||||
char sss[FILEPATH_LEN_MAX];
|
char sss[FILEPATH_LEN_MAX];
|
||||||
Window w;
|
Window w;
|
||||||
char do_master_kill;
|
|
||||||
|
|
||||||
do_master_kill = 1;
|
|
||||||
|
|
||||||
if (!params)
|
if (!params)
|
||||||
SaveSession(1);
|
SaveSession(1);
|
||||||
|
|
49
src/setup.c
49
src/setup.c
|
@ -570,14 +570,20 @@ MakeExtInitWin(void)
|
||||||
Atom a;
|
Atom a;
|
||||||
CARD32 val;
|
CARD32 val;
|
||||||
int i;
|
int i;
|
||||||
Window *retval;
|
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("MakeExtInitWin\n");
|
||||||
|
|
||||||
a = XInternAtom(disp, "ENLIGHTENMENT_RESTART_SCREEN", False);
|
a = XInternAtom(disp, "ENLIGHTENMENT_RESTART_SCREEN", False);
|
||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
if (fork())
|
if (fork())
|
||||||
{
|
{
|
||||||
UngrabX();
|
UngrabX();
|
||||||
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("MakeExtInitWin - parent\n");
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
Atom aa;
|
Atom aa;
|
||||||
|
@ -585,22 +591,32 @@ MakeExtInitWin(void)
|
||||||
unsigned long bytes_after, num_ret;
|
unsigned long bytes_after, num_ret;
|
||||||
unsigned char *puc;
|
unsigned char *puc;
|
||||||
|
|
||||||
|
/* Hack to give the child some space. Not foolproof. */
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
puc = NULL;
|
puc = NULL;
|
||||||
XGetWindowProperty(disp, root.win, a, 0, 0x7fffffff, True,
|
XGetWindowProperty(disp, root.win, a, 0, 0x7fffffff, True,
|
||||||
XA_CARDINAL, &aa, &format_ret, &num_ret,
|
XA_CARDINAL, &aa, &format_ret, &num_ret,
|
||||||
&bytes_after, &puc);
|
&bytes_after, &puc);
|
||||||
retval = (Window *) puc;
|
|
||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
if (retval)
|
if (puc)
|
||||||
break;
|
{
|
||||||
|
win = *((Window *) puc);
|
||||||
|
XFree(puc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
win = *retval;
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
XFree(retval);
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("MakeExtInitWin - parent - %#lx\n", win);
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("MakeExtInitWin - child\n");
|
||||||
|
|
||||||
/* on solairs connection stays up - close */
|
/* on solairs connection stays up - close */
|
||||||
XSetErrorHandler((XErrorHandler) NULL);
|
XSetErrorHandler((XErrorHandler) NULL);
|
||||||
XSetIOErrorHandler((XIOErrorHandler) NULL);
|
XSetIOErrorHandler((XIOErrorHandler) NULL);
|
||||||
|
@ -628,11 +644,10 @@ MakeExtInitWin(void)
|
||||||
attr.border_pixel = 0;
|
attr.border_pixel = 0;
|
||||||
attr.background_pixel = 0;
|
attr.background_pixel = 0;
|
||||||
attr.save_under = True;
|
attr.save_under = True;
|
||||||
win =
|
win = XCreateWindow(d2, root.win, 0, 0, root.w, root.h, 0, root.depth,
|
||||||
XCreateWindow(d2, root.win, 0, 0, root.w, root.h, 0, root.depth,
|
InputOutput, root.vis,
|
||||||
InputOutput, root.vis,
|
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
|
||||||
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
|
CWColormap | CWBackPixel | CWBorderPixel, &attr);
|
||||||
CWColormap | CWBackPixel | CWBorderPixel, &attr);
|
|
||||||
pmap = ECreatePixmap(d2, win, root.w, root.h, root.depth);
|
pmap = ECreatePixmap(d2, win, root.w, root.h, root.depth);
|
||||||
gcv.subwindow_mode = IncludeInferiors;
|
gcv.subwindow_mode = IncludeInferiors;
|
||||||
gc = XCreateGC(d2, win, GCSubwindowMode, &gcv);
|
gc = XCreateGC(d2, win, GCSubwindowMode, &gcv);
|
||||||
|
@ -697,15 +712,15 @@ MakeExtInitWin(void)
|
||||||
cs = XCreatePixmapCursor(d2, pmap, mask, &cl, &cl, 0, 0);
|
cs = XCreatePixmapCursor(d2, pmap, mask, &cl, &cl, 0, 0);
|
||||||
XDefineCursor(d2, win, cs);
|
XDefineCursor(d2, win, cs);
|
||||||
XDefineCursor(d2, w2, cs);
|
XDefineCursor(d2, w2, cs);
|
||||||
i = 1;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
|
|
||||||
i++;
|
for (i = 1;; i++)
|
||||||
|
{
|
||||||
if (i > 12)
|
if (i > 12)
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
Esnprintf(s, sizeof(s), "pix/wait%i.png", i);
|
Esnprintf(s, sizeof(s), "pix/wait%i.png", i);
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("MakeExtInitWin - child %s\n", s);
|
||||||
|
|
||||||
f = FindFile(s);
|
f = FindFile(s);
|
||||||
im = NULL;
|
im = NULL;
|
||||||
|
@ -749,6 +764,10 @@ MakeExtInitWin(void)
|
||||||
* XNextEvent(d2, &ev);
|
* XNextEvent(d2, &ev);
|
||||||
* }
|
* }
|
||||||
* } */
|
* } */
|
||||||
|
|
||||||
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||||
|
Eprintf("MakeExtInitWin - child exit\n");
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -864,15 +864,15 @@ SaveSnapInfo(void)
|
||||||
|
|
||||||
/* save out all snapped info to disk */
|
/* save out all snapped info to disk */
|
||||||
void
|
void
|
||||||
Real_SaveSnapInfo(int dumval, void *dumdat)
|
Real_SaveSnapInfo(int dumval __UNUSED__, void *dumdat __UNUSED__)
|
||||||
{
|
{
|
||||||
Snapshot **lst, *sn;
|
Snapshot **lst, *sn;
|
||||||
int i, j, num;
|
int i, j, num;
|
||||||
char buf[4096], s[4096];
|
char buf[4096], s[4096];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
if (dumdat)
|
if (!Mode.save_ok)
|
||||||
dumval = 0;
|
return;
|
||||||
|
|
||||||
Etmp(s);
|
Etmp(s);
|
||||||
f = fopen(s, "w");
|
f = fopen(s, "w");
|
||||||
|
@ -933,6 +933,8 @@ Real_SaveSnapInfo(int dumval, void *dumdat)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
Esnprintf(buf, sizeof(buf), "%s.snapshots.%i", GetGenericSMFile(), root.scr);
|
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);
|
E_mv(s, buf);
|
||||||
if (!isfile(buf))
|
if (!isfile(buf))
|
||||||
Alert(_("Error saving snaps file\n"));
|
Alert(_("Error saving snaps file\n"));
|
||||||
|
|
Loading…
Reference in New Issue