/* Avoid "differ in sign" warnings */
#define SSDATA(x) ((char *) SDATA (x))
-/* The user login name. */
-
-extern Lisp_Object Vuser_login_name;
-
/* This is the event used when SAVE_SESSION_EVENT occurs. */
static struct input_event emacs_event;
/* The option to start Emacs without the splash screen when
restarting Emacs. */
-#define NOSPLASH_OPT "--no-splash"
+static char NOSPLASH_OPT[] = "--no-splash";
/* The option to make Emacs start in the given directory. */
SmPropValue values[20];
int val_idx = 0;
int props_idx = 0;
-
+ int i;
char *cwd = NULL;
char *smid_opt, *chdir_opt = NULL;
/* How to start a new instance of Emacs. */
props[props_idx] = &prop_ptr[props_idx];
- props[props_idx]->name = SmCloneCommand;
- props[props_idx]->type = SmLISTofARRAY8;
+ props[props_idx]->name = xstrdup (SmCloneCommand);
+ props[props_idx]->type = xstrdup (SmLISTofARRAY8);
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
props[props_idx]->vals[0].length = strlen (emacs_program);
/* The name of the program. */
props[props_idx] = &prop_ptr[props_idx];
- props[props_idx]->name = SmProgram;
- props[props_idx]->type = SmARRAY8;
+ props[props_idx]->name = xstrdup (SmProgram);
+ props[props_idx]->type = xstrdup (SmARRAY8);
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
/* How to restart Emacs. */
props[props_idx] = &prop_ptr[props_idx];
- props[props_idx]->name = SmRestartCommand;
- props[props_idx]->type = SmLISTofARRAY8;
+ props[props_idx]->name = xstrdup (SmRestartCommand);
+ props[props_idx]->type = xstrdup (SmLISTofARRAY8);
/* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */
props[props_idx]->num_vals = 4;
props[props_idx]->vals = &values[val_idx];
/* User id. */
props[props_idx] = &prop_ptr[props_idx];
- props[props_idx]->name = SmUserID;
- props[props_idx]->type = SmARRAY8;
+ props[props_idx]->name = xstrdup (SmUserID);
+ props[props_idx]->type = xstrdup (SmARRAY8);
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
if (cwd)
{
props[props_idx] = &prop_ptr[props_idx];
- props[props_idx]->name = SmCurrentDirectory;
- props[props_idx]->type = SmARRAY8;
+ props[props_idx]->name = xstrdup (SmCurrentDirectory);
+ props[props_idx]->type = xstrdup (SmARRAY8);
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
props[props_idx]->vals[0].length = strlen (cwd);
xfree (chdir_opt);
free (cwd);
+ for (i = 0; i < props_idx; ++i)
+ {
+ xfree (props[i]->type);
+ xfree (props[i]->name);
+ }
/* See if we maybe shall interact with the user. */
if (interactStyle != SmInteractStyleAny
XSetClassHint (dpyinfo->display, w, &class_hints);
XStoreName (dpyinfo->display, w, class_hints.res_name);
- sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False);
- XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace,
+ XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID,
+ XA_STRING, 8, PropModeReplace,
(unsigned char *)client_id, strlen (client_id));
dpyinfo->client_leader_window = w;