Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: E.h Makefile.am alert.c config.c events.c ewins.h handlers.c icccm.c ipc.c lang.c main.c mod-misc.c session.c theme.c Added Files: alert.h lang.h session.h util.h Log Message: Split up and shuffle around some more. =================================================================== RCS file: /cvs/e/e16/e/src/E.h,v retrieving revision 1.546 retrieving revision 1.547 diff -u -3 -r1.546 -r1.547 --- E.h 19 Apr 2006 17:23:34 -0000 1.546 +++ E.h 19 Apr 2006 19:13:46 -0000 1.547 @@ -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 @@ 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 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 @@ 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, @@ -900,30 +800,6 @@ int *pw, int *ph); 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); =================================================================== RCS file: /cvs/e/e16/e/src/Makefile.am,v retrieving revision 1.70 retrieving revision 1.71 diff -u -3 -r1.70 -r1.71 --- Makefile.am 17 Apr 2006 15:55:24 -0000 1.70 +++ Makefile.am 19 Apr 2006 19:13:46 -0000 1.71 @@ -19,6 +19,7 @@ aclass.h \ actions.c \ alert.c \ + alert.h \ arrange.c \ backgrounds.c \ backgrounds.h \ @@ -80,6 +81,7 @@ icons.h \ ipc.c \ lang.c \ + lang.h \ main.c \ memory.c \ menus.c \ @@ -95,6 +97,7 @@ regex.c \ screen.c \ session.c \ + session.h \ settings.c \ setup.c \ size.c \ @@ -112,6 +115,7 @@ timers.h \ tooltips.c \ tooltips.h \ + util.h \ ttfont.c \ warp.c \ windowmatch.c \ =================================================================== RCS file: /cvs/e/e16/e/src/alert.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -3 -r1.49 -r1.50 --- alert.c 18 Apr 2006 23:47:29 -0000 1.49 +++ alert.c 19 Apr 2006 19:13:46 -0000 1.50 @@ -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 @@ XFontStruct **font_struct_list_return; char **font_name_list_return; + SoundPlay("SOUND_ALERT"); + if (!text) return; @@ -509,17 +523,14 @@ 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 @@ Evsnprintf(text, sizeof(text), fmt, args); va_end(args); - SoundPlay("SOUND_ALERT"); ShowAlert(title, ignore, restart, quit, text); } @@ -557,7 +567,6 @@ Evsnprintf(text, sizeof(text), fmt, args); va_end(args); - SoundPlay("SOUND_ALERT"); ShowAlert(_("Enlightenment Message Dialog"), _("Ignore this"), _("Restart Enlightenment"), _("Quit Enlightenment"), text); } =================================================================== RCS file: /cvs/e/e16/e/src/config.c,v retrieving revision 1.146 retrieving revision 1.147 diff -u -3 -r1.146 -r1.147 --- config.c 20 Feb 2006 18:20:29 -0000 1.146 +++ config.c 19 Apr 2006 19:13:46 -0000 1.147 @@ -29,6 +29,7 @@ #include "conf.h" #include "iclass.h" #include "menus.h" +#include "session.h" #include "tclass.h" #include "tooltips.h" =================================================================== RCS file: /cvs/e/e16/e/src/events.c,v retrieving revision 1.119 retrieving revision 1.120 diff -u -3 -r1.119 -r1.120 --- events.c 16 Apr 2006 13:27:37 -0000 1.119 +++ events.c 19 Apr 2006 19:13:46 -0000 1.120 @@ -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> =================================================================== RCS file: /cvs/e/e16/e/src/ewins.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -3 -r1.47 -r1.48 --- ewins.h 15 Apr 2006 18:49:29 -0000 1.47 +++ ewins.h 19 Apr 2006 19:13:46 -0000 1.48 @@ -392,6 +392,9 @@ 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); =================================================================== RCS file: /cvs/e/e16/e/src/handlers.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -3 -r1.52 -r1.53 --- handlers.c 19 Mar 2006 14:59:48 -0000 1.52 +++ handlers.c 19 Apr 2006 19:13:46 -0000 1.53 @@ -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> =================================================================== RCS file: /cvs/e/e16/e/src/icccm.c,v retrieving revision 1.121 retrieving revision 1.122 diff -u -3 -r1.121 -r1.122 --- icccm.c 18 Apr 2006 16:26:51 -0000 1.121 +++ icccm.c 19 Apr 2006 19:13:46 -0000 1.122 @@ -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> =================================================================== RCS file: /cvs/e/e16/e/src/ipc.c,v retrieving revision 1.263 retrieving revision 1.264 diff -u -3 -r1.263 -r1.264 --- ipc.c 18 Apr 2006 17:57:58 -0000 1.263 +++ ipc.c 19 Apr 2006 19:13:46 -0000 1.264 @@ -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" =================================================================== RCS file: /cvs/e/e16/e/src/lang.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- lang.c 7 Jan 2006 07:20:58 -0000 1.9 +++ lang.c 19 Apr 2006 19:13:46 -0000 1.10 @@ -22,9 +22,20 @@ * 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 =================================================================== RCS file: /cvs/e/e16/e/src/main.c,v retrieving revision 1.143 retrieving revision 1.144 diff -u -3 -r1.143 -r1.144 --- main.c 18 Apr 2006 23:47:29 -0000 1.143 +++ main.c 19 Apr 2006 19:13:46 -0000 1.144 @@ -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" =================================================================== RCS file: /cvs/e/e16/e/src/mod-misc.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- mod-misc.c 2 Apr 2006 09:45:40 -0000 1.31 +++ mod-misc.c 19 Apr 2006 19:13:46 -0000 1.32 @@ -22,6 +22,7 @@ */ #include "E.h" #include "emodule.h" +#include "session.h" #include "snaps.h" /*********************************************************************** @@ -233,3 +234,18 @@ , {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(); +} =================================================================== RCS file: /cvs/e/e16/e/src/session.c,v retrieving revision 1.119 retrieving revision 1.120 diff -u -3 -r1.119 -r1.120 --- session.c 9 Apr 2006 09:20:36 -0000 1.119 +++ session.c 19 Apr 2006 19:13:46 -0000 1.120 @@ -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 @@ /* 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 @@ 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) =================================================================== RCS file: /cvs/e/e16/e/src/theme.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- theme.c 7 Jan 2006 07:20:58 -0000 1.55 +++ theme.c 19 Apr 2006 19:13:46 -0000 1.56 @@ -23,6 +23,7 @@ */ #include "E.h" #include "emodule.h" +#include "session.h" #define ENABLE_THEME_SANITY_CHECKING 0 ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs