emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xsmfns.c


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/xsmfns.c
Date: Fri, 18 Oct 2002 05:50:41 -0400

Index: emacs/src/xsmfns.c
diff -c emacs/src/xsmfns.c:1.5 emacs/src/xsmfns.c:1.6
*** emacs/src/xsmfns.c:1.5      Sun Jul 14 20:00:41 2002
--- emacs/src/xsmfns.c  Fri Oct 18 05:50:16 2002
***************
*** 98,104 ****
     open to a session manager, just return 0.
     Otherwise returns the number of events stored in buffer BUFP,
     which can hold up to *NUMCHARS characters.  At most one event is
!    stored, an SAVE_SESSION_EVENT. */
  int
  x_session_check_input (bufp, numchars)
       struct input_event *bufp;
--- 98,104 ----
     open to a session manager, just return 0.
     Otherwise returns the number of events stored in buffer BUFP,
     which can hold up to *NUMCHARS characters.  At most one event is
!    stored, a SAVE_SESSION_EVENT. */
  int
  x_session_check_input (bufp, numchars)
       struct input_event *bufp;
***************
*** 106,120 ****
  {
    SELECT_TYPE read_fds;
    EMACS_TIME tmout;
!   
    if (ice_fd == -1) return 0;
!   
    FD_ZERO (&read_fds);
    FD_SET (ice_fd, &read_fds);
!       
    tmout.tv_sec = 0;
    tmout.tv_usec = 0;
!   
    /* 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
--- 106,120 ----
  {
    SELECT_TYPE read_fds;
    EMACS_TIME tmout;
! 
    if (ice_fd == -1) return 0;
! 
    FD_ZERO (&read_fds);
    FD_SET (ice_fd, &read_fds);
! 
    tmout.tv_sec = 0;
    tmout.tv_usec = 0;
! 
    /* 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
***************
*** 127,139 ****
        ice_fd = -1;
        return 0;
      }
!   
  
    if (FD_ISSET (ice_fd, &read_fds))
      IceProcessMessages (SmcGetIceConnection (smc_conn),
                          (IceReplyWaitInfo *)0, (Bool *)0);
  
!   
    /* Check if smc_interact_CB was called and we shall generate a
       SAVE_SESSION_EVENT. */
    if (*numchars > 0 && emacs_event.kind != NO_EVENT)
--- 127,139 ----
        ice_fd = -1;
        return 0;
      }
! 
  
    if (FD_ISSET (ice_fd, &read_fds))
      IceProcessMessages (SmcGetIceConnection (smc_conn),
                          (IceReplyWaitInfo *)0, (Bool *)0);
  
! 
    /* Check if smc_interact_CB was called and we shall generate a
       SAVE_SESSION_EVENT. */
    if (*numchars > 0 && emacs_event.kind != NO_EVENT)
***************
*** 189,202 ****
       Bool fast;
  {
  #define NR_PROPS 5
!   
    SmProp *props[NR_PROPS];
    SmProp prop_ptr[NR_PROPS];
!   
    SmPropValue values[20];
    int val_idx = 0;
    int props_idx = 0;
!   
    char cwd[MAXPATHLEN+1];
    char *smid_opt;
  
--- 189,202 ----
       Bool fast;
  {
  #define NR_PROPS 5
! 
    SmProp *props[NR_PROPS];
    SmProp prop_ptr[NR_PROPS];
! 
    SmPropValue values[20];
    int val_idx = 0;
    int props_idx = 0;
! 
    char cwd[MAXPATHLEN+1];
    char *smid_opt;
  
***************
*** 219,225 ****
    props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name));
    props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
    ++props_idx;
!   
    /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx). */
    props[props_idx] = &prop_ptr[props_idx];
    props[props_idx]->name = SmRestartCommand;
--- 219,225 ----
    props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name));
    props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
    ++props_idx;
! 
    /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx). */
    props[props_idx] = &prop_ptr[props_idx];
    props[props_idx]->name = SmRestartCommand;
***************
*** 232,238 ****
    smid_opt = xmalloc (strlen (SMID_OPT) + strlen (client_id) + 1);
    strcpy (smid_opt, SMID_OPT);
    strcat (smid_opt, client_id);
!   
    props[props_idx]->vals[1].length = strlen (smid_opt);
    props[props_idx]->vals[1].value = smid_opt;
    val_idx += 2;
--- 232,238 ----
    smid_opt = xmalloc (strlen (SMID_OPT) + strlen (client_id) + 1);
    strcpy (smid_opt, SMID_OPT);
    strcat (smid_opt, client_id);
! 
    props[props_idx]->vals[1].length = strlen (smid_opt);
    props[props_idx]->vals[1].value = smid_opt;
    val_idx += 2;
***************
*** 264,271 ****
        props[props_idx]->vals[0].value = cwd;
        ++props_idx;
      }
!   
!   
    SmcSetProperties (smcConn, props_idx, props);
  
    xfree (smid_opt);
--- 264,271 ----
        props[props_idx]->vals[0].value = cwd;
        ++props_idx;
      }
! 
! 
    SmcSetProperties (smcConn, props_idx, props);
  
    xfree (smid_opt);
***************
*** 375,381 ****
        ice_fd = -1;
        return;
      }
!   
    ice_fd = IceConnectionNumber (iceConn);
  #ifndef F_SETOWN_BUG
  #ifdef F_SETOWN
--- 375,381 ----
        ice_fd = -1;
        return;
      }
! 
    ice_fd = IceConnectionNumber (iceConn);
  #ifndef F_SETOWN_BUG
  #ifdef F_SETOWN
***************
*** 403,409 ****
    char* previous_id = NULL;
    SmcCallbacks callbacks;
    int  name_len = 0;
!   
    /* Check if we where started by the session manager.  If so, we will
       have a previous id. */
    if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
--- 403,409 ----
    char* previous_id = NULL;
    SmcCallbacks callbacks;
    int  name_len = 0;
! 
    /* Check if we where started by the session manager.  If so, we will
       have a previous id. */
    if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
***************
*** 422,428 ****
    if (! EQ (Vinvocation_directory, Qnil))
      strcpy (emacs_program, SDATA (Vinvocation_directory));
    strcat (emacs_program, SDATA (Vinvocation_name));
!   
    /* The SM protocol says all callbacks are mandatory, so set up all
       here and in the mask passed to SmcOpenConnection */
    callbacks.save_yourself.callback = smc_save_yourself_CB;
--- 422,428 ----
    if (! EQ (Vinvocation_directory, Qnil))
      strcpy (emacs_program, SDATA (Vinvocation_directory));
    strcat (emacs_program, SDATA (Vinvocation_name));
! 
    /* The SM protocol says all callbacks are mandatory, so set up all
       here and in the mask passed to SmcOpenConnection */
    callbacks.save_yourself.callback = smc_save_yourself_CB;
***************
*** 464,470 ****
  DEFUN ("handle-save-session", Fhandle_save_session,
         Shandle_save_session, 1, 1, "e",
         doc: /* Handle the save_yourself event from a session manager.
! A session manager can tell Emacs that the window system is shutting down 
  by sending Emacs a save_yourself message.  Emacs executes this function when
  such an event occurs.  This function then executes `emacs-session-save'.
  After that, this function informs the session manager that it can continue
--- 464,470 ----
  DEFUN ("handle-save-session", Fhandle_save_session,
         Shandle_save_session, 1, 1, "e",
         doc: /* Handle the save_yourself event from a session manager.
! A session manager can tell Emacs that the window system is shutting down
  by sending Emacs a save_yourself message.  Emacs executes this function when
  such an event occurs.  This function then executes `emacs-session-save'.
  After that, this function informs the session manager that it can continue
***************
*** 510,536 ****
  
    DEFVAR_LISP ("x-session-previous-id", &Vx_session_previous_id,
      doc: /* The previous session id Emacs got from session manager.
! If Emacs is running on a window system that has a session manager, the 
! session manager gives Emacs a session id.  It is feasible for Emacs lisp 
! code to use the session id to save configuration in, for example, a file 
! with a file name based on the session id.  If Emacs is running when the 
! window system is shut down, the session manager remembers that Emacs was 
  running and saves the session id Emacs had.
  
! When the window system is started again, the session manager restarts 
! Emacs and hands Emacs the session id it had the last time it was 
! running.  This is now the previous session id and the value of this 
! variable.  If configuration was saved in a file as stated above, the 
  previous session id shall be used to reconstruct the file name.
  
! The session id Emacs has while it is running is in the variable 
  `x-session-id'.  The value of this variable and `x-session-id' may be the
  same, depending on how the session manager works.
  
  See also `emacs-save-session-functions', `emacs-session-save' and
  `emacs-session-restore'." */);
    Vx_session_previous_id = Qnil;
!   
    defsubr (&Shandle_save_session);
  }
  
--- 510,536 ----
  
    DEFVAR_LISP ("x-session-previous-id", &Vx_session_previous_id,
      doc: /* The previous session id Emacs got from session manager.
! If Emacs is running on a window system that has a session manager, the
! session manager gives Emacs a session id.  It is feasible for Emacs lisp
! code to use the session id to save configuration in, for example, a file
! with a file name based on the session id.  If Emacs is running when the
! window system is shut down, the session manager remembers that Emacs was
  running and saves the session id Emacs had.
  
! When the window system is started again, the session manager restarts
! Emacs and hands Emacs the session id it had the last time it was
! running.  This is now the previous session id and the value of this
! variable.  If configuration was saved in a file as stated above, the
  previous session id shall be used to reconstruct the file name.
  
! The session id Emacs has while it is running is in the variable
  `x-session-id'.  The value of this variable and `x-session-id' may be the
  same, depending on how the session manager works.
  
  See also `emacs-save-session-functions', `emacs-session-save' and
  `emacs-session-restore'." */);
    Vx_session_previous_id = Qnil;
! 
    defsubr (&Shandle_save_session);
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]