]> code.delx.au - gnu-emacs/blobdiff - src/frame.c
(MINI_WINDOW_P): Use NILP.
[gnu-emacs] / src / frame.c
index 6850c92dc276450aa365b754534dde08b97c28a0..3fb507b7752e56179e6cead5be1e7d3e2e2805ff 100644 (file)
@@ -1,5 +1,6 @@
 /* Generic frame functions.
-   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000 Free Software Foundation.
+   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001
+   Free Software Foundation.
 
 This file is part of GNU Emacs.
 
@@ -198,14 +199,8 @@ make_frame (mini_p)
   register struct frame *f;
   register Lisp_Object root_window;
   register Lisp_Object mini_window;
-  register struct Lisp_Vector *vec;
-  int i;
-
-  vec = allocate_vectorlike ((EMACS_INT) VECSIZE (struct frame));
-  for (i = 0; i < VECSIZE (struct frame); i++)
-    XSETFASTINT (vec->contents[i], 0);
-  vec->size = VECSIZE (struct frame);
-  f = (struct frame *)vec;
+
+  f = allocate_frame ();
   XSETFRAME (frame, f);
 
   f->desired_matrix = 0;
@@ -550,11 +545,25 @@ Note that changing the size of one terminal frame automatically affects all.")
     XCDR (XCAR (tem)) = Fcopy_sequence (XCDR (XCAR (tem)));
   return frame;
 }
+
 \f
+/* Perform the switch to frame FRAME.
+
+   If FRAME is a switch-frame event `(switch-frame FRAME1)', use
+   FRAME1 as frame.
+
+   If TRACK is non-zero and the frame that currently has the focus
+   redirects its focus to the selected frame, redirect that focused
+   frame's focus to FRAME instead.
+
+   FOR_DELETION non-zero means that the selected frame is being
+   deleted, which includes the possibility that the frame's display
+   is dead.  */
+
 Lisp_Object
-do_switch_frame (frame, no_enter, track)
-     Lisp_Object frame, no_enter;
-     int track;
+do_switch_frame (frame, track, for_deletion)
+     Lisp_Object frame;
+     int track, for_deletion;
 {
   struct frame *sf = SELECTED_FRAME ();
   
@@ -605,7 +614,7 @@ do_switch_frame (frame, no_enter, track)
 #else /* ! 0 */
   /* Instead, apply it only to the frame we're pointing to.  */
 #ifdef HAVE_WINDOW_SYSTEM
-  if (track && (FRAME_WINDOW_P (XFRAME (frame))))
+  if (track && FRAME_WINDOW_P (XFRAME (frame)))
     {
       Lisp_Object focus, xfocus;
 
@@ -620,7 +629,7 @@ do_switch_frame (frame, no_enter, track)
 #endif /* HAVE_X_WINDOWS */
 #endif /* ! 0 */
 
-  if (FRAME_HAS_MINIBUF_P (sf))
+  if (!for_deletion && FRAME_HAS_MINIBUF_P (sf))
     resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1);
 
   selected_frame = frame;
@@ -649,7 +658,7 @@ function is called.")
   (frame, no_enter)
     Lisp_Object frame, no_enter;
 {
-  return do_switch_frame (frame, no_enter, 1);
+  return do_switch_frame (frame, 1, 0);
 }
 
 
@@ -668,7 +677,7 @@ to that frame.")
   /* Preserve prefix arg that the command loop just cleared.  */
   current_kboard->Vprefix_arg = Vcurrent_prefix_arg;
   call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
-  return do_switch_frame (event, no_enter, 0);
+  return do_switch_frame (event, 0, 0);
 }
 
 DEFUN ("ignore-event", Fignore_event, Signore_event, 0, 0, "",
@@ -798,7 +807,13 @@ DEFUN ("frame-list", Fframe_list, Sframe_list,
        "Return a list of all frames.")
   ()
 {
-  return Fcopy_sequence (Vframe_list);
+  Lisp_Object frames;
+  frames = Fcopy_sequence (Vframe_list);
+#ifdef HAVE_WINDOW_SYSTEM
+  if (FRAMEP (tip_frame))
+    frames = Fdelq (tip_frame, frames);
+#endif
+  return frames;
 }
 
 /* Return the next frame in the frame list after FRAME.
@@ -1074,7 +1089,13 @@ frame.  The hook is called with one argument FRAME.")
   if (! FRAME_LIVE_P (f))
     return Qnil;
 
-  if (NILP (force) && !other_visible_frames (f))
+  if (NILP (force) && !other_visible_frames (f)
+#ifdef macintosh
+      /* Terminal frame deleted before any other visible frames are
+        created.  */
+      && strcmp (XSTRING (f->name)->data, "F1") != 0
+#endif
+     )
     error ("Attempt to delete the sole visible or iconified frame");
 
 #if 0
@@ -1134,7 +1155,7 @@ frame.  The hook is called with one argument FRAME.")
            }
        }
 
-      do_switch_frame (frame1, Qnil, 0);
+      do_switch_frame (frame1, 0, 1);
       sf = SELECTED_FRAME ();
     }
 
@@ -1297,8 +1318,9 @@ upper-left corner.\n\
 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
 to read the mouse position, it returns the selected frame for FRAME\n\
 and nil for X and Y.\n\
-Runs the abnormal hook `mouse-position-function' with the normal return\n\
-value as argument.")
+If `mouse-position-function' is non-nil, `mouse-position' calls it,\n\
+passing the normal return value to that function as an argument,\n\
+and returns whatever that function returns.")
   ()
 {
   FRAME_PTR f;
@@ -1508,7 +1530,7 @@ but if the second optional argument FORCE is non-nil, you may do so.")
 #if 0 /* This isn't logically necessary, and it can do GC.  */
   /* Don't let the frame remain selected.  */
   if (EQ (frame, selected_frame))
-    do_switch_frame (next_frame (frame, Qt), Qnil, 0)
+    do_switch_frame (next_frame (frame, Qt), 0, 0)
 #endif
 
   /* Don't allow minibuf_window to remain on a deleted frame.  */
@@ -1893,7 +1915,7 @@ store_frame_param (f, prop, val)
   if (SYMBOLP (prop))
     {
       Lisp_Object valcontents;
-      valcontents = XSYMBOL (prop)->value;
+      valcontents = SYMBOL_VALUE (prop);
       if ((BUFFER_LOCAL_VALUEP (valcontents)
           || SOME_BUFFER_LOCAL_VALUEP (valcontents))
          && XBUFFER_LOCAL_VALUE (valcontents)->check_frame
@@ -1949,7 +1971,7 @@ If FRAME is omitted, return information on the currently selected frame.")
   int height, width;
   struct gcpro gcpro1;
 
-  if (EQ (frame, Qnil))
+  if (NILP (frame))
     frame = selected_frame;
 
   CHECK_FRAME (frame, 0);
@@ -2015,8 +2037,7 @@ If FRAME is omitted, return information on the currently selected frame.")
                   : FRAME_MINIBUF_ONLY_P (f) ? Qonly
                   : FRAME_MINIBUF_WINDOW (f)));
   store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil));
-  store_in_alist (&alist, Qbuffer_list,
-                 frame_buffer_list (selected_frame));
+  store_in_alist (&alist, Qbuffer_list, frame_buffer_list (frame));
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2113,6 +2134,7 @@ If FRAME is nil, describe the currently selected frame.")
 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters, 
        Smodify_frame_parameters, 2, 2, 0,
   "Modify the parameters of frame FRAME according to ALIST.\n\
+If FRAME is nil, it defaults to the selected frame.\n\
 ALIST is an alist of parameters to change and their new values.\n\
 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
 The meaningful PARMs depend on the kind of frame.\n\
@@ -2468,8 +2490,10 @@ The `menu-bar-lines' element of the list controls whether new frames\n\
   Vemacs_iconified = Qnil;
 
   DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function,
-    "If non-nil, function applied to the normal result of `mouse-position'.\n\
-This abnormal hook exists for the benefit of packages like XTerm-mouse\n\
+    "If non-nil, function to transform normal value of `mouse-position'.\n\
+`mouse-position' calls this function, passing its usual return value as\n\
+argument, and returns whatever this function returns.\n\
+This abnormal hook exists for the benefit of packages like `xt-mouse.el'\n\
 which need to do mouse handling at the Lisp level.");
   Vmouse_position_function = Qnil;
 
@@ -2484,7 +2508,9 @@ frames; once the frame is created, it sticks with its assigned\n\
 minibuffer, no matter what this variable is set to.  This means that\n\
 this variable doesn't necessarily say anything meaningful about the\n\
 current set of frames, or where the minibuffer is currently being\n\
-displayed.");
+displayed.\n\
+\n\
+This variable is local to the current terminal and cannot be buffer-local.");
 
   staticpro (&Vframe_list);