Split up and shuffle around some more.
SVN revision: 22236
This commit is contained in:
parent
558a43764f
commit
5b24f41029
138
src/E.h
138
src/E.h
|
@ -27,18 +27,11 @@
|
|||
#define _GNU_SOURCE
|
||||
#include "config.h"
|
||||
|
||||
#define USE_EXT_INIT_WIN 1
|
||||
#include "alert.h"
|
||||
#include "lang.h"
|
||||
#include "util.h"
|
||||
|
||||
#if HAVE_STRDUP
|
||||
#define USE_LIBC_STRDUP 1 /* Use libc strdup if present */
|
||||
#endif
|
||||
#if HAVE_STRNDUP
|
||||
#define USE_LIBC_STRNDUP 1 /* Use libc strndup if present */
|
||||
#endif
|
||||
#if HAVE_SETENV
|
||||
#define USE_LIBC_SETENV 1 /* Use libc setenv if present */
|
||||
#endif
|
||||
#define USE_LIBC_MALLOC 1 /* Use unwrapped libc malloc/realloc/free */
|
||||
#define USE_EXT_INIT_WIN 1
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
|
@ -91,14 +84,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE___ATTRIBUTE__
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
#define __PRINTF__ __attribute__((__format__(__printf__, 1, 2)))
|
||||
#else
|
||||
#define __UNUSED__
|
||||
#define __PRINTF__
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETCWD
|
||||
#error "ERROR: Enlightenment needs a system with getcwd() in it's libs."
|
||||
#error "You may have to upgrade your Operating system, Distribution, base"
|
||||
|
@ -114,44 +99,6 @@
|
|||
|
||||
#define FILEPATH_LEN_MAX 4096
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define Evsnprintf vsnprintf
|
||||
#define Esnprintf snprintf
|
||||
#else /* HAVE_SNPRINTF */
|
||||
int Evsnprintf(char *str, size_t count, const char *fmt,
|
||||
va_list args);
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
int Esnprintf(char *str, size_t count, const char *fmt, ...);
|
||||
|
||||
#else
|
||||
int Esnprintf(va_alist);
|
||||
#endif
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
|
||||
/* This is a start to providing internationalization by means */
|
||||
/* of gettext */
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(String) gettext(String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop(String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
# define bindtextdomain(pkg,locale)
|
||||
# define textdomain(pkg)
|
||||
# define bind_textdomain_codeset(pkg,enc)
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
@ -583,12 +530,6 @@ int execApplication(const char *params);
|
|||
void Espawn(int argc, char **argv);
|
||||
void EspawnCmd(const char *cmd);
|
||||
|
||||
/* alert.c */
|
||||
void Alert(const char *fmt, ...);
|
||||
void AlertX(const char *title, const char *ignore,
|
||||
const char *restart, const char *quit,
|
||||
const char *fmt, ...);
|
||||
|
||||
/* arrange.c */
|
||||
#define ARRANGE_VERBATIM 0
|
||||
#define ARRANGE_BY_SIZE 1
|
||||
|
@ -806,13 +747,6 @@ int HandleIPC(const char *params, Client * c);
|
|||
int EFunc(EWin * ewin, const char *params);
|
||||
void EFuncDefer(EWin * ewin, const char *params);
|
||||
|
||||
/* lang.c */
|
||||
void LangInit(void);
|
||||
char *EstrLoc2Int(const char *str, int len);
|
||||
char *EstrUtf82Int(const char *str, int len);
|
||||
const char *EstrInt2Enc(const char *str, int want_utf8);
|
||||
void EstrInt2EncFree(const char *str, int want_utf8);
|
||||
|
||||
/* main.c */
|
||||
void EExit(int exitcode);
|
||||
const char *EDirRoot(void);
|
||||
|
@ -823,48 +757,14 @@ void EDirMake(const char *base, const char *name);
|
|||
const char *EGetSavePrefix(void);
|
||||
const char *EGetSavePrefixCommon(void);
|
||||
|
||||
/* memory.c */
|
||||
#define Ecalloc calloc
|
||||
#define Emalloc malloc
|
||||
#define Efree free
|
||||
#define Erealloc realloc
|
||||
|
||||
#define _EFREE(p) do { if (p) { Efree(p); p = NULL; } } while (0)
|
||||
#define _EFDUP(p, s) do { if (p) Efree(p); p = Estrdup(s); } while (0)
|
||||
|
||||
char *Estrtrim(char *s);
|
||||
|
||||
#if USE_LIBC_STRDUP
|
||||
#define Estrdup(s) ((s) ? strdup(s) : NULL)
|
||||
#else
|
||||
char *Estrdup(const char *s);
|
||||
#endif
|
||||
#if USE_LIBC_STRNDUP
|
||||
#define Estrndup(s,n) ((s) ? strndup(s,n) : NULL)
|
||||
#else
|
||||
char *Estrndup(const char *s, int n);
|
||||
#endif
|
||||
#if USE_LIBC_SETENV
|
||||
#define Esetenv setenv
|
||||
#else
|
||||
int Esetenv(const char *name, const char *value, int overwrite);
|
||||
#endif
|
||||
char *Estrdupcat2(char *ss, const char *s1, const char *s2);
|
||||
|
||||
char **StrlistDup(char **lst, int num);
|
||||
void StrlistFree(char **lst, int num);
|
||||
char *StrlistJoin(char **lst, int num);
|
||||
char *StrlistEncodeEscaped(char *buf, int len, char **lst,
|
||||
int num);
|
||||
char **StrlistDecodeEscaped(const char *str, int *pnum);
|
||||
char **StrlistFromString(const char *str, int delim, int *num);
|
||||
|
||||
/* misc.c */
|
||||
void Quicksort(void **a, int l, int r,
|
||||
int (*CompareFunc) (void *d1, void *d2));
|
||||
void ETimedLoopInit(int k1, int k2, int speed);
|
||||
int ETimedLoopNext(void);
|
||||
void __PRINTF__ Eprintf(const char *fmt, ...);
|
||||
|
||||
/* mod-misc.c */
|
||||
void autosave(void);
|
||||
|
||||
/* moveresize.c */
|
||||
int ActionMoveStart(EWin * ewin, int grab, char constrained,
|
||||
|
@ -901,30 +801,6 @@ int GetPointerScreenGeometry(int *px, int *py,
|
|||
int GetPointerScreenAvailableArea(int *px, int *py,
|
||||
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
|
||||
|
||||
#define ESESSION_INIT 0
|
||||
#define ESESSION_START 1
|
||||
#define ESESSION_STOP 2
|
||||
|
||||
void SessionInit(void);
|
||||
void SessionSave(int shutdown);
|
||||
void SessionExit(int mode, const char *params);
|
||||
void SessionHelper(int when);
|
||||
void ProcessICEMSGS(void);
|
||||
int GetSMfd(void);
|
||||
void SessionGetInfo(EWin * ewin, Atom atom_change);
|
||||
void SetSMID(const char *smid);
|
||||
void MatchEwinToSM(EWin * ewin);
|
||||
void autosave(void);
|
||||
void SettingsSession(void);
|
||||
|
||||
/* settings.c */
|
||||
void SettingsMoveResize(void);
|
||||
void SettingsPlacement(void);
|
||||
|
|
|
@ -19,6 +19,7 @@ e16_SOURCES = \
|
|||
aclass.h \
|
||||
actions.c \
|
||||
alert.c \
|
||||
alert.h \
|
||||
arrange.c \
|
||||
backgrounds.c \
|
||||
backgrounds.h \
|
||||
|
@ -80,6 +81,7 @@ e16_SOURCES = \
|
|||
icons.h \
|
||||
ipc.c \
|
||||
lang.c \
|
||||
lang.h \
|
||||
main.c \
|
||||
memory.c \
|
||||
menus.c \
|
||||
|
@ -95,6 +97,7 @@ e16_SOURCES = \
|
|||
regex.c \
|
||||
screen.c \
|
||||
session.c \
|
||||
session.h \
|
||||
settings.c \
|
||||
setup.c \
|
||||
size.c \
|
||||
|
@ -112,6 +115,7 @@ e16_SOURCES = \
|
|||
timers.h \
|
||||
tooltips.c \
|
||||
tooltips.h \
|
||||
util.h \
|
||||
ttfont.c \
|
||||
warp.c \
|
||||
windowmatch.c \
|
||||
|
|
27
src/alert.c
27
src/alert.c
|
@ -21,7 +21,19 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "E.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "alert.h"
|
||||
#include "lang.h"
|
||||
#include "session.h"
|
||||
#include "util.h"
|
||||
|
||||
/* Should be elsewhere */
|
||||
void SoundPlay(const char *name);
|
||||
|
||||
#define ExTextExtents XmbTextExtents
|
||||
#define ExDrawString XmbDrawString
|
||||
|
@ -173,6 +185,8 @@ ShowAlert(const char *title,
|
|||
XFontStruct **font_struct_list_return;
|
||||
char **font_name_list_return;
|
||||
|
||||
SoundPlay("SOUND_ALERT");
|
||||
|
||||
if (!text)
|
||||
return;
|
||||
|
||||
|
@ -509,17 +523,14 @@ ShowAlert(const char *title,
|
|||
|
||||
switch (button)
|
||||
{
|
||||
default:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (getpid() == Mode.wm.pid)
|
||||
SessionExit(EEXIT_RESTART, NULL);
|
||||
SessionExit(EEXIT_RESTART, NULL);
|
||||
break;
|
||||
case 3:
|
||||
if (getpid() == Mode.wm.pid)
|
||||
SessionExit(EEXIT_EXIT, NULL);
|
||||
break;
|
||||
default:
|
||||
SessionExit(EEXIT_EXIT, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -543,7 +554,6 @@ AlertX(const char *title, const char *ignore,
|
|||
Evsnprintf(text, sizeof(text), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
SoundPlay("SOUND_ALERT");
|
||||
ShowAlert(title, ignore, restart, quit, text);
|
||||
}
|
||||
|
||||
|
@ -557,7 +567,6 @@ Alert(const char *fmt, ...)
|
|||
Evsnprintf(text, sizeof(text), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
SoundPlay("SOUND_ALERT");
|
||||
ShowAlert(_("Enlightenment Message Dialog"), _("Ignore this"),
|
||||
_("Restart Enlightenment"), _("Quit Enlightenment"), text);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2006 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2006 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _ALERT_H_
|
||||
#define _ALERT_H_
|
||||
|
||||
/* alert.c */
|
||||
void Alert(const char *fmt, ...);
|
||||
void AlertX(const char *title, const char *ignore,
|
||||
const char *restart, const char *quit,
|
||||
const char *fmt, ...);
|
||||
|
||||
#endif /* _ALERT_H_ */
|
|
@ -29,6 +29,7 @@
|
|||
#include "conf.h"
|
||||
#include "iclass.h"
|
||||
#include "menus.h"
|
||||
#include "session.h"
|
||||
#include "tclass.h"
|
||||
#include "tooltips.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "E.h"
|
||||
#include "aclass.h"
|
||||
#include "emodule.h"
|
||||
#include "session.h"
|
||||
#include "timers.h"
|
||||
#include "xwin.h"
|
||||
#include <sys/time.h>
|
||||
|
|
|
@ -392,6 +392,9 @@ EWin *EwinFindByString(const char *win, int type);
|
|||
EWin **EwinListTransients(const EWin * ewin, int *num, int group);
|
||||
EWin **EwinListTransientFor(const EWin * ewin, int *num);
|
||||
|
||||
/* session.c */
|
||||
void SessionGetInfo(EWin * ewin, Atom atom_change);
|
||||
|
||||
/* size.c */
|
||||
void MaxSize(EWin * ewin, const char *resize_type);
|
||||
void MaxWidth(EWin * ewin, const char *resize_type);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "E.h"
|
||||
#include "session.h"
|
||||
#include "xwin.h"
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "e16-ecore_hints.h"
|
||||
#include "ewins.h"
|
||||
#include "hints.h"
|
||||
#include "session.h"
|
||||
#include "xwin.h"
|
||||
#if USE_XSYNC
|
||||
#include <X11/extensions/sync.h>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "ewins.h"
|
||||
#include "ewin-ops.h"
|
||||
#include "hints.h" /* FIXME - Should not be here */
|
||||
#include "session.h"
|
||||
#include "snaps.h"
|
||||
#include "timers.h"
|
||||
#include "xwin.h"
|
||||
|
|
11
src/lang.c
11
src/lang.c
|
@ -22,11 +22,22 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "E.h"
|
||||
#include "lang.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_NLS
|
||||
#define bindtextdomain(pkg,locale)
|
||||
#define textdomain(pkg)
|
||||
#define bind_textdomain_codeset(pkg,enc)
|
||||
#endif
|
||||
|
||||
#if HAVE_ICONV
|
||||
|
||||
#include <iconv.h>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2006 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2006 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _LANG_H_
|
||||
#define _LANG_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(String) gettext(String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop(String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
/* lang.c */
|
||||
void LangInit(void);
|
||||
char *EstrLoc2Int(const char *str, int len);
|
||||
char *EstrUtf82Int(const char *str, int len);
|
||||
const char *EstrInt2Enc(const char *str, int want_utf8);
|
||||
void EstrInt2EncFree(const char *str, int want_utf8);
|
||||
|
||||
#endif /* _LANG_H_ */
|
|
@ -26,6 +26,7 @@
|
|||
#include "dialog.h"
|
||||
#include "emodule.h"
|
||||
#include "hints.h"
|
||||
#include "session.h"
|
||||
#include "snaps.h"
|
||||
#include "timestamp.h"
|
||||
#include "xwin.h"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "emodule.h"
|
||||
#include "session.h"
|
||||
#include "snaps.h"
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -233,3 +234,18 @@ EModule ModMisc = {
|
|||
,
|
||||
{N_CFG_ITEMS, MiscCfgItems}
|
||||
};
|
||||
|
||||
void
|
||||
autosave(void)
|
||||
{
|
||||
if (!Mode.wm.save_ok)
|
||||
return;
|
||||
|
||||
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||
Eprintf("autosave\n");
|
||||
|
||||
Real_SaveSnapInfo(0, NULL);
|
||||
|
||||
/* Save the configuration parameters */
|
||||
ConfigurationSave();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "e16-ecore_hints.h"
|
||||
#include "emodule.h"
|
||||
#include "ewins.h"
|
||||
#include "session.h"
|
||||
#include "snaps.h"
|
||||
#include "xwin.h"
|
||||
#include <fcntl.h>
|
||||
|
@ -55,21 +56,6 @@ static int sm_fd = -1;
|
|||
/* True if we are saving state for a doExit("restart") */
|
||||
static int restarting = False;
|
||||
|
||||
void
|
||||
autosave(void)
|
||||
{
|
||||
if (!Mode.wm.save_ok)
|
||||
return;
|
||||
|
||||
if (EventDebug(EDBUG_TYPE_SESSION))
|
||||
Eprintf("autosave\n");
|
||||
|
||||
Real_SaveSnapInfo(0, NULL);
|
||||
|
||||
/* Save the configuration parameters */
|
||||
ConfigurationSave();
|
||||
}
|
||||
|
||||
#ifdef HAVE_X11_SM_SMLIB_H
|
||||
|
||||
#include <X11/SM/SMlib.h>
|
||||
|
@ -680,6 +666,10 @@ SessionLogoutConfirm(void)
|
|||
void
|
||||
SessionExit(int mode, const char *param)
|
||||
{
|
||||
/* We do not want to be exited by children. */
|
||||
if (getpid() != Mode.wm.pid)
|
||||
return;
|
||||
|
||||
if (mode == EEXIT_LOGOUT)
|
||||
{
|
||||
if (Conf.session.enable_logout_dialog)
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2006 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2006 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _SESSION_H_
|
||||
#define _SESSION_H_
|
||||
|
||||
/* 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
|
||||
|
||||
#define ESESSION_INIT 0
|
||||
#define ESESSION_START 1
|
||||
#define ESESSION_STOP 2
|
||||
|
||||
void SessionInit(void);
|
||||
void SessionSave(int shutdown);
|
||||
void SessionExit(int mode, const char *params);
|
||||
void SessionHelper(int when);
|
||||
void ProcessICEMSGS(void);
|
||||
int GetSMfd(void);
|
||||
void SetSMID(const char *smid);
|
||||
void SettingsSession(void);
|
||||
|
||||
#endif /* _SESSION_H_ */
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
#include "emodule.h"
|
||||
#include "session.h"
|
||||
|
||||
#define ENABLE_THEME_SANITY_CHECKING 0
|
||||
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2006 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2006 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _UTIL_H_
|
||||
#define _UTIL_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE___ATTRIBUTE__
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
#define __PRINTF__ __attribute__((__format__(__printf__, 1, 2)))
|
||||
#else
|
||||
#define __UNUSED__
|
||||
#define __PRINTF__
|
||||
#endif
|
||||
|
||||
#if HAVE_STRDUP
|
||||
#define USE_LIBC_STRDUP 1 /* Use libc strdup if present */
|
||||
#endif
|
||||
#if HAVE_STRNDUP
|
||||
#define USE_LIBC_STRNDUP 1 /* Use libc strndup if present */
|
||||
#endif
|
||||
#if HAVE_SETENV
|
||||
#define USE_LIBC_SETENV 1 /* Use libc setenv if present */
|
||||
#endif
|
||||
|
||||
/* memory.c */
|
||||
#define Ecalloc calloc
|
||||
#define Emalloc malloc
|
||||
#define Efree free
|
||||
#define Erealloc realloc
|
||||
|
||||
#define _EFREE(p) do { if (p) { Efree(p); p = NULL; } } while (0)
|
||||
#define _EFDUP(p, s) do { if (p) Efree(p); p = Estrdup(s); } while (0)
|
||||
|
||||
char *Estrtrim(char *s);
|
||||
|
||||
#if USE_LIBC_STRDUP
|
||||
#define Estrdup(s) ((s) ? strdup(s) : NULL)
|
||||
#else
|
||||
char *Estrdup(const char *s);
|
||||
#endif
|
||||
|
||||
#if USE_LIBC_STRNDUP
|
||||
#define Estrndup(s,n) ((s) ? strndup(s,n) : NULL)
|
||||
#else
|
||||
char *Estrndup(const char *s, int n);
|
||||
#endif
|
||||
|
||||
char *Estrdupcat2(char *ss, const char *s1, const char *s2);
|
||||
|
||||
#if USE_LIBC_SETENV
|
||||
#define Esetenv setenv
|
||||
#else
|
||||
int Esetenv(const char *name, const char *value, int overwrite);
|
||||
#endif
|
||||
|
||||
char **StrlistDup(char **lst, int num);
|
||||
void StrlistFree(char **lst, int num);
|
||||
char *StrlistJoin(char **lst, int num);
|
||||
char *StrlistEncodeEscaped(char *buf, int len, char **lst,
|
||||
int num);
|
||||
char **StrlistDecodeEscaped(const char *str, int *pnum);
|
||||
char **StrlistFromString(const char *str, int delim, int *num);
|
||||
|
||||
/* misc.c */
|
||||
void __PRINTF__ Eprintf(const char *fmt, ...);
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define Evsnprintf vsnprintf
|
||||
#define Esnprintf snprintf
|
||||
#else /* HAVE_SNPRINTF */
|
||||
int Evsnprintf(char *str, size_t count, const char *fmt,
|
||||
va_list args);
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
int Esnprintf(char *str, size_t count, const char *fmt, ...);
|
||||
|
||||
#else
|
||||
int Esnprintf(va_alist);
|
||||
#endif
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
|
||||
#endif /* _UTIL_H_ */
|
Loading…
Reference in New Issue