Enable building without session management support.

SVN revision: 30898
This commit is contained in:
Kim Woelders 2007-07-18 11:18:50 +00:00
parent 1d2f6424d1
commit 526207fd99
4 changed files with 35 additions and 21 deletions

View File

@ -126,7 +126,17 @@ AC_CHECK_LIB(Imlib2, imlib_context_set_mask_alpha_threshold,
[Imlib2 has imlib_context_set_mask_alpha_threshold]),,
$IMLIB2_LIBS)
AC_CHECK_HEADERS(X11/SM/SMlib.h, enable_sm=yes, enable_sm=no)
AC_ARG_ENABLE(sm,
[ --enable-sm compile with session management support @<:@default=yes@:>@],,
enable_sm=yes)
if test "x$enable_sm" = "xyes"; then
AC_CHECK_HEADERS(X11/SM/SMlib.h,, enable_sm=no)
AC_CHECK_LIB(SM, SmcOpenConnection, SM_LIBS="-lSM -lICE", enable_sm=no)
AC_SUBST(SM_LIBS)
fi
if test "x$enable_sm" = "xyes"; then
AC_DEFINE(HAVE_SM, 1, [Session management support])
fi
AC_ARG_ENABLE(xft,
[ --enable-xft compile with Xft support @<:@default=yes@:>@],,

View File

@ -39,8 +39,12 @@
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#ifdef HAVE_SM
#define USE_SM 1
#endif
#ifdef HAVE_XSYNC
#define USE_XSYNC 1 /* Experimental */
#define USE_XSYNC 1
#endif
#ifdef HAVE_XSCREENSAVER

View File

@ -119,8 +119,8 @@ LDADD = \
$(IMLIB2_LIBS) \
$(GLX_LIBS) \
$(XFT_LIBS) \
$(X_PRE_LIBS) \
$(X_LIBS) \
$(SM_LIBS) \
$(XINERAMA_LIBS) \
$(X_EXTRA_LIBS) \
$(E_X_LIBS) \

View File

@ -59,7 +59,7 @@ static int sm_fd = -1;
/* True if we are saving state for a doExit("restart") */
static int restarting = False;
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
#include <X11/SM/SMlib.h>
@ -321,12 +321,12 @@ ice_io_error_handler(IceConn connection __UNUSED__)
* exit(1) instead of closing the losing connection. */
}
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
void
SessionInit(void)
{
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
static SmPointer context;
SmcCallbacks callbacks;
#endif
@ -334,7 +334,7 @@ SessionInit(void)
if (Mode.wm.window)
return;
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
#if 0 /* Unused */
atom_sm_client_id = XInternAtom(disp, "SM_CLIENT_ID", False);
#endif
@ -395,7 +395,7 @@ SessionInit(void)
SmcSetProperties(sm_conn, 1, props);
fcntl(sm_fd, F_SETFD, fcntl(sm_fd, F_GETFD, 0) | FD_CLOEXEC);
}
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
if (!Conf.session.script)
Conf.session.script = Estrdup("$EROOT/scripts/session.sh");
@ -408,7 +408,7 @@ SessionInit(void)
void
ProcessICEMSGS(void)
{
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
IceProcessMessagesStatus status;
if (sm_fd < 0)
@ -427,7 +427,7 @@ ProcessICEMSGS(void)
sm_conn = NULL;
sm_fd = -1;
}
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
}
int
@ -440,7 +440,7 @@ void
SessionGetInfo(EWin * ewin)
{
#if 0 /* Unused */
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
if (atom_sm_client_id == None)
return;
_EFREE(ewin->session_id);
@ -450,7 +450,7 @@ SessionGetInfo(EWin * ewin)
atom_sm_client_id);
#else
ewin = NULL;
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
#endif
ewin = NULL;
}
@ -458,11 +458,11 @@ SessionGetInfo(EWin * ewin)
void
SetSMID(const char *smid)
{
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
sm_client_id = Estrdup(smid);
#else
smid = NULL;
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
}
void
@ -473,14 +473,14 @@ SessionSave(int shutdown)
/* dont' need anymore */
/* autosave(); */
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
if (shutdown && sm_conn)
{
SmcCloseConnection(sm_conn, 0, NULL);
sm_conn = NULL;
sm_fd = -1;
}
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
}
/*
@ -555,7 +555,7 @@ doSMExit(int mode, const char *params)
else if (!Mode.wm.master)
l +=
Esnprintf(s + l, sizeof(s) - l, " -m %d", Mode.wm.master_screen);
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
if (sm_client_id)
l += Esnprintf(s + l, sizeof(s) - l, " -S %s", sm_client_id);
#endif
@ -581,14 +581,14 @@ doSMExit(int mode, const char *params)
static void
SessionLogout(void)
{
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
if (sm_conn)
{
SmcRequestSaveYourself(sm_conn, SmSaveBoth, True, SmInteractStyleAny,
False, True);
}
else
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
{
SessionExit(EEXIT_EXIT, NULL);
}
@ -597,13 +597,13 @@ SessionLogout(void)
static void
LogoutCB(Dialog * d, int val, void *data __UNUSED__)
{
#ifdef HAVE_X11_SM_SMLIB_H
#if USE_SM
if (sm_conn)
{
SessionLogout();
}
else
#endif /* HAVE_X11_SM_SMLIB_H */
#endif /* USE_SM */
{
/* 0:LogOut -: No -or- */
/* 0:Halt 1:Reboot 2:LogOut -:No */