]> code.delx.au - gnu-emacs/blobdiff - src/frame.c
(Qleft_fringe, Qright_fringe): New vars.
[gnu-emacs] / src / frame.c
index 52424456a2c93852a2e2327b604e200de4630167..d6154b7ab040da9a3a2e9b53ded8962a8889ef58 100644 (file)
@@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA.  */
 /* These help us bind and responding to switch-frame events.  */
 #include "commands.h"
 #include "keyboard.h"
-#include "keymap.h"
 #include "frame.h"
 #ifdef HAVE_WINDOW_SYSTEM
 #include "fontset.h"
@@ -73,6 +72,8 @@ Lisp_Object Qtitle;
 Lisp_Object Qdisplay_type;
 Lisp_Object Qbackground_mode;
 Lisp_Object Qinhibit_default_face_x_resources;
+Lisp_Object Qleft_fringe;
+Lisp_Object Qright_fringe;
 
 Lisp_Object Vterminal_frame;
 Lisp_Object Vdefault_frame_alist;
@@ -181,8 +182,8 @@ DEFUN ("frame-live-p", Fframe_live_p, Sframe_live_p, 1, 1, 0,
        doc: /* Return non-nil if OBJECT is a frame which has not been deleted.
 Value is nil if OBJECT is not a live frame.  If object is a live
 frame, the return value indicates what sort of output device it is
-displayed on.  Value is t for a termcap frame (a character-only
-terminal), `x' for an Emacs frame being displayed in an X window.  */)
+displayed on.  See the documentation of `framep' for possible
+return values.  */)
      (object)
      Lisp_Object object;
 {
@@ -337,7 +338,7 @@ make_frame_without_minibuffer (mini_window, kb, display)
   struct gcpro gcpro1;
 
   if (!NILP (mini_window))
-    CHECK_LIVE_WINDOW (mini_window, 0);
+    CHECK_LIVE_WINDOW (mini_window);
 
 #ifdef MULTI_KBOARD
   if (!NILP (mini_window)
@@ -579,7 +580,7 @@ do_switch_frame (frame, track, for_deletion)
   /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
      a switch-frame event to arrive after a frame is no longer live,
      especially when deleting the initial frame during startup.  */
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
   if (! FRAME_LIVE_P (XFRAME (frame)))
     return Qnil;
 
@@ -703,7 +704,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
      (window)
      Lisp_Object window;
 {
-  CHECK_LIVE_WINDOW (window, 0);
+  CHECK_LIVE_WINDOW (window);
   return XWINDOW (window)->frame;
 }
 
@@ -719,7 +720,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
     w = SELECTED_FRAME ()->root_window;
   else
     {
-      CHECK_LIVE_FRAME (frame, 0);
+      CHECK_LIVE_FRAME (frame);
       w = XFRAME (frame)->root_window;
     }
   while (NILP (XWINDOW (w)->buffer))
@@ -754,7 +755,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
     window = SELECTED_FRAME ()->root_window;
   else
     {
-      CHECK_LIVE_FRAME (frame, 0);
+      CHECK_LIVE_FRAME (frame);
       window = XFRAME (frame)->root_window;
     }
   
@@ -774,7 +775,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
     window = SELECTED_FRAME ()->selected_window;
   else
     {
-      CHECK_LIVE_FRAME (frame, 0);
+      CHECK_LIVE_FRAME (frame);
       window = XFRAME (frame)->selected_window;
     }
 
@@ -792,8 +793,8 @@ If FRAME is the selected frame, this makes WINDOW the selected window.  */)
   if (NILP (frame))
     frame = selected_frame;
   
-  CHECK_LIVE_FRAME (frame, 0);
-  CHECK_LIVE_WINDOW (window, 1);
+  CHECK_LIVE_FRAME (frame);
+  CHECK_LIVE_WINDOW (window);
 
   if (! EQ (frame, WINDOW_FRAME (XWINDOW (window))))
     error ("In `set-frame-selected-window', WINDOW is not on FRAME");
@@ -840,7 +841,7 @@ next_frame (frame, minibuf)
 
   /* If this frame is dead, it won't be in Vframe_list, and we'll loop
      forever.  Forestall that.  */
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
   while (1)
     for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
@@ -992,7 +993,7 @@ Otherwise, include all frames.  */)
   if (NILP (frame))
     frame = selected_frame;
   
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
   return next_frame (frame, miniframe);
 }
 
@@ -1012,7 +1013,7 @@ Otherwise, include all frames.  */)
 {
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
   return prev_frame (frame, miniframe);
 }
 \f
@@ -1084,7 +1085,7 @@ frame.  The hook is called with one argument FRAME.  */)
     }
   else
     {
-      CHECK_FRAME (frame, 0);
+      CHECK_FRAME (frame);
       f = XFRAME (frame);
     }
 
@@ -1404,9 +1405,9 @@ before calling this function on it, like this.
   (frame, x, y)
      Lisp_Object frame, x, y;
 {
-  CHECK_LIVE_FRAME (frame, 0);
-  CHECK_NUMBER (x, 2);
-  CHECK_NUMBER (y, 1);
+  CHECK_LIVE_FRAME (frame);
+  CHECK_NUMBER (x);
+  CHECK_NUMBER (y);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1436,9 +1437,9 @@ before calling this function on it, like this.
   (frame, x, y)
      Lisp_Object frame, x, y;
 {
-  CHECK_LIVE_FRAME (frame, 0);
-  CHECK_NUMBER (x, 2);
-  CHECK_NUMBER (y, 1);
+  CHECK_LIVE_FRAME (frame);
+  CHECK_NUMBER (x);
+  CHECK_NUMBER (y);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1470,7 +1471,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
   if (NILP (frame))
     frame = selected_frame;
 
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1524,7 +1525,7 @@ but if the second optional argument FORCE is non-nil, you may do so.  */)
   if (NILP (frame))
     frame = selected_frame;
 
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
   if (NILP (force) && !other_visible_frames (XFRAME (frame)))
     error ("Attempt to make invisible the sole visible or iconified frame");
@@ -1566,7 +1567,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
   if (NILP (frame))
     frame = selected_frame;
   
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
 #if 0 /* This isn't logically necessary, and it can do GC.  */
   /* Don't let the frame remain selected.  */
@@ -1604,7 +1605,7 @@ Return the symbol `icon' if frame is visible only as an icon.  */)
      (frame)
      Lisp_Object frame;
 {
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
   FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
 
@@ -1650,7 +1651,7 @@ doesn't support multiple overlapping frames, this function does nothing.  */)
   if (NILP (frame))
     frame = selected_frame;
 
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
   /* Do like the documentation says. */
   Fmake_frame_visible (frame);
@@ -1673,7 +1674,7 @@ doesn't support multiple overlapping frames, this function does nothing.  */)
   if (NILP (frame))
     frame = selected_frame;
 
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
   
   if (frame_raise_lower_hook)
     (*frame_raise_lower_hook) (XFRAME (frame), 0);
@@ -1713,10 +1714,10 @@ The redirection lasts until `redirect-frame-focus' is called to change it.  */)
   /* Note that we don't check for a live frame here.  It's reasonable
      to redirect the focus of a frame you're about to delete, if you
      know what other frame should receive those keystrokes.  */
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
 
   if (! NILP (focus_frame))
-    CHECK_LIVE_FRAME (focus_frame, 1);
+    CHECK_LIVE_FRAME (focus_frame);
 
   XFRAME (frame)->focus_frame = focus_frame;
 
@@ -1734,7 +1735,7 @@ See `redirect-frame-focus'.  */)
      (frame)
      Lisp_Object frame;
 {
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
 
   return FRAME_FOCUS_FRAME (XFRAME (frame));
 }
@@ -1879,7 +1880,7 @@ set_term_frame_name (f, name)
     }
   else
     {
-      CHECK_STRING (name, 0);
+      CHECK_STRING (name);
 
       /* Don't change the name if it's already NAME.  */
       if (! NILP (Fstring_equal (name, f->name)))
@@ -1976,7 +1977,7 @@ If FRAME is omitted, return information on the currently selected frame.  */)
   if (NILP (frame))
     frame = selected_frame;
 
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
   f = XFRAME (frame);
 
   if (!FRAME_LIVE_P (f))
@@ -2071,21 +2072,23 @@ If FRAME is nil, describe the currently selected frame.  */)
   if (NILP (frame))
     frame = selected_frame;
   else
-    CHECK_FRAME (frame, 0);
-  CHECK_SYMBOL (parameter, 1);
+    CHECK_FRAME (frame);
+  CHECK_SYMBOL (parameter);
   
   f = XFRAME (frame);
   value = Qnil;
   
   if (FRAME_LIVE_P (f))
     {
+      /* Avoid consing in frequent cases.  */
       if (EQ (parameter, Qname))
        value = f->name;
 #ifdef HAVE_X_WINDOWS
       else if (EQ (parameter, Qdisplay) && FRAME_X_P (f))
        value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element);
 #endif /* HAVE_X_WINDOWS */
-      else
+      else if (EQ (parameter, Qbackground_color)
+              || EQ (parameter, Qforeground_color))
        {
          value = Fassq (parameter, f->param_alist);
          if (CONSP (value))
@@ -2120,13 +2123,14 @@ If FRAME is nil, describe the currently selected frame.  */)
                    }
                }
            }
-         else if (EQ (parameter, Qdisplay_type)
-                  || EQ (parameter, Qbackground_mode))
-           /* Avoid consing in frequent cases.  */
-           value = Qnil;
          else
            value = Fcdr (Fassq (parameter, Fframe_parameters (frame)));
        }
+      else if (EQ (parameter, Qdisplay_type)
+              || EQ (parameter, Qbackground_mode))
+       value = Fcdr (Fassq (parameter, f->param_alist));
+      else
+       value = Fcdr (Fassq (parameter, Fframe_parameters (frame)));
     }
   
   return value;
@@ -2163,7 +2167,7 @@ enabled such bindings for that variable with `make-variable-frame-local'.  */)
 
   if (EQ (frame, Qnil))
     frame = selected_frame;
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2223,7 +2227,7 @@ For a terminal frame, the value is always 1.  */)
 
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
   f = XFRAME (frame);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2249,7 +2253,7 @@ For a terminal screen, the value is always 1.  */)
 
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
   f = XFRAME (frame);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2274,7 +2278,7 @@ If FRAME is omitted, the selected frame is used.  */)
 
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
   f = XFRAME (frame);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2297,7 +2301,7 @@ If FRAME is omitted, the selected frame is used.  */)
 
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_FRAME (frame, 0);
+  CHECK_FRAME (frame);
   f = XFRAME (frame);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2317,10 +2321,10 @@ but that the idea of the actual height of the frame should not be changed.  */)
 {
   register struct frame *f;
 
-  CHECK_NUMBER (lines, 0);
+  CHECK_NUMBER (lines);
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2345,10 +2349,10 @@ but that the idea of the actual width of the frame should not be changed.  */)
      Lisp_Object frame, cols, pretend;
 {
   register struct frame *f;
-  CHECK_NUMBER (cols, 0);
+  CHECK_NUMBER (cols);
   if (NILP (frame))
     frame = selected_frame;
-  CHECK_LIVE_FRAME (frame, 0);
+  CHECK_LIVE_FRAME (frame);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2372,9 +2376,9 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
 {
   register struct frame *f;
 
-  CHECK_LIVE_FRAME (frame, 0);
-  CHECK_NUMBER (cols, 2);
-  CHECK_NUMBER (rows, 1);
+  CHECK_LIVE_FRAME (frame);
+  CHECK_NUMBER (cols);
+  CHECK_NUMBER (rows);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2404,9 +2408,9 @@ the rightmost or bottommost possible position (that stays within the screen).  *
 {
   register struct frame *f;
 
-  CHECK_LIVE_FRAME (frame, 0);
-  CHECK_NUMBER (xoffset, 1);
-  CHECK_NUMBER (yoffset, 2);
+  CHECK_LIVE_FRAME (frame);
+  CHECK_NUMBER (xoffset);
+  CHECK_NUMBER (yoffset);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2466,6 +2470,10 @@ syms_of_frame ()
   staticpro (&Qdisplay_type);
   Qbackground_mode = intern ("background-mode");
   staticpro (&Qbackground_mode);
+  Qleft_fringe = intern ("left-fringe");
+  staticpro (&Qleft_fringe);
+  Qright_fringe = intern ("right-fringe");
+  staticpro (&Qright_fringe);
 
   DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
               doc: /* Alist of default values for frame creation.
@@ -2562,12 +2570,3 @@ This variable is local to the current terminal and cannot be buffer-local.  */);
   defsubr (&Sset_frame_size);
   defsubr (&Sset_frame_position);
 }
-
-void
-keys_of_frame ()
-{
-  initial_define_lispy_key (global_map, "switch-frame", "handle-switch-frame");
-  initial_define_lispy_key (global_map, "delete-frame", "handle-delete-frame");
-  initial_define_lispy_key (global_map, "iconify-frame", "ignore-event");
-  initial_define_lispy_key (global_map, "make-frame-visible", "ignore-event");
-}