#ifdef WINDOWSNT
#include "w32term.h"
#endif
-#ifdef macintosh
+#ifdef MAC_OS
#include "macterm.h"
#endif
#include "buffer.h"
/* 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"
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 Qtty_color_mode;
Lisp_Object Vterminal_frame;
Lisp_Object Vdefault_frame_alist;
Lisp_Object Vmouse_position_function;
+Lisp_Object Vmouse_highlight;
\f
static void
set_menu_bar_lines_1 (window, n)
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;
{
buf = Fcurrent_buffer ();
/* If buf is a 'hidden' buffer (i.e. one whose name starts with
a space), try to find another one. */
- if (XSTRING (Fbuffer_name (buf))->data[0] == ' ')
+ if (SREF (Fbuffer_name (buf), 0) == ' ')
buf = Fother_buffer (buf, Qnil, Qnil);
/* Use set_window_buffer, not Fset_window_buffer, and don't let
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)
f->output_method = output_termcap;
f->output_data.x = &tty_display;
#else
-#ifdef macintosh
+#ifdef MAC_OS8
make_mac_terminal_frame (f);
#else
f->output_data.x = &tty_display;
-#endif /* macintosh */
+#endif /* MAC_OS8 */
#endif /* WINDOWSNT */
#endif /* MSDOS */
abort ();
#else /* not MSDOS */
-#ifdef macintosh
+#ifdef MAC_OS
if (sf->output_method != output_mac)
error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
#else
/* 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;
Fselect_window (XFRAME (frame)->selected_window);
+#ifndef WINDOWSNT
+ /* Make sure to switch the tty color mode to that of the newly
+ selected frame. */
+ sf = SELECTED_FRAME ();
+ if (FRAME_TERMCAP_P (sf))
+ {
+ Lisp_Object color_mode_spec, color_mode;
+
+ color_mode_spec = assq_no_quit (Qtty_color_mode, sf->param_alist);
+ if (CONSP (color_mode_spec))
+ color_mode = XCDR (color_mode_spec);
+ else
+ color_mode = make_number (0);
+ set_tty_color_mode (sf, color_mode);
+ }
+#endif /* !WINDOWSNT */
+
/* We want to make sure that the next event generates a frame-switch
event to the appropriate frame. This seems kludgy to me, but
before you take it out, make sure that evaluating something like
(window)
Lisp_Object window;
{
- CHECK_LIVE_WINDOW (window, 0);
+ CHECK_LIVE_WINDOW (window);
return XWINDOW (window)->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))
window = SELECTED_FRAME ()->root_window;
else
{
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
window = XFRAME (frame)->root_window;
}
window = SELECTED_FRAME ()->selected_window;
else
{
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
window = XFRAME (frame)->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");
/* 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))
if (NILP (frame))
frame = selected_frame;
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
return next_frame (frame, miniframe);
}
{
if (NILP (frame))
frame = selected_frame;
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
return prev_frame (frame, miniframe);
}
\f
}
else
{
- CHECK_FRAME (frame, 0);
+ CHECK_FRAME (frame);
f = XFRAME (frame);
}
return Qnil;
if (NILP (force) && !other_visible_frames (f)
-#ifdef macintosh
+#ifdef MAC_OS8
/* Terminal frame deleted before any other visible frames are
created. */
- && strcmp (XSTRING (f->name)->data, "F1") != 0
+ && strcmp (SDATA (f->name), "F1") != 0
#endif
)
error ("Attempt to delete the sole visible or iconified frame");
(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
(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
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
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");
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. */
(frame)
Lisp_Object frame;
{
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
if (NILP (frame))
frame = selected_frame;
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
/* Do like the documentation says. */
Fmake_frame_visible (frame);
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);
/* 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;
(frame)
Lisp_Object frame;
{
- CHECK_LIVE_FRAME (frame, 0);
+ CHECK_LIVE_FRAME (frame);
return FRAME_FOCUS_FRAME (XFRAME (frame));
}
}
}
-/* Move BUFFER to the end of the buffer-list of each frame. */
-
-void
-frames_bury_buffer (buffer)
- Lisp_Object buffer;
-{
- Lisp_Object frame, tail;
-
- FOR_EACH_FRAME (tail, frame)
- {
- struct frame *f = XFRAME (frame);
- Lisp_Object found;
-
- found = Fmemq (buffer, f->buffer_list);
- if (!NILP (found))
- f->buffer_list = nconc2 (Fdelq (buffer, f->buffer_list),
- Fcons (buffer, Qnil));
- }
-}
-
/* Modify the alist in *ALISTPTR to associate PROP with VAL.
If the alist already has an element for PROP, we change it. */
/* Check for no change needed in this very common case
before we do any consing. */
- if (frame_name_fnn_p (XSTRING (f->name)->data,
- STRING_BYTES (XSTRING (f->name))))
+ if (frame_name_fnn_p (SDATA (f->name),
+ SBYTES (f->name)))
return;
terminal_frame_count++;
}
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)))
/* Don't allow the user to set the frame name to F<num>, so it
doesn't clash with the names we generate for terminal frames. */
- if (frame_name_fnn_p (XSTRING (name)->data, STRING_BYTES (XSTRING (name))))
+ if (frame_name_fnn_p (SDATA (name), SBYTES (name)))
error ("Frame names of the form F<num> are usurped by Emacs");
}
swap_in_global_binding (prop);
}
+#ifndef WINDOWSNT
+ /* The tty color mode needs to be set before the frame's parameter
+ alist is updated with the new value, because set_tty_color_mode
+ wants to look at the old mode. */
+ if (FRAME_TERMCAP_P (f) && EQ (prop, Qtty_color_mode))
+ set_tty_color_mode (f, val);
+#endif
+
/* Update the frame parameter alist. */
old_alist_elt = Fassq (prop, f->param_alist);
if (EQ (old_alist_elt, Qnil))
if (NILP (frame))
frame = selected_frame;
- CHECK_FRAME (frame, 0);
+ CHECK_FRAME (frame);
f = XFRAME (frame);
if (!FRAME_LIVE_P (f))
elt = Fassq (Qforeground_color, alist);
if (!NILP (elt) && CONSP (elt) && STRINGP (XCDR (elt)))
{
- if (strncmp (XSTRING (XCDR (elt))->data,
+ if (strncmp (SDATA (XCDR (elt)),
unspecified_bg,
- XSTRING (XCDR (elt))->size) == 0)
+ SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qforeground_color, tty_color_name (f, bg));
- else if (strncmp (XSTRING (XCDR (elt))->data,
+ else if (strncmp (SDATA (XCDR (elt)),
unspecified_fg,
- XSTRING (XCDR (elt))->size) == 0)
+ SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg));
}
else
elt = Fassq (Qbackground_color, alist);
if (!NILP (elt) && CONSP (elt) && STRINGP (XCDR (elt)))
{
- if (strncmp (XSTRING (XCDR (elt))->data,
+ if (strncmp (SDATA (XCDR (elt)),
unspecified_fg,
- XSTRING (XCDR (elt))->size) == 0)
+ SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qbackground_color, tty_color_name (f, fg));
- else if (strncmp (XSTRING (XCDR (elt))->data,
+ else if (strncmp (SDATA (XCDR (elt)),
unspecified_bg,
- XSTRING (XCDR (elt))->size) == 0)
+ SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg));
}
else
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
"unspecified". We need to do the same here. */
if (STRINGP (value) && !FRAME_WINDOW_P (f))
{
- char *color_name;
+ const char *color_name;
EMACS_INT csz;
if (EQ (parameter, Qbackground_color))
{
- color_name = XSTRING (value)->data;
- csz = XSTRING (value)->size;
+ color_name = SDATA (value);
+ csz = SCHARS (value);
if (strncmp (color_name, unspecified_bg, csz) == 0)
value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
else if (strncmp (color_name, unspecified_fg, csz) == 0)
}
else if (EQ (parameter, Qforeground_color))
{
- color_name = XSTRING (value)->data;
- csz = XSTRING (value)->size;
+ color_name = SDATA (value);
+ csz = SCHARS (value);
if (strncmp (color_name, unspecified_fg, csz) == 0)
value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
else if (strncmp (color_name, unspecified_bg, csz) == 0)
{
FRAME_PTR f;
register Lisp_Object tail, prop, val;
- int count = BINDING_STACK_SIZE ();
+ int count = SPECPDL_INDEX ();
/* Bind this to t to inhibit initialization of the default face from
X resources in face-set-after-frame-default. If we don't inhibit
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. */
if (NILP (frame))
frame = selected_frame;
- CHECK_FRAME (frame, 0);
+ CHECK_FRAME (frame);
f = XFRAME (frame);
#ifdef HAVE_WINDOW_SYSTEM
if (NILP (frame))
frame = selected_frame;
- CHECK_FRAME (frame, 0);
+ CHECK_FRAME (frame);
f = XFRAME (frame);
#ifdef HAVE_WINDOW_SYSTEM
if (NILP (frame))
frame = selected_frame;
- CHECK_FRAME (frame, 0);
+ CHECK_FRAME (frame);
f = XFRAME (frame);
#ifdef HAVE_WINDOW_SYSTEM
if (NILP (frame))
frame = selected_frame;
- CHECK_FRAME (frame, 0);
+ CHECK_FRAME (frame);
f = XFRAME (frame);
#ifdef HAVE_WINDOW_SYSTEM
{
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. */
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. */
{
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. */
{
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. */
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);
+ Qtty_color_mode = intern ("tty-color-mode");
+ staticpro (&Qtty_color_mode);
DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
doc: /* Alist of default values for frame creation.
For values specific to the separate minibuffer frame, see
`minibuffer-frame-alist'.
The `menu-bar-lines' element of the list controls whether new frames
- have menu bars; `menu-bar-mode' works by altering this element. */);
+ have menu bars; `menu-bar-mode' works by altering this element.
+Setting this variable does not affect existing frames, only new ones. */);
Vdefault_frame_alist = Qnil;
Qinhibit_default_face_x_resources
which need to do mouse handling at the Lisp level. */);
Vmouse_position_function = Qnil;
+ DEFVAR_LISP ("mouse-highlight", &Vmouse_highlight,
+ doc: /* If non-nil, clickable text is highlighted when mouse is over it.
+If the value is an integer, highlighting is only shown after moving the
+mouse, while keyboard input turns off the highlight even when the mouse
+is over the clickable text. However, the mouse shape still indicates
+when the mouse is over clickable text. */);
+ Vmouse_highlight = Qt;
+
DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
doc: /* Minibufferless frames use this frame's minibuffer.
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");
-}