- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
Lisp_Object Vx_session_previous_id;
/* The option we tell the session manager to start Emacs with when
Lisp_Object Vx_session_previous_id;
/* The option we tell the session manager to start Emacs with when
/* Handle any messages from the session manager. If no connection is
open to a session manager, just return 0.
Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP. */
/* Handle any messages from the session manager. If no connection is
open to a session manager, just return 0.
Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP. */
/* Reset this so wo can check kind after callbacks have been called by
IceProcessMessages. The smc_interact_CB sets the kind to
SAVE_SESSION_EVENT, but we don't know beforehand if that callback
/* Reset this so wo can check kind after callbacks have been called by
IceProcessMessages. The smc_interact_CB sets the kind to
SAVE_SESSION_EVENT, but we don't know beforehand if that callback
emacs_event.kind = NO_EVENT;
if (select (ice_fd+1, &read_fds,
emacs_event.kind = NO_EVENT;
if (select (ice_fd+1, &read_fds,
/* This is called when the session manager says it is OK to interact with the
user. Here we set the kind to SAVE_SESSION_EVENT so an event is generated.
/* This is called when the session manager says it is OK to interact with the
user. Here we set the kind to SAVE_SESSION_EVENT so an event is generated.
are started in the correct directory.
If this is a shutdown and we can request to interact with the user,
are started in the correct directory.
If this is a shutdown and we can request to interact with the user,
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmCloneCommand;
props[props_idx]->type = SmLISTofARRAY8;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmCloneCommand;
props[props_idx]->type = SmLISTofARRAY8;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmProgram;
props[props_idx]->type = SmARRAY8;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmProgram;
props[props_idx]->type = SmARRAY8;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmRestartCommand;
props[props_idx]->type = SmLISTofARRAY8;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmRestartCommand;
props[props_idx]->type = SmLISTofARRAY8;
props[props_idx]->vals = &values[val_idx];
props[props_idx]->vals[0].length = strlen (emacs_program);
props[props_idx]->vals[0].value = emacs_program;
props[props_idx]->vals = &values[val_idx];
props[props_idx]->vals[0].length = strlen (emacs_program);
props[props_idx]->vals[0].value = emacs_program;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmUserID;
props[props_idx]->type = SmARRAY8;
props[props_idx] = &prop_ptr[props_idx];
props[props_idx]->name = SmUserID;
props[props_idx]->type = SmARRAY8;
if (interactStyle != SmInteractStyleAny
|| ! shutdown
|| saveType == SmSaveLocal
|| ! SmcInteractRequest (smcConn, SmDialogNormal, smc_interact_CB, 0))
{
if (interactStyle != SmInteractStyleAny
|| ! shutdown
|| saveType == SmSaveLocal
|| ! SmcInteractRequest (smcConn, SmDialogNormal, smc_interact_CB, 0))
{
According to the SM specification, we should not interact with the
user between smc_save_yourself_CB is called and until smc_save_complete_CB
is called. It seems like a lot of job to implement this and it doesn't
According to the SM specification, we should not interact with the
user between smc_save_yourself_CB is called and until smc_save_complete_CB
is called. It seems like a lot of job to implement this and it doesn't
static void
ice_conn_watch_CB (iceConn, clientData, opening, watchData)
IceConn iceConn;
static void
ice_conn_watch_CB (iceConn, clientData, opening, watchData)
IceConn iceConn;
static void
create_client_leader_window (dpyinfo, client_id)
struct x_display_info *dpyinfo;
static void
create_client_leader_window (dpyinfo, client_id)
struct x_display_info *dpyinfo;
if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
previous_id = SDATA (Vx_session_previous_id);
if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
previous_id = SDATA (Vx_session_previous_id);
if (! EQ (Vinvocation_directory, Qnil))
name_len += strlen (SDATA (Vinvocation_directory));
name_len += strlen (SDATA (Vinvocation_name));
/* This malloc will not be freed, but it is only done once, and hopefully
if (! EQ (Vinvocation_directory, Qnil))
name_len += strlen (SDATA (Vinvocation_directory));
name_len += strlen (SDATA (Vinvocation_name));
/* This malloc will not be freed, but it is only done once, and hopefully
strcat (emacs_program, SDATA (Vinvocation_name));
/* The SM protocol says all callbacks are mandatory, so set up all
strcat (emacs_program, SDATA (Vinvocation_name));
/* The SM protocol says all callbacks are mandatory, so set up all
callbacks.save_yourself.callback = smc_save_yourself_CB;
callbacks.save_yourself.client_data = 0;
callbacks.die.callback = smc_die_CB;
callbacks.save_yourself.callback = smc_save_yourself_CB;
callbacks.save_yourself.client_data = 0;
callbacks.die.callback = smc_die_CB;
callbacks.shutdown_cancelled.callback = smc_shutdown_cancelled_CB;
callbacks.shutdown_cancelled.client_data = 0;
callbacks.shutdown_cancelled.callback = smc_shutdown_cancelled_CB;
callbacks.shutdown_cancelled.client_data = 0;
SmcSetErrorHandler (smc_error_handler);
IceSetErrorHandler (ice_error_handler);
IceSetIOErrorHandler (ice_io_error_handler);
SmcSetErrorHandler (smc_error_handler);
IceSetErrorHandler (ice_error_handler);
IceSetIOErrorHandler (ice_io_error_handler);
IceAddConnectionWatch (ice_conn_watch_CB, 0);
/* Open the connection to the session manager. A failure is not
critical, it usually means that no session manager is running.
IceAddConnectionWatch (ice_conn_watch_CB, 0);
/* Open the connection to the session manager. A failure is not
critical, it usually means that no session manager is running.
smc_conn = SmcOpenConnection (NULL, NULL, 1, 0,
(SmcSaveYourselfProcMask|
SmcDieProcMask|
smc_conn = SmcOpenConnection (NULL, NULL, 1, 0,
(SmcSaveYourselfProcMask|
SmcDieProcMask|