Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h alert.c config.c handlers.c icccm.c ipc.c mod-misc.c
session.c settings.c theme.c
Log Message:
Optionally bypass logout dialog, optionally add reboot/halt to logout dialog.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.349
retrieving revision 1.350
diff -u -3 -r1.349 -r1.350
--- E.h 25 Jan 2005 21:55:44 -0000 1.349
+++ E.h 29 Jan 2005 07:11:51 -0000 1.350
@@ -906,6 +906,13 @@
} place;
struct
{
+ char enable_logout_dialog;
+ char enable_reboot_halt;
+ char *cmd_reboot;
+ char *cmd_halt;
+ } session;
+ struct
+ {
char enable;
int edge_snap_dist;
int screen_snap_dist;
@@ -2030,9 +2037,16 @@
int *pw, int *ph);
/* session.c */
+#define EEXIT_EXIT 0
+#define EEXIT_ERROR 1
+#define EEXIT_LOGOUT 2
+#define EEXIT_RESTART 3
+#define EEXIT_THEME 4
+#define EEXIT_EXEC 5
+
void SessionInit(void);
void SessionSave(int shutdown);
-int SessionExit(const void *params);
+void SessionExit(int mode, const char *params);
void ProcessICEMSGS(void);
int GetSMfd(void);
void SessionGetInfo(EWin * ewin, Atom atom_change);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/alert.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- alert.c 25 Jan 2005 21:56:09 -0000 1.38
+++ alert.c 29 Jan 2005 07:11:56 -0000 1.39
@@ -27,19 +27,13 @@
static void ShowAlert(char *text);
-static int (*IgnoreFunction) (const void *) = NULL;
-static const void *IgnoreParams = NULL;
+static char *TitleText = NULL;
+
static char *IgnoreText = NULL;
-static int (*RestartFunction) (const void *) = NULL;
-static const void *RestartParams = NULL;
static char *RestartText = NULL;
-static int (*ExitFunction) (const void *) = NULL;
-static const void *ExitParams = NULL;
static char *ExitText = NULL;
-static char *TitleText = NULL;
-
-XFontSet xfs = NULL;
+static XFontSet xfs = NULL;
#define DRAW_BOX_OUT(mdd, mgc, mwin, mx, my, mw, mh) \
AlertDrawBox(mdd, mgc, mwin, mx, my, mw, mh, \
@@ -494,16 +488,12 @@
switch (button)
{
case 1:
- if (IgnoreFunction)
- IgnoreFunction(IgnoreParams);
break;
case 2:
- if (RestartFunction)
- RestartFunction(RestartParams);
+ SessionExit(EEXIT_RESTART, NULL);
break;
case 3:
- if (ExitFunction)
- ExitFunction(ExitParams);
+ SessionExit(EEXIT_EXIT, NULL);
break;
default:
break;
@@ -576,30 +566,6 @@
}
}
-#if 0
-static void
-AssignIgnoreFunction(int (*FunctionToAssign) (const void *), const void
*params)
-{
- IgnoreFunction = FunctionToAssign;
- IgnoreParams = params;
-}
-#endif
-
-static void
-AssignRestartFunction(int (*FunctionToAssign) (const void *),
- const void *params)
-{
- RestartFunction = FunctionToAssign;
- RestartParams = params;
-}
-
-static void
-AssignExitFunction(int (*FunctionToAssign) (const void *), const void *params)
-{
- ExitFunction = FunctionToAssign;
- ExitParams = params;
-}
-
void
AlertInit(void)
{
@@ -608,10 +574,6 @@
AssignIgnoreText(_("Ignore this"));
AssignRestartText(_("Restart Enlightenment"));
AssignExitText(_("Quit Enlightenment"));
-
- /* We'll set up what the buttons do now, too */
- AssignRestartFunction(SessionExit, "restart");
- AssignExitFunction(SessionExit, NULL);
}
void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- config.c 25 Jan 2005 21:56:48 -0000 1.123
+++ config.c 29 Jan 2005 07:11:56 -0000 1.124
@@ -198,7 +198,7 @@
"This is a FATAL ERROR.\n"
"This is probably due to either the program not existing or\n"
"it not being able to be executed by you.\n"), epp_path);
- SessionExit("error");
+ SessionExit(EEXIT_ERROR, NULL);
}
have_epp = 1;
@@ -302,7 +302,7 @@
"a while and this theme takes advantages of new\n"
"features in Enlightenment in new versions.\n"),
e_cfg_ver, min_e_cfg_ver);
- SessionExit("restart_theme DEFAULT");
+ SessionExit(EEXIT_THEME, "DEFAULT");
}
else
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/handlers.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- handlers.c 25 Jan 2005 21:57:22 -0000 1.42
+++ handlers.c 29 Jan 2005 07:11:57 -0000 1.43
@@ -36,7 +36,7 @@
switch (sig)
{
case SIGHUP:
- SessionExit("restart");
+ SessionExit(EEXIT_RESTART, NULL);
break;
default:
@@ -44,7 +44,7 @@
case SIGQUIT:
case SIGABRT:
case SIGTERM:
- SessionExit("error");
+ SessionExit(EEXIT_ERROR, NULL);
break;
case SIGPIPE:
@@ -64,7 +64,7 @@
"either obtain the correct package for your system, or\n"
"re-compile Enlightenment and possibly any support
libraries\n"
"that you got in binary format to run Enlightenment.\n"));
- SessionExit("error");
+ SessionExit(EEXIT_ERROR, NULL);
break;
case SIGFPE:
@@ -80,7 +80,7 @@
"Enlightenment under gdb so you can backtrace for where it
died and\n"
"send in a useful bug report with backtrace information
and variable\n"
"dumps etc.\n"));
- SessionExit("error");
+ SessionExit(EEXIT_ERROR, NULL);
break;
case SIGSEGV:
@@ -222,5 +222,5 @@
HandleXIOError(Display * d __UNUSED__)
{
disp = NULL;
- SessionExit("error");
+ SessionExit(EEXIT_ERROR, NULL);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -3 -r1.82 -r1.83
--- icccm.c 22 Jan 2005 11:32:58 -0000 1.82
+++ icccm.c 29 Jan 2005 07:11:57 -0000 1.83
@@ -93,7 +93,7 @@
{
a = event->data.l[0];
if (a == ECORE_X_ATOM_WM_DELETE_WINDOW && event->window == VRoot.win)
- SessionExit(NULL);
+ SessionExit(EEXIT_EXIT, NULL);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -3 -r1.194 -r1.195
--- ipc.c 23 Jan 2005 16:30:46 -0000 1.194
+++ ipc.c 29 Jan 2005 07:11:57 -0000 1.195
@@ -932,29 +932,27 @@
static void
IPC_Restart(const char *params __UNUSED__, Client * c __UNUSED__)
{
- SessionExit("restart");
+ SessionExit(EEXIT_RESTART, NULL);
}
static void
-IPC_RestartWM(const char *params, Client * c __UNUSED__)
+IPC_Exit(const char *params, Client * c __UNUSED__)
{
- char buf[FILEPATH_LEN_MAX];
+ char param1[FILEPATH_LEN_MAX];
- if (params)
- {
- Esnprintf(buf, sizeof(buf), "restart_wm %s", params);
- SessionExit(buf);
- }
- else
- {
- IpcPrintf("Error: no window manager specified");
- }
-}
+ param1[0] = 0;
+ word(params, 1, param1);
-static void
-IPC_Exit(const char *params, Client * c __UNUSED__)
-{
- SessionExit(params);
+ if (!param1[0])
+ SessionExit(EEXIT_EXIT, NULL);
+ else if (!strcmp(param1, "logout"))
+ SessionExit(EEXIT_LOGOUT, NULL);
+ else if (!strcmp(param1, "restart"))
+ SessionExit(EEXIT_RESTART, NULL);
+ else if (!strcmp(param1, "theme"))
+ SessionExit(EEXIT_THEME, atword(params, 2));
+ else if (!strcmp(param1, "exec"))
+ SessionExit(EEXIT_EXEC, atword(params, 2));
}
static void
@@ -1486,12 +1484,6 @@
"Restart Enlightenment",
NULL},
{
- IPC_RestartWM,
- "restart_wm", NULL,
- "Restart another window manager",
- "Use \"restart_wm <wmname>\" to start another window manager.\n"
- "Example: \"restart_wm fvwm\"\n"},
- {
IPC_Exit,
"exit", "q",
"Exit Enlightenment",
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/mod-misc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- mod-misc.c 25 Jan 2005 21:57:44 -0000 1.5
+++ mod-misc.c 29 Jan 2005 07:11:58 -0000 1.6
@@ -175,6 +175,11 @@
CFG_ITEM_BOOL(Conf, place.ignore_struts, 0),
CFG_ITEM_BOOL(Conf, place.raise_fullscreen, 0),
+ CFG_ITEM_BOOL(Conf, session.enable_logout_dialog, 1),
+ CFG_ITEM_BOOL(Conf, session.enable_reboot_halt, 0),
+ CFG_ITEM_STR(Conf, session.cmd_reboot),
+ CFG_ITEM_STR(Conf, session.cmd_halt),
+
CFG_ITEM_BOOL(Conf, snap.enable, 1),
CFG_ITEM_INT(Conf, snap.edge_snap_dist, 8),
CFG_ITEM_INT(Conf, snap.screen_snap_dist, 32),
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- session.c 22 Jan 2005 11:32:58 -0000 1.84
+++ session.c 29 Jan 2005 07:11:58 -0000 1.85
@@ -530,7 +530,7 @@
* a suicide clause at the end.
*/
static void
-callback_save_yourself2(SmcConn smc_conn, SmPointer client_data)
+callback_save_yourself2(SmcConn smc_conn, SmPointer client_data __UNUSED__)
{
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("callback_save_yourself2\n");
@@ -560,12 +560,12 @@
SmcSaveYourselfDone(smc_conn, True);
if (restarting)
EExit(0);
- client_data = NULL;
}
static void
-callback_save_yourself(SmcConn smc_conn, SmPointer client_data, int save_style,
- Bool shutdown, int interact_style, Bool fast)
+callback_save_yourself(SmcConn smc_conn, SmPointer client_data __UNUSED__,
+ int save_style __UNUSED__, Bool shutdown __UNUSED__,
+ int interact_style __UNUSED__, Bool fast __UNUSED__)
{
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("callback_save_yourself\n");
@@ -601,15 +601,10 @@
SaveWindowStates();
#endif
SmcRequestSaveYourselfPhase2(smc_conn, callback_save_yourself2, NULL);
- client_data = NULL;
- save_style = 0;
- shutdown = 0;
- interact_style = 0;
- fast = 0;
}
static void
-callback_die(SmcConn smc_conn, SmPointer client_data)
+callback_die(SmcConn smc_conn __UNUSED__, SmPointer client_data __UNUSED__)
{
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("callback_die\n");
@@ -617,28 +612,23 @@
if (Mode.wm.master)
SoundPlay("SOUND_EXIT");
EExit(0);
- smc_conn = 0;
- client_data = NULL;
}
static void
-callback_save_complete(SmcConn smc_conn, SmPointer client_data)
+callback_save_complete(SmcConn smc_conn __UNUSED__,
+ SmPointer client_data __UNUSED__)
{
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("callback_save_complete\n");
-
- smc_conn = 0;
- client_data = NULL;
}
static void
-callback_shutdown_cancelled(SmcConn smc_conn, SmPointer client_data)
+callback_shutdown_cancelled(SmcConn smc_conn, SmPointer client_data __UNUSED__)
{
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("callback_shutdown_cancelled\n");
SmcSaveYourselfDone(smc_conn, False);
- client_data = NULL;
}
static Atom atom_sm_client_id;
@@ -731,6 +721,11 @@
#if 0 /* Unused */
LoadWindowStates();
#endif
+
+ if (!Conf.session.cmd_reboot)
+ Conf.session.cmd_reboot = Estrdup("reboot");
+ if (!Conf.session.cmd_halt)
+ Conf.session.cmd_halt = Estrdup("poweroff");
}
void
@@ -812,22 +807,6 @@
#endif /* HAVE_X11_SM_SMLIB_H */
}
-static void
-LogoutCB(Dialog * d __UNUSED__, int val __UNUSED__, void *data __UNUSED__)
-{
-#ifdef HAVE_X11_SM_SMLIB_H
- if (sm_conn)
- {
- SmcRequestSaveYourself(sm_conn, SmSaveBoth, True, SmInteractStyleAny,
- False, True);
- }
- else
-#endif /* HAVE_X11_SM_SMLIB_H */
- {
- SessionExit(NULL);
- }
-}
-
void
SessionSave(int shutdown)
{
@@ -856,23 +835,21 @@
* so the our clients remain frozen while we are down.
*/
static void
-doSMExit(const void *params)
+doSMExit(int mode, const char *params)
{
int l;
- char s[1024], s2[1024];
+ char s[1024];
+ const char *ss;
if (EventDebug(EDBUG_TYPE_SESSION))
- Eprintf("doSMExit: %p\n", params);
+ Eprintf("doSMExit: mode=%d prm=%p\n", mode, params);
restarting = True;
- s[0] = s2[0] = '\0';
- if (params)
- sscanf(params, "%1000s %1000s", s, s2);
-
#if 0 /* Unused */
SaveWindowStates();
#endif
+
if (!params)
SessionSave(1);
EHintsSetInfoOnAll();
@@ -889,21 +866,23 @@
#endif
}
- if (!params)
- {
- }
- else if (!strcmp(s, "restart_wm"))
+ ss = NULL;
+ switch (mode)
{
+ case EEXIT_EXEC:
+ SoundPlay("SOUND_EXIT");
SoundPlay("SOUND_WAIT");
EDisplayClose();
- Esnprintf(s, sizeof(s), "exec %s", atword(params, 2));
+ Esnprintf(s, sizeof(s), "exec %s", params);
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("doSMExit: %s\n", s);
execl(DEFAULT_SH_PATH, DEFAULT_SH_PATH, "-c", s, NULL);
- }
- else if (!strcmp(s, "restart") || !strcmp((char *)s, "restart_theme"))
- {
+ break;
+
+ case EEXIT_THEME:
+ ss = params;
+ case EEXIT_RESTART:
SoundPlay("SOUND_WAIT");
#ifdef USE_EXT_INIT_WIN
if (disp)
@@ -922,13 +901,14 @@
l +=
Esnprintf(s + l, sizeof(s) - l, " -ext_init_win %li",
init_win_ext);
- if (s2[0])
- l += Esnprintf(s + l, sizeof(s) - l, " -t %s", s2);
+ if (ss)
+ l += Esnprintf(s + l, sizeof(s) - l, " -t %s", ss);
if (EventDebug(EDBUG_TYPE_SESSION))
Eprintf("doSMExit: %s\n", s);
execl(DEFAULT_SH_PATH, DEFAULT_SH_PATH, "-c", s, NULL);
+ break;
}
restarting = False;
@@ -937,6 +917,42 @@
}
static void
+SessionLogout(void)
+{
+#ifdef HAVE_X11_SM_SMLIB_H
+ if (sm_conn)
+ {
+ SmcRequestSaveYourself(sm_conn, SmSaveBoth, True, SmInteractStyleAny,
+ False, True);
+ }
+ else
+#endif /* HAVE_X11_SM_SMLIB_H */
+ {
+ doSMExit(EEXIT_EXIT, NULL);
+ }
+}
+
+static void
+LogoutCB(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+{
+#ifdef HAVE_X11_SM_SMLIB_H
+ if (sm_conn)
+ {
+ SessionLogout();
+ }
+ else
+#endif /* HAVE_X11_SM_SMLIB_H */
+ {
+ if (val == 1)
+ SessionExit(EEXIT_EXIT, NULL);
+ if (val == 2)
+ SessionExit(EEXIT_EXEC, Conf.session.cmd_reboot);
+ if (val == 3)
+ SessionExit(EEXIT_EXEC, Conf.session.cmd_halt);
+ }
+}
+
+static void
SessionLogoutConfirm(void)
{
Dialog *d;
@@ -951,8 +967,13 @@
DialogSetText(d, _("\n\n"
" Are you sure you wish to log out ? \n"
"\n\n"));
- DialogAddButton(d, _(" Yes, Log Out "), LogoutCB, 1);
DialogAddButton(d, _(" No "), NULL, 1);
+ DialogAddButton(d, _(" Yes, Log Out "), LogoutCB, 1);
+ if (Conf.session.enable_reboot_halt)
+ {
+ DialogAddButton(d, _(" Yes, Reboot "), LogoutCB, 1);
+ DialogAddButton(d, _(" Yes, Shut Down "), LogoutCB, 1);
+ }
DialogBindKey(d, "Escape", DialogCallbackClose, 1);
DialogBindKey(d, "Return", LogoutCB, 0);
}
@@ -965,13 +986,16 @@
return;
}
-int
-SessionExit(const void *param)
+void
+SessionExit(int mode, const char *param)
{
- if (param && !strcmp(param, "logout"))
+ if (mode == EEXIT_LOGOUT)
{
- SessionLogoutConfirm();
- return 0;
+ if (Conf.session.enable_logout_dialog)
+ SessionLogoutConfirm();
+ else
+ SessionLogout();
+ return;
}
if (Mode.wm.exiting++)
@@ -981,6 +1005,5 @@
exit(1);
}
- doSMExit(param);
- return 0;
+ doSMExit(mode, param);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -3 -r1.129 -r1.130
--- settings.c 12 Jan 2005 23:10:21 -0000 1.129
+++ settings.c 29 Jan 2005 07:11:58 -0000 1.130
@@ -947,12 +947,17 @@
}
static char tmp_dialog_headers;
+static char tmp_logout_dialog;
+static char tmp_reboot_halt;
+
static void
CB_ConfigureMiscellaneous(Dialog * d __UNUSED__, int val, void *data
__UNUSED__)
{
if (val < 2)
{
Conf.dialogs.headers = tmp_dialog_headers;
+ Conf.session.enable_logout_dialog = tmp_logout_dialog;
+ Conf.session.enable_reboot_halt = tmp_reboot_halt;
}
autosave();
}
@@ -963,9 +968,8 @@
Dialog *d;
DItem *table, *di;
- if ((d =
- FindItem("CONFIGURE_MISCELLANEOUS", 0, LIST_FINDBY_NAME,
- LIST_TYPE_DIALOG)))
+ if ((d = FindItem("CONFIGURE_MISCELLANEOUS", 0, LIST_FINDBY_NAME,
+ LIST_TYPE_DIALOG)))
{
SoundPlay("SOUND_SETTINGS_ACTIVE");
ShowDialog(d);
@@ -974,6 +978,8 @@
SoundPlay("SOUND_SETTINGS_MISCELLANEOUS");
tmp_dialog_headers = Conf.dialogs.headers;
+ tmp_logout_dialog = Conf.session.enable_logout_dialog;
+ tmp_reboot_halt = Conf.session.enable_reboot_halt;
d = DialogCreate("CONFIGURE_MISCELLANEOUS");
DialogSetTitle(d, _("Miscellaneous Settings"));
@@ -1009,6 +1015,22 @@
DialogItemCheckButtonSetState(di, tmp_dialog_headers);
DialogItemCheckButtonSetPtr(di, &tmp_dialog_headers);
+ di = DialogAddItem(table, DITEM_CHECKBUTTON);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSetColSpan(di, 2);
+ DialogItemCheckButtonSetText(di, _("Enable Logout Dialog"));
+ DialogItemCheckButtonSetState(di, tmp_logout_dialog);
+ DialogItemCheckButtonSetPtr(di, &tmp_logout_dialog);
+
+ di = DialogAddItem(table, DITEM_CHECKBUTTON);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSetColSpan(di, 2);
+ DialogItemCheckButtonSetText(di, _("Enable Reboot/Halt on Logout"));
+ DialogItemCheckButtonSetState(di, tmp_reboot_halt);
+ DialogItemCheckButtonSetPtr(di, &tmp_reboot_halt);
+
di = DialogAddItem(table, DITEM_SEPARATOR);
DialogItemSetColSpan(di, 2);
DialogItemSetPadding(di, 2, 2, 2, 2);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/theme.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- theme.c 25 Jan 2005 21:58:11 -0000 1.40
+++ theme.c 29 Jan 2005 07:11:59 -0000 1.41
@@ -465,11 +465,8 @@
}
else if (!strcmp(cmd, "use"))
{
- char s[FILEPATH_LEN_MAX];
-
- Esnprintf(s, sizeof(s), "restart_theme %s", prm);
/* FIXME - ThemeCheckIfValid(s) */
- SessionExit(s);
+ SessionExit(EEXIT_THEME, prm);
}
}
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs