/* Updating of data structures for redisplay.
Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995,
1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "w32term.h"
#endif /* HAVE_NTGUI */
-#ifdef MAC_OS
-#include "macterm.h"
-#endif /* MAC_OS */
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
/* Include systime.h after xterm.h to avoid double inclusion of time.h. */
update_begin (f);
#ifdef MSDOS
if (FRAME_MSDOS_P (f))
- set_terminal_modes (FRAME_TERMINAL (f));
+ FRAME_TERMINAL (f)->set_terminal_modes_hook (FRAME_TERMINAL (f));
#endif
clear_frame (f);
clear_current_matrices (f);
|| g == '\t'
|| g == '\n'
|| g == '\r'
+ || (g == ' ' && !NILP (current_buffer->word_wrap))
/* Give up if unable to display the cursor in the window. */
|| w->cursor.vpos < 0
/* Give up if we are showing a message or just cleared the message
paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
update_end (f);
- if (FRAME_TERMCAP_P (f))
+ if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
{
if (FRAME_TTY (f)->termscript)
fflush (FRAME_TTY (f)->termscript);
- fflush (FRAME_TTY (f)->output);
+ if (FRAME_TERMCAP_P (f))
+ fflush (FRAME_TTY (f)->output);
}
/* Check window matrices for lost pointers. */
struct glyph *desired_glyph = desired_row->glyphs[TEXT_AREA];
int overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
int desired_stop_pos = desired_row->used[TEXT_AREA];
+ int abort_skipping = 0;
/* If the desired row extends its face to the text area end, and
unless the current row also does so at the same position,
in common. */
while (i < stop)
{
- int can_skip_p = 1;
+ int can_skip_p = !abort_skipping;
/* Skip over glyphs that both rows have in common. These
don't have to be written. We can't skip if the last
rif->get_glyph_overhangs (glyph, XFRAME (w->frame),
&left, &right);
- can_skip_p = right == 0;
+ can_skip_p = (right == 0 && !abort_skipping);
}
if (can_skip_p)
{
+ int start_hpos = i;
+
while (i < stop
&& GLYPH_EQUAL_P (desired_glyph, current_glyph))
{
x -= desired_glyph->pixel_width;
left -= desired_glyph->pixel_width;
}
+
+ /* Abort the skipping algorithm if we end up before
+ our starting point, to avoid looping (bug#1070).
+ This can happen when the lbearing is larger than
+ the pixel width. */
+ abort_skipping = (i < start_hpos);
}
}
set_window_height (FRAME_ROOT_WINDOW (f),
newheight - FRAME_TOP_MARGIN (f), 2);
- if (FRAME_TERMCAP_P (f) && !pretend)
+ /* MSDOS frames cannot PRETEND, as they change frame size by
+ manipulating video hardware. */
+ if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
FrameRows (FRAME_TTY (f)) = newheight;
}
if (FRAME_HAS_MINIBUF_P (f))
set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0);
- if (FRAME_TERMCAP_P (f) && !pretend)
+ /* MSDOS frames cannot PRETEND, as they change frame size by
+ manipulating video hardware. */
+ if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
FrameCols (FRAME_TTY (f)) = newwidth;
if (WINDOWP (f->tool_bar_window))
{
struct tty_display_info *tty;
- if (! FRAME_TERMCAP_P (SELECTED_FRAME ()))
+ if (! FRAME_TERMCAP_P (SELECTED_FRAME ())
+ && ! FRAME_MSDOS_P (SELECTED_FRAME ()))
error ("Current frame is not on a tty device");
tty = CURTTY ();
tty = t->display_info.tty;
+ if (! tty->output)
+ error ("Terminal is currently suspended");
+
if (tty->termscript)
{
fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
signal (SIGWINCH, window_change_signal);
#endif /* SIGWINCH */
+ /* If running as a daemon, no need to initialize any frames/terminal. */
+ if (IS_DAEMON)
+ return;
+
/* If the user wants to use a window system, we shouldn't bother
initializing the terminal. This is especially important when the
terminal is so dumb that emacs gives up before and doesn't bother
if (! inhibit_window_system && ! display_arg)
{
char *display;
-#ifdef VMS
- display = getenv ("DECW$DISPLAY");
-#else
display = getenv ("DISPLAY");
-#endif
-
display_arg = (display != 0 && *display != 0);
if (display_arg && !x_display_ok (display))
Vinitial_window_system = intern ("x");
#ifdef HAVE_X11
Vwindow_system_version = make_number (11);
-#else
- Vwindow_system_version = make_number (10);
#endif
#if defined (GNU_LINUX) && defined (HAVE_LIBNCURSES)
/* In some versions of ncurses,
}
#endif /* HAVE_NTGUI */
-#ifdef MAC_OS
- if (!inhibit_window_system)
+#ifdef HAVE_NS
+ if (!inhibit_window_system
+#ifndef CANNOT_DUMP
+ && initialized
+#endif
+ )
{
- Vinitial_window_system = intern ("mac");
- Vwindow_system_version = make_number (1);
+ Vinitial_window_system = intern("ns");
+ Vwindow_system_version = make_number(10);
adjust_frame_glyphs_initially ();
return;
}
-#endif /* MAC_OS */
+#endif
/* If no window system has been specified, try to use the terminal. */
if (! isatty (0))
#endif
if (!terminal_type)
{
-#ifdef VMS
- fprintf (stderr, "Please specify your terminal type.\n\
-For types defined in VMS, use set term /device=TYPE.\n\
-For types not defined in VMS, use define emacs_term \"TYPE\".\n\
-\(The quotation marks are necessary since terminal types are lower case.)\n");
-#else /* not VMS */
-
#ifdef HAVE_WINDOW_SYSTEM
if (! inhibit_window_system)
fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see `tset').\n");
else
#endif /* HAVE_WINDOW_SYSTEM */
fprintf (stderr, "Please set the environment variable TERM; see `tset'.\n");
-#endif /* not VMS */
exit (1);
}
-#ifdef VMS
- /* VMS DCL tends to up-case things, so down-case term type.
- Hardly any uppercase letters in terminal types; should be none. */
- {
- char *new = (char *) xmalloc (strlen (terminal_type) + 1);
- char *p;
-
- strcpy (new, terminal_type);
-
- for (p = new; *p; p++)
- if (isupper (*p))
- *p = tolower (*p);
-
- terminal_type = new;
- }
-#endif /* VMS */
-
{
struct terminal *t;
struct frame *f = XFRAME (selected_frame);
Fmodify_frame_parameters
(selected_frame, Fcons (Fcons (Qtty_type,
Ftty_type (selected_frame)), Qnil));
- Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qtty, Qnil), Qnil));
+ if (t->display_info.tty->name)
+ Fmodify_frame_parameters (selected_frame,
+ Fcons (Fcons (Qtty, build_string (t->display_info.tty->name)),
+ Qnil));
+ else
+ Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qtty, Qnil),
+ Qnil));
}
{
/* Set up faces of the initial terminal frame of a dumped Emacs. */
if (initialized
&& !noninteractive
-#ifdef MSDOS
- /* The MSDOS terminal turns on its ``window system'' relatively
- late into the startup, so we cannot do the frame faces'
- initialization just yet. It will be done later by pc-win.el
- and internal_terminal_init. */
- && (strcmp (terminal_type, "internal") != 0 || inhibit_window_system)
-#endif
&& NILP (Vinitial_window_system))
{
/* For the initial frame, we don't have any way of knowing what
return w->cursor_off_p ? Qnil : Qt;
}
+DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,
+ Slast_nonminibuf_frame, 0, 0, 0,
+ doc: /* Value is last nonminibuffer frame. */)
+ ()
+{
+ Lisp_Object frame = Qnil;
+
+ if (last_nonminibuf_frame)
+ XSETFRAME (frame, last_nonminibuf_frame);
+
+ return frame;
+}
\f
/***********************************************************************
Initialization
defsubr (&Ssend_string_to_terminal);
defsubr (&Sinternal_show_cursor);
defsubr (&Sinternal_show_cursor_p);
+ defsubr (&Slast_nonminibuf_frame);
#if GLYPH_DEBUG
defsubr (&Sdump_redisplay_history);