X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/3cf5480148c1beb7726490365fb249db5813ea38..2afd5e90eb946a0e70547e56a4c705d7d0d4cb7f:/src/frame.c diff --git a/src/frame.c b/src/frame.c index 5525e2a996..b8fb2e1546 100644 --- a/src/frame.c +++ b/src/frame.c @@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA. */ #ifdef WINDOWSNT #include "w32term.h" #endif -#ifdef macintosh +#ifdef MAC_OS #include "macterm.h" #endif #include "buffer.h" @@ -80,6 +80,7 @@ Lisp_Object Vterminal_frame; Lisp_Object Vdefault_frame_alist; Lisp_Object Vmouse_position_function; Lisp_Object Vmouse_highlight; +Lisp_Object Vdelete_frame_functions; static void set_menu_bar_lines_1 (window, n) @@ -293,7 +294,7 @@ make_frame (mini_p) 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 @@ -486,11 +487,15 @@ make_terminal_frame () 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 */ +#ifdef CANNOT_DUMP + FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR; + FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR; +#endif +#endif /* MAC_OS8 */ #endif /* WINDOWSNT */ #endif /* MSDOS */ @@ -521,7 +526,7 @@ Note that changing the size of one terminal frame automatically affects all. */ 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 @@ -1088,8 +1093,9 @@ A frame may not be deleted if its minibuffer is used by other frames. Normally, you may not delete a frame if all other frames are invisible, but if the second optional argument FORCE is non-nil, you may do so. -This function runs `delete-frame-hook' before actually deleting the -frame. The hook is called with one argument FRAME. */) +This function runs `delete-frame-functions' before actually deleting the +frame, unless the frame is a tooltip. +The functions are run with one arg, the frame to be deleted. */) (frame, force) Lisp_Object frame, force; { @@ -1112,10 +1118,10 @@ frame. The hook is called with one argument 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"); @@ -1148,11 +1154,12 @@ frame. The hook is called with one argument FRAME. */) } } - /* Run `delete-frame-hook'. */ - if (!NILP (Vrun_hooks)) + /* Run `delete-frame-functions' unless frame is a tooltip. */ + if (!NILP (Vrun_hooks) + && NILP (Fframe_parameter (frame, intern ("tooltip")))) { Lisp_Object args[2]; - args[0] = intern ("delete-frame-hook"); + args[0] = intern ("delete-frame-functions"); args[1] = frame; Frun_hook_with_args (2, args); } @@ -1818,26 +1825,6 @@ frames_discard_buffer (buffer) } } -/* 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. */ @@ -1889,8 +1876,8 @@ set_term_frame_name (f, name) /* 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++; @@ -1907,7 +1894,7 @@ set_term_frame_name (f, name) /* Don't allow the user to set the frame name to F, 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 are usurped by Emacs"); } @@ -2025,13 +2012,13 @@ If FRAME is omitted, return information on the currently selected frame. */) 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 @@ -2039,13 +2026,13 @@ If FRAME is omitted, return information on the currently selected frame. */) 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 @@ -2127,13 +2114,13 @@ If FRAME is nil, describe the currently selected frame. */) "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) @@ -2141,8 +2128,8 @@ If FRAME is nil, describe the currently selected frame. */) } 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) @@ -2182,7 +2169,7 @@ enabled such bindings for that variable with `make-variable-frame-local'. */) { 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 @@ -2545,6 +2532,12 @@ is over the clickable text. However, the mouse shape still indicates when the mouse is over clickable text. */); Vmouse_highlight = Qt; + DEFVAR_LISP ("delete-frame-functions", &Vdelete_frame_functions, + doc: /* Functions to be run before deleting a frame. +The functions are run with one arg, the frame to be deleted. +See `delete-frame'. */); + Vdelete_frame_functions = Qnil; + DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, doc: /* Minibufferless frames use this frame's minibuffer.