mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-11 00:32:06 -07:00
Simplify some struct frame.output_method checks
* src/lisp.h (inhibit_window_system): Fix typo in commentary. * src/dispnew.c (Fopen_termscript): (init_display_interactive) [!HAVE_ANDROID, !MSDOS]: * src/dosfns.c [MSDOS] (dos_cleanup): * src/frame.c (frame_inhibit_resize, frame_windows_min_size) (do_switch_frame, delete_frame): (make_terminal_frame) [MSDOS]: (Fmake_terminal_frame) [MSDOS, WINDOWSNT]: * src/keyboard.c (read_decoded_event_from_main_queue) [!WINDOWSNT]: (Fcurrent_input_mode): * src/menu.c (single_menu_item): * src/msdos.c [MSDOS] (internal_terminal_init): * src/sysdep.c (init_sys_modes): * src/term.c: [HAVE_GPM] (Fgpm_mouse_start, Fgpm_mouse_stop): [MSDOS] (tty_free_frame_resources): * src/w32xfns.c (get_frame_dc): * src/xdisp.c (clear_garbaged_frames, hscroll_window_tree) (redisplay_internal): * src/xfaces.c (Fdisplay_supports_face_attributes_p) (realize_default_face, realize_face, realize_tty_face): Use is_tty_frame, FRAME_INITIAL_P, FRAME_MSDOS_P, FRAME_TERMCAP_P, FRAME_W32_P, and FRAME_TTY as appropriate instead of open-coding them (bug#80629).
This commit is contained in:
parent
b5f6bc0072
commit
cc4c8e6e9f
12 changed files with 31 additions and 44 deletions
|
|
@ -6776,8 +6776,7 @@ FILE = nil means just close any termscript file currently open. */)
|
|||
{
|
||||
struct tty_display_info *tty;
|
||||
|
||||
if (! FRAME_TERMCAP_P (SELECTED_FRAME ())
|
||||
&& ! FRAME_MSDOS_P (SELECTED_FRAME ()))
|
||||
if (!is_tty_frame (SELECTED_FRAME ()))
|
||||
error ("Current frame is not on a tty device");
|
||||
|
||||
tty = CURTTY ();
|
||||
|
|
@ -7344,7 +7343,7 @@ init_display_interactive (void)
|
|||
t = init_tty (0, terminal_type, 1); /* Errors are fatal. */
|
||||
|
||||
/* Convert the initial frame to use the new display. */
|
||||
if (f->output_method != output_initial)
|
||||
if (!FRAME_INITIAL_P (f))
|
||||
emacs_abort ();
|
||||
f->output_method = t->type;
|
||||
f->terminal = t;
|
||||
|
|
@ -7354,7 +7353,7 @@ init_display_interactive (void)
|
|||
f->output_data.tty = &the_only_tty_output;
|
||||
f->output_data.tty->display_info = &the_only_display_info;
|
||||
#else
|
||||
if (f->output_method == output_termcap)
|
||||
if (FRAME_TERMCAP_P (f))
|
||||
create_tty_output (f);
|
||||
#endif
|
||||
t->display_info.tty->top_frame = selected_frame;
|
||||
|
|
|
|||
|
|
@ -681,8 +681,7 @@ dos_cleanup (void)
|
|||
{
|
||||
struct frame *sf = XFRAME (selected_frame);
|
||||
|
||||
if (FRAME_LIVE_P (sf)
|
||||
&& (FRAME_MSDOS_P (sf) || FRAME_TERMCAP_P (sf)))
|
||||
if (FRAME_LIVE_P (sf) && is_tty_frame (sf))
|
||||
{
|
||||
tty = CURTTY ();
|
||||
if (tty->termscript)
|
||||
|
|
|
|||
15
src/frame.c
15
src/frame.c
|
|
@ -213,7 +213,7 @@ frame_inhibit_resize (struct frame *f, bool horizontal, Lisp_Object parameter)
|
|||
&& !NILP (fullscreen) && !EQ (fullscreen, Qfullheight))
|
||||
|| (!horizontal
|
||||
&& !NILP (fullscreen) && !EQ (fullscreen, Qfullwidth))
|
||||
|| FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))));
|
||||
|| is_tty_frame (f))));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -561,7 +561,7 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal,
|
|||
|
||||
/* Don't allow too small height of text-mode frames, or else cm.c
|
||||
might abort in cmcheckmagic. */
|
||||
if ((FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) && NILP (horizontal))
|
||||
if (is_tty_frame (f) && NILP (horizontal))
|
||||
{
|
||||
int min_height = (FRAME_MENU_BAR_LINES (f) + FRAME_TAB_BAR_LINES (f)
|
||||
+ FRAME_WANTS_MODELINE_P (f)
|
||||
|
|
@ -1572,7 +1572,7 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
|
|||
f->output_data.tty->display_info = &the_only_display_info;
|
||||
if (!inhibit_window_system
|
||||
&& (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame))
|
||||
|| XFRAME (selected_frame)->output_method == output_msdos_raw))
|
||||
|| FRAME_MSDOS_P (XFRAME (selected_frame))))
|
||||
f->output_method = output_msdos_raw;
|
||||
else
|
||||
f->output_method = output_termcap;
|
||||
|
|
@ -1762,13 +1762,12 @@ affects all frames on the same terminal device. */)
|
|||
struct frame *sf = SELECTED_FRAME ();
|
||||
|
||||
#ifdef MSDOS
|
||||
if (sf->output_method != output_msdos_raw
|
||||
&& sf->output_method != output_termcap)
|
||||
if (!is_tty_frame (sf))
|
||||
emacs_abort ();
|
||||
#else /* not MSDOS */
|
||||
|
||||
#ifdef WINDOWSNT /* This should work now! */
|
||||
if (sf->output_method != output_termcap)
|
||||
if (!FRAME_TERMCAP_P (sf))
|
||||
error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
|
||||
#endif
|
||||
#endif /* not MSDOS */
|
||||
|
|
@ -1985,7 +1984,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
|
|||
if (!for_deletion && FRAME_HAS_MINIBUF_P (sf))
|
||||
resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1);
|
||||
|
||||
if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
|
||||
if (is_tty_frame (f))
|
||||
{
|
||||
struct tty_display_info *tty = FRAME_TTY (f);
|
||||
Lisp_Object top_frame = tty->top_frame;
|
||||
|
|
@ -2799,7 +2798,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
|
|||
&& FRAME_LIVE_P (f1)
|
||||
&& !FRAME_TOOLTIP_P (f1))
|
||||
{
|
||||
if (FRAME_TERMCAP_P (f1) || FRAME_MSDOS_P (f1))
|
||||
if (is_tty_frame (f1))
|
||||
{
|
||||
Lisp_Object top_frame = FRAME_TTY (f1)->top_frame;
|
||||
|
||||
|
|
|
|||
|
|
@ -2436,7 +2436,7 @@ read_decoded_event_from_main_queue (struct timespec *end_time,
|
|||
#else
|
||||
struct frame *frame = XFRAME (selected_frame);
|
||||
struct terminal *terminal = frame->terminal;
|
||||
if (!((FRAME_TERMCAP_P (frame) || FRAME_MSDOS_P (frame))
|
||||
if (!(is_tty_frame (frame)
|
||||
/* Don't apply decoding if we're just reading a raw event
|
||||
(e.g. reading bytes sent by the xterm to specify the position
|
||||
of a mouse click). */
|
||||
|
|
@ -12982,7 +12982,7 @@ The elements of this list correspond to the arguments of
|
|||
|
||||
Lisp_Object interrupt = interrupt_input ? Qt : Qnil;
|
||||
Lisp_Object flow, meta;
|
||||
if (FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
|
||||
if (is_tty_frame (sf))
|
||||
{
|
||||
flow = FRAME_TTY (sf)->flow_control ? Qt : Qnil;
|
||||
meta = (FRAME_TTY (sf)->meta_key == 2
|
||||
|
|
|
|||
|
|
@ -5166,7 +5166,7 @@ extern void *w32_daemon_event;
|
|||
/* True if handling a fatal error already. */
|
||||
extern bool fatal_error_in_progress;
|
||||
|
||||
/* True means don't do use window-system-specific display code. */
|
||||
/* True means don't use window-system-specific display code. */
|
||||
extern bool inhibit_window_system;
|
||||
/* True means that a filter or a sentinel is running. */
|
||||
extern bool running_asynch_code;
|
||||
|
|
|
|||
|
|
@ -404,8 +404,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
|
|||
}
|
||||
}
|
||||
|
||||
if ((FRAME_TERMCAP_P (XFRAME (Vmenu_updating_frame))
|
||||
|| FRAME_MSDOS_P (XFRAME (Vmenu_updating_frame)))
|
||||
if (is_tty_frame (XFRAME (Vmenu_updating_frame))
|
||||
&& !NILP (map))
|
||||
/* Indicate visually that this is a submenu. */
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1787,7 +1787,7 @@ internal_terminal_init (void)
|
|||
#endif
|
||||
|
||||
/* If this is the initial terminal, we are done here. */
|
||||
if (sf->output_method == output_initial)
|
||||
if (FRAME_INITIAL_P (sf))
|
||||
return;
|
||||
|
||||
internal_terminal
|
||||
|
|
|
|||
|
|
@ -1341,8 +1341,7 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
frame_garbaged = 1;
|
||||
FOR_EACH_FRAME (tail, frame)
|
||||
{
|
||||
if ((FRAME_TERMCAP_P (XFRAME (frame))
|
||||
|| FRAME_MSDOS_P (XFRAME (frame)))
|
||||
if (is_tty_frame (XFRAME (frame))
|
||||
&& FRAME_TTY (XFRAME (frame)) == tty_out)
|
||||
FRAME_GARBAGED_P (XFRAME (frame)) = 1;
|
||||
}
|
||||
|
|
|
|||
10
src/term.c
10
src/term.c
|
|
@ -2968,9 +2968,7 @@ Gpm-mouse can only be activated for one tty at a time. */)
|
|||
(void)
|
||||
{
|
||||
struct frame *f = SELECTED_FRAME ();
|
||||
struct tty_display_info *tty
|
||||
= ((f)->output_method == output_termcap
|
||||
? (f)->terminal->display_info.tty : NULL);
|
||||
struct tty_display_info *tty = FRAME_TERMCAP_P (f) ? FRAME_TTY (f) : NULL;
|
||||
Gpm_Connect connection;
|
||||
|
||||
if (!tty)
|
||||
|
|
@ -3016,9 +3014,7 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
|
|||
(void)
|
||||
{
|
||||
struct frame *f = SELECTED_FRAME ();
|
||||
struct tty_display_info *tty
|
||||
= ((f)->output_method == output_termcap
|
||||
? (f)->terminal->display_info.tty : NULL);
|
||||
struct tty_display_info *tty = FRAME_TERMCAP_P (f) ? FRAME_TTY (f) : NULL;
|
||||
|
||||
if (!tty || gpm_tty != tty)
|
||||
return Qnil; /* Not activated on this terminal, nothing to do. */
|
||||
|
|
@ -4198,7 +4194,7 @@ tty_free_frame_resources (struct frame *f)
|
|||
static void
|
||||
tty_free_frame_resources (struct frame *f)
|
||||
{
|
||||
eassert (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f));
|
||||
eassert (is_tty_frame (f));
|
||||
free_frame_faces (f);
|
||||
/* Deleting a child frame means we have to thoroughly redisplay its
|
||||
root frame to make sure the child disappears from the display. */
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ get_frame_dc (struct frame *f)
|
|||
HGDIOBJ obj;
|
||||
struct w32_output *output;
|
||||
|
||||
if (f->output_method != output_w32)
|
||||
if (!FRAME_W32_P (f))
|
||||
emacs_abort ();
|
||||
|
||||
enter_crit ();
|
||||
|
|
|
|||
14
src/xdisp.c
14
src/xdisp.c
|
|
@ -13651,7 +13651,7 @@ clear_garbaged_frames (void)
|
|||
selected frame, and might leave the selected
|
||||
frame with corrupted display, if it happens not
|
||||
to be marked garbaged. */
|
||||
&& !(f != sf && (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))))
|
||||
&& !(f != sf && is_tty_frame (f)))
|
||||
redraw_frame (f);
|
||||
else
|
||||
clear_current_matrices (f);
|
||||
|
|
@ -16639,11 +16639,8 @@ hscroll_window_tree (Lisp_Object window)
|
|||
}
|
||||
}
|
||||
if (cursor_row->truncated_on_left_p)
|
||||
{
|
||||
/* On TTY frames, don't count the left truncation glyph. */
|
||||
struct frame *f = XFRAME (WINDOW_FRAME (w));
|
||||
x_offset -= (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f));
|
||||
}
|
||||
/* On TTY frames, don't count the left truncation glyph. */
|
||||
x_offset -= is_tty_frame (XFRAME (WINDOW_FRAME (w)));
|
||||
|
||||
text_area_width = window_box_width (w, TEXT_AREA);
|
||||
|
||||
|
|
@ -17377,7 +17374,7 @@ redisplay_internal (void)
|
|||
windows_or_buffers_changed = 47;
|
||||
|
||||
struct frame *previous_frame;
|
||||
if ((FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf))
|
||||
if (is_tty_frame (sf)
|
||||
&& (previous_frame = FRAME_TTY (sf)->previous_frame,
|
||||
previous_frame != sf))
|
||||
{
|
||||
|
|
@ -17822,8 +17819,7 @@ redisplay_internal (void)
|
|||
}
|
||||
|
||||
retry_frame:
|
||||
if (FRAME_WINDOW_P (f)
|
||||
|| FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f) || f == sf)
|
||||
if (FRAME_WINDOW_P (f) || is_tty_frame (f) || f == sf)
|
||||
{
|
||||
/* Only GC scrollbars when we redisplay the whole frame. */
|
||||
bool gcscrollbars = f->redisplay || !REDISPLAY_SOME_P ();
|
||||
|
|
|
|||
10
src/xfaces.c
10
src/xfaces.c
|
|
@ -5776,7 +5776,7 @@ face for italic. */)
|
|||
}
|
||||
|
||||
/* Dispatch to the appropriate handler. */
|
||||
if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
|
||||
if (is_tty_frame (f))
|
||||
supports = tty_supports_face_attributes_p (f, attrs, def_face);
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
else
|
||||
|
|
@ -6070,7 +6070,7 @@ realize_default_face (struct frame *f)
|
|||
ASET (lface, LFACE_FOREGROUND_INDEX, XCDR (color));
|
||||
else if (FRAME_WINDOW_P (f))
|
||||
return false;
|
||||
else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
|
||||
else if (FRAME_INITIAL_P (f) || is_tty_frame (f))
|
||||
ASET (lface, LFACE_FOREGROUND_INDEX, build_string (unspecified_fg));
|
||||
else
|
||||
emacs_abort ();
|
||||
|
|
@ -6085,7 +6085,7 @@ realize_default_face (struct frame *f)
|
|||
ASET (lface, LFACE_BACKGROUND_INDEX, XCDR (color));
|
||||
else if (FRAME_WINDOW_P (f))
|
||||
return false;
|
||||
else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
|
||||
else if (FRAME_INITIAL_P (f) || is_tty_frame (f))
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX, build_string (unspecified_bg));
|
||||
else
|
||||
emacs_abort ();
|
||||
|
|
@ -6196,7 +6196,7 @@ realize_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE],
|
|||
|
||||
if (FRAME_WINDOW_P (cache->f))
|
||||
face = realize_gui_face (cache, attrs);
|
||||
else if (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f))
|
||||
else if (is_tty_frame (cache->f))
|
||||
face = realize_tty_face (cache, attrs);
|
||||
else if (FRAME_INITIAL_P (cache->f))
|
||||
{
|
||||
|
|
@ -6705,7 +6705,7 @@ realize_tty_face (struct face_cache *cache,
|
|||
struct frame *f = cache->f;
|
||||
|
||||
/* Frame must be a termcap frame. */
|
||||
eassert (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f));
|
||||
eassert (is_tty_frame (cache->f));
|
||||
|
||||
/* Allocate a new realized face. */
|
||||
face = make_realized_face (attrs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue