annotate src/term.c @ 83100:4970ad4995f5

Eliminated updating_frame. src/termhooks.h (cursor_to_hook, raw_cursor_to_hook) (clear_to_end_hook, clear_end_of_line_hook, clear_frame_hook) (ins_del_lines_hook, insert_glyphs_hook, write_glyphs_hook) (delete_glyphs_hook, ring_bell_hook, set_terminal_window_hook): Added frame parameter. src/term.c (ring_bell, tty_ring_bell, set_terminal_window) (tty_set_terminal_window, set_scroll_region, cursor_to) (tty_cursor_to, raw_cursor_to, tty_raw_cursor_to, clear_to_end) (tty_clear_to_end, clear_frame, tty_clear_frame, clear_end_of_line) (tty_clear_end_of_line, write_glyphs, tty_write_glyphs, insert_glyphs) (tty_insert_glyphs, delete_glyphs, tty_delete_glyphs, ins_del_lines) (tty_ins_del_lines): Added frame parameter. src/xterm.c (x_delete_glyphs, x_clear_frame, x_ins_del_lines): Added frame parameter. src/scroll.c (do_direct_scrolling, do_scrolling): Added frame parameter. src/term.c (update_begin, update_end): Don't set updating_frame. src/xfns.c (x_set_tool_bar_lines): Ditto. src/term.c (updating_frame): Removed. src/dispextern.h: Updated prototypes. src/dispnew.c (Fredraw_frame, direct_output_for_insert) (direct_output_forward_char, update_frame_1, update_frame_line) (ding, bitch_at_user): Added frame parameter to calls to redisplay. src/xdisp.c (try_window_id): Ditto. src/scroll.c (do_scrolling, do_direct_scrolling, scrolling_1): Ditto. src/fileio.c (auto_save_error): Ditto. src/term.c (tty_ring_bell): Flush the output stream after beeping. src/dispnew.c (ding, bitch_at_user): Don't fflush CURTTY. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-140
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 16 Apr 2004 15:03:58 +0000
parents b448166f5664
children a330cf2446ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
1 /* Terminal control module for terminals described by TERMCAP
45548
612208417377 C style fix.
Miles Bader <miles@gnu.org>
parents: 45522
diff changeset
2 Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
3 Free Software Foundation, Inc.
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 This file is part of GNU Emacs.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 533
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 any later version.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
20 Boston, MA 02111-1307, USA. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
22 /* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
7900
60795e826dad Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents: 7649
diff changeset
24 #include <config.h>
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 #include <stdio.h>
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 #include <ctype.h>
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
27 #include <string.h>
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
28
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
29 #include <sys/file.h>
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
30
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
31 #include <unistd.h> /* For isatty. */
83095
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
32
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
33 #if HAVE_TERMIOS_H
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
34 #include <termios.h> /* For TIOCNOTTY. */
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
35 #endif
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
36
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
37 #include <signal.h>
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
38
53229
33c3c7c16e13 lib-src/emacsclient.c: Implemented --here option (open a new Emacs tty). Needs more work.
Karoly Lorentey <lorentey@elte.hu>
parents: 53227
diff changeset
39 #include "lisp.h"
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 #include "termchar.h"
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 #include "termopts.h"
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
42 #include "charset.h"
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
43 #include "coding.h"
31102
6a0caa788013 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 30848
diff changeset
44 #include "keyboard.h"
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
45 #include "frame.h"
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 #include "disptab.h"
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 #include "termhooks.h"
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
48 #include "dispextern.h"
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
49 #include "window.h"
39697
0b986bb45526 Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39682
diff changeset
50 #include "keymap.h"
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
51 #include "syssignal.h"
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
52 #include "systty.h"
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
53
33672
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
54 /* For now, don't try to include termcap.h. On some systems,
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
55 configure finds a non-standard termcap.h that the main build
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
56 won't find. */
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
57
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
58 #if defined HAVE_TERMCAP_H && 0
25727
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
59 #include <termcap.h>
29929
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
60 #else
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
61 extern void tputs P_ ((const char *, int, int (*)(int)));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
62 extern int tgetent P_ ((char *, const char *));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
63 extern int tgetflag P_ ((char *id));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
64 extern int tgetnum P_ ((char *id));
25727
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
65 #endif
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
66
21827
87c7f4bd99da Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents: 21624
diff changeset
67 #include "cm.h"
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
68 #ifdef HAVE_X_WINDOWS
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
69 #include "xterm.h"
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
70 #endif
44890
01b93e5e53a7 Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents: 44372
diff changeset
71 #ifdef MAC_OS
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31829
diff changeset
72 #include "macterm.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31829
diff changeset
73 #endif
8898
07bca49c7f84 Declare Fmake_sparse_keymap.
Karl Heuer <kwzh@gnu.org>
parents: 8806
diff changeset
74
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
75 #ifndef O_RDWR
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
76 #define O_RDWR 2
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
77 #endif
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
78
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
79 #ifndef O_NOCTTY
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
80 #define O_NOCTTY 0
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
81 #endif
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
82
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
83 static void turn_on_face P_ ((struct frame *, int face_id));
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
84 static void turn_off_face P_ ((struct frame *, int face_id));
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
85 static void tty_show_cursor P_ ((struct tty_display_info *));
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
86 static void tty_hide_cursor P_ ((struct tty_display_info *));
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
87
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
88 void delete_initial_display P_ ((struct display *));
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
89 void create_tty_output P_ ((struct frame *));
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
90 void delete_tty_output P_ ((struct frame *));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
91
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
92 #define OUTPUT(tty, a) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
93 emacs_tputs ((tty), a, \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
94 (int) (FRAME_LINES (XFRAME (selected_frame)) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
95 - curY (tty)), \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
96 cmputc)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
97
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
98 #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
99 #define OUTPUTL(tty, a, lines) emacs_tputs ((tty), a, lines, cmputc)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
100
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
101 #define OUTPUT_IF(tty, a) \
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
102 do { \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
103 if (a) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
104 emacs_tputs ((tty), a, \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
105 (int) (FRAME_LINES (XFRAME (selected_frame)) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
106 - curY (tty) ), \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
107 cmputc); \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
108 } while (0)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
109
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
110 #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
112 /* Display space properties */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
113
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
114 extern Lisp_Object Qspace, QCalign_to, QCwidth;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
115
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
116 /* Function to use to ring the bell. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
117
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
118 Lisp_Object Vring_bell_function;
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
119
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
120 /* Functions to call after deleting a tty. */
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
121 Lisp_Object Vdelete_tty_after_functions;
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
122
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
123 /* Functions to call after suspending a tty. */
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
124 Lisp_Object Vsuspend_tty_functions;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
125
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
126 /* Functions to call after resuming a tty. */
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
127 Lisp_Object Vresume_tty_functions;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
128
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
129 /* Chain of all displays currently in use. */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
130 struct display *display_list;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
131
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
132 /* The initial display device, created by initial_term_init. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
133 struct display *initial_display;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
134
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
135 /* Chain of all tty device parameters. */
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
136 struct tty_display_info *tty_list;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
138 /* Nonzero means no need to redraw the entire frame on resuming a
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
139 suspended Emacs. This is useful on terminals with multiple
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
140 pages, where one page is used for Emacs and another for all
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
141 else. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 int no_redraw_on_reenter;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
144 Lisp_Object Qframe_tty_name, Qframe_tty_type;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
145
1717
aa7d6d57504b * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1015
diff changeset
146
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
147
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
148 /* Meaning of bits in no_color_video. Each bit set means that the
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
149 corresponding attribute cannot be combined with colors. */
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
150
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
151 enum no_color_bit
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
152 {
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
153 NC_STANDOUT = 1 << 0,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
154 NC_UNDERLINE = 1 << 1,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
155 NC_REVERSE = 1 << 2,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
156 NC_BLINK = 1 << 3,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
157 NC_DIM = 1 << 4,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
158 NC_BOLD = 1 << 5,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
159 NC_INVIS = 1 << 6,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
160 NC_PROTECT = 1 << 7,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
161 NC_ALT_CHARSET = 1 << 8
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
162 };
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
163
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 /* internal state */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
166 /* The largest frame width in any call to calculate_costs. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
167
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
168 int max_frame_cols;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
169
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
170 /* The largest frame height in any call to calculate_costs. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
171
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
172 int max_frame_lines;
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
173
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
174 /* Non-zero if we have dropped our controlling tty and therefore
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
175 should not open a frame on stdout. */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
176 static int no_controlling_tty;
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
177
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
178 /* Provided for lisp packages. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
179
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
180 static int system_uses_terminfo;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
181
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 char *tparam ();
8612
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
183
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
184 extern char *tgetstr ();
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
186
35448
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
187 #ifdef WINDOWSNT
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
188 /* We aren't X windows, but we aren't termcap either. This makes me
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
189 uncertain as to what value to use for frame.output_method. For
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
190 this file, we'll define FRAME_TERMCAP_P to be zero so that our
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
191 output hooks get called instead of the termcap functions. Probably
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
192 the best long-term solution is to define an output_windows_nt... */
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
193
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
194 #undef FRAME_TERMCAP_P
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
195 #define FRAME_TERMCAP_P(_f_) 0
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
196 #endif /* WINDOWSNT */
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
197
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
198 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
199 ring_bell (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 {
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
201 if (!NILP (Vring_bell_function))
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
202 {
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
203 Lisp_Object function;
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
204
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
205 /* Temporarily set the global variable to nil
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
206 so that if we get an error, it stays nil
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
207 and we don't call it over and over.
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
208
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
209 We don't specbind it, because that would carefully
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
210 restore the bad value if there's an error
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
211 and make the loop of errors happen anyway. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
212
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
213 function = Vring_bell_function;
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
214 Vring_bell_function = Qnil;
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
215
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
216 call0 (function);
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
217
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
218 Vring_bell_function = function;
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
219 }
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
220 else if (FRAME_DISPLAY (f)->ring_bell_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
221 (*FRAME_DISPLAY (f)->ring_bell_hook) (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
224 /* Ring the bell on a tty. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
225
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
226 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
227 tty_ring_bell (struct frame *f)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
228 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
229 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
230
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
231 OUTPUT (tty, (tty->TS_visible_bell && visible_bell
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
232 ? tty->TS_visible_bell
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
233 : tty->TS_bell));
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
234 fflush (tty->output);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
235 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
236
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
237 /* Set up termcap modes for Emacs. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
238
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
239 void
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
240 tty_set_terminal_modes (struct display *display)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
242 struct tty_display_info *tty = display->display_info.tty;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
243
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
244 if (tty->output)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 {
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
246 OUTPUT_IF (tty, tty->TS_termcap_modes);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
247 OUTPUT_IF (tty, tty->TS_cursor_visible);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
248 OUTPUT_IF (tty, tty->TS_keypad_mode);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
249 losecursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
253 /* Reset termcap modes before exiting Emacs. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
254
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
255 void
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
256 tty_reset_terminal_modes (struct display *display)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
258 struct tty_display_info *tty = display->display_info.tty;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
259
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
260 if (tty->output)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 {
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
262 turn_off_highlight (tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
263 turn_off_insert (tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
264 OUTPUT_IF (tty, tty->TS_end_keypad_mode);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
265 OUTPUT_IF (tty, tty->TS_cursor_normal);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
266 OUTPUT_IF (tty, tty->TS_end_termcap_modes);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
267 OUTPUT_IF (tty, tty->TS_orig_pair);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
268 /* Output raw CR so kernel can track the cursor hpos. */
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
269 current_tty = tty;
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
270 cmputc ('\r');
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
274 void
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
275 update_begin (f)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
276 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
278 if (FRAME_DISPLAY (f)->update_begin_hook)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
279 (*FRAME_DISPLAY (f)->update_begin_hook) (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
282 void
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
283 update_end (f)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
284 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
286 if (FRAME_DISPLAY (f)->update_end_hook)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
287 (*FRAME_DISPLAY (f)->update_end_hook) (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
290 /* Flag the end of a display update on a termcap display. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
291
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
292 void
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
293 tty_update_end (struct frame *f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
294 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
295 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
296
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
297 if (!XWINDOW (selected_window)->cursor_off_p)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
298 tty_show_cursor (tty);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
299 turn_off_insert (tty);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
300 background_highlight (tty);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
301 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
302
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
303 /* Specify how many text lines, from the top of the window,
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
304 should be affected by insert-lines and delete-lines operations.
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
305 This, and those operations, are used only within an update
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
306 that is bounded by calls to update_begin and update_end. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
307
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
308 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
309 set_terminal_window (f, size)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
310 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 int size;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
313 if (FRAME_DISPLAY (f)->set_terminal_window_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
314 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
315 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
316
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
317 /* The implementation of set_terminal_window for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
318
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
319 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
320 tty_set_terminal_window (struct frame *f, int size)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
321 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
322 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
323
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
324 tty->specified_window = size ? size : FRAME_LINES (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
325 if (FRAME_SCROLL_REGION_OK (f))
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
326 set_scroll_region (f, 0, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
329 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
330 set_scroll_region (f, start, stop)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
331 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 int start, stop;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 char *buf;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
335 struct tty_display_info *tty = FRAME_TTY (f);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
336
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
337 if (tty->TS_set_scroll_region)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
338 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
339 else if (tty->TS_set_scroll_region_1)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
340 buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
53227
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
341 FRAME_LINES (f), start,
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
342 FRAME_LINES (f) - stop,
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
343 FRAME_LINES (f));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
345 buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f));
53227
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
346
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
347 OUTPUT (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
348 xfree (buf);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
349 losecursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 }
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
351
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
353 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
354 turn_on_insert (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
356 if (!tty->insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
357 OUTPUT (tty, tty->TS_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
358 tty->insert_mode = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
361 void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
362 turn_off_insert (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
364 if (tty->insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
365 OUTPUT (tty, tty->TS_end_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
366 tty->insert_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
369 /* Handle highlighting. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
371 void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
372 turn_off_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
374 if (tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
375 OUTPUT_IF (tty, tty->TS_end_standout_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
376 tty->standout_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
379 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
380 turn_on_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
382 if (!tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
383 OUTPUT_IF (tty, tty->TS_standout_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
384 tty->standout_mode = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
387 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
388 toggle_highlight (struct tty_display_info *tty)
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
389 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
390 if (tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
391 turn_off_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
392 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
393 turn_on_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
394 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
395
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
396
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
397 /* Make cursor invisible. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
398
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
399 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
400 tty_hide_cursor (struct tty_display_info *tty)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
401 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
402 if (tty->cursor_hidden == 0)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
403 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
404 tty->cursor_hidden = 1;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
405 OUTPUT_IF (tty, tty->TS_cursor_invisible);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
406 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
407 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
408
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
409
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
410 /* Ensure that cursor is visible. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
411
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
412 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
413 tty_show_cursor (struct tty_display_info *tty)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
414 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
415 if (tty->cursor_hidden)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
416 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
417 tty->cursor_hidden = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
418 OUTPUT_IF (tty, tty->TS_cursor_normal);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
419 OUTPUT_IF (tty, tty->TS_cursor_visible);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
420 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
421 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
422
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
423
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 /* Set standout mode to the state it should be in for
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 empty space inside windows. What this is,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 depends on the user option inverse-video. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
428 void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
429 background_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 if (inverse_video)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
432 turn_on_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
434 turn_off_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 /* Set standout mode to the mode specified for the text to be output. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
439 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
440 highlight_if_desired (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 {
40081
07d7dbf18784 (reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents: 39988
diff changeset
442 if (inverse_video)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
443 turn_on_highlight (tty);
40081
07d7dbf18784 (reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents: 39988
diff changeset
444 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
445 turn_off_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
449 /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
450 frame-relative coordinates. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
452 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
453 cursor_to (f, vpos, hpos)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
454 struct frame *f;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
455 int vpos, hpos;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
457 if (FRAME_DISPLAY (f)->cursor_to_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
458 (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
459 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
460
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
461 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
462 tty_cursor_to (struct frame *f, int vpos, int hpos)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
463 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
464 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
466 /* Detect the case where we are called from reset_sys_modes
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
467 and the costs have never been calculated. Do nothing. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
468 if (! tty->costs_set)
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
469 return;
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
470
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
471 if (curY (tty) == vpos
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
472 && curX (tty) == hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
474 if (!tty->TF_standout_motion)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
475 background_highlight (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
476 if (!tty->TF_insmode_motion)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
477 turn_off_insert (tty);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
478 cmgoto (tty, vpos, hpos);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 /* Similar but don't take any account of the wasted characters. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
483 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
484 raw_cursor_to (f, row, col)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
485 struct frame *f;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 533
diff changeset
486 int row, col;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
488 if (FRAME_DISPLAY (f)->raw_cursor_to_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
489 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
490 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
491
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
492 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
493 tty_raw_cursor_to (struct frame *f, int row, int col)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
494 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
495 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
496
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
497 if (curY (tty) == row
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
498 && curX (tty) == col)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
500 if (!tty->TF_standout_motion)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
501 background_highlight (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
502 if (!tty->TF_insmode_motion)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
503 turn_off_insert (tty);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
504 cmgoto (tty, row, col);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 /* Erase operations */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
509 /* Clear from cursor to end of frame. */
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
510 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
511 clear_to_end (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
513 if (FRAME_DISPLAY (f)->clear_to_end_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
514 (*FRAME_DISPLAY (f)->clear_to_end_hook) (f);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
515 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
516
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
517 /* Clear from cursor to end of frame on a termcap device. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
518
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
519 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
520 tty_clear_to_end (struct frame *f)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
521 {
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
523 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
524
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
525 if (tty->TS_clr_to_bottom)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
527 background_highlight (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
528 OUTPUT (tty, tty->TS_clr_to_bottom);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
529 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
530 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531 {
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
532 for (i = curY (tty); i < FRAME_LINES (f); i++)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
534 cursor_to (f, i, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
535 clear_end_of_line (f, FRAME_COLS (f));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
536 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
537 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
540 /* Clear entire frame */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
542 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
543 clear_frame (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
544 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
545 if (FRAME_DISPLAY (f)->clear_frame_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
546 (*FRAME_DISPLAY (f)->clear_frame_hook) (f);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
547 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
548
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
549 /* Clear an entire termcap frame. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
550
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
551 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
552 tty_clear_frame (struct frame *f)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
553 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
554 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
555
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
556 if (tty->TS_clr_frame)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
557 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
558 background_highlight (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
559 OUTPUT (tty, tty->TS_clr_frame);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
560 cmat (tty, 0, 0);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
562 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
564 cursor_to (f, 0, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
565 clear_to_end (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 /* Clear from cursor to end of line.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 Assume that the line is already clear starting at column first_unused_hpos.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 Note that the cursor may be moved, on terminals lacking a `ce' string. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
574 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
575 clear_end_of_line (f, first_unused_hpos)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
576 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 int first_unused_hpos;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
579 if (FRAME_DISPLAY (f)->clear_end_of_line_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
580 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos);
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
581 }
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
582
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
583 /* An implementation of clear_end_of_line for termcap frames.
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
584
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
585 Note that the cursor may be moved, on terminals lacking a `ce' string. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
586
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
587 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
588 tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
589 {
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
591 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
593 /* Detect the case where we are called from reset_sys_modes
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
594 and the costs have never been calculated. Do nothing. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
595 if (! tty->costs_set)
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
596 return;
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
597
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
598 if (curX (tty) >= first_unused_hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
600 background_highlight (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
601 if (tty->TS_clr_line)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
603 OUTPUT1 (tty, tty->TS_clr_line);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606 { /* have to do it the hard way */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
607 turn_off_insert (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
609 /* Do not write in last row last col with Auto-wrap on. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
610 if (AutoWrap (tty)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
611 && curY (tty) == FrameRows (tty) - 1
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
612 && first_unused_hpos == FrameCols (tty))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
613 first_unused_hpos--;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
614
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
615 for (i = curX (tty); i < first_unused_hpos; i++)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616 {
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
617 if (tty->termscript)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
618 fputc (' ', tty->termscript);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
619 fputc (' ', tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620 }
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
621 cmplus (tty, first_unused_hpos - curX (tty));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
625 /* Encode SRC_LEN glyphs starting at SRC to terminal output codes and
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
626 store them at DST. Do not write more than DST_LEN bytes. That may
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
627 require stopping before all SRC_LEN input glyphs have been
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
628 converted.
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
629
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
630 We store the number of glyphs actually converted in *CONSUMED. The
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
631 return value is the number of bytes store in DST. */
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
632
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
633 int
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
634 encode_terminal_code (src, dst, src_len, dst_len, consumed)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
635 struct glyph *src;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
636 int src_len;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
637 unsigned char *dst;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
638 int dst_len, *consumed;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
639 {
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
640 struct glyph *src_start = src, *src_end = src + src_len;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
641 unsigned char *dst_start = dst, *dst_end = dst + dst_len;
17180
364327df6e7c (encode_terminal_code): Check validity of character code.
Kenichi Handa <handa@m17n.org>
parents: 17046
diff changeset
642 register GLYPH g;
46559
96e8fdfd951d (encode_terminal_code): Buffer pointer now const.
Ken Raeburn <raeburn@raeburn.org>
parents: 46114
diff changeset
643 unsigned char workbuf[MAX_MULTIBYTE_LENGTH];
96e8fdfd951d (encode_terminal_code): Buffer pointer now const.
Ken Raeburn <raeburn@raeburn.org>
parents: 46114
diff changeset
644 const unsigned char *buf;
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
645 int len;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
646 register int tlen = GLYPH_TABLE_LENGTH;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
647 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
24263
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
648 int result;
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
649 struct coding_system *coding;
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
650
29448
348aa1a6a062 (encode_terminal_code): Change the way to check if
Kenichi Handa <handa@m17n.org>
parents: 29263
diff changeset
651 /* If terminal_coding does any conversion, use it, otherwise use
348aa1a6a062 (encode_terminal_code): Change the way to check if
Kenichi Handa <handa@m17n.org>
parents: 29263
diff changeset
652 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
348aa1a6a062 (encode_terminal_code): Change the way to check if
Kenichi Handa <handa@m17n.org>
parents: 29263
diff changeset
653 because it always return 1 if the member src_multibyte is 1. */
348aa1a6a062 (encode_terminal_code): Change the way to check if
Kenichi Handa <handa@m17n.org>
parents: 29263
diff changeset
654 coding = (terminal_coding.common_flags & CODING_REQUIRE_ENCODING_MASK
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
655 ? &terminal_coding
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
656 : &safe_terminal_coding);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
657
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
658 while (src < src_end)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
659 {
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
660 /* We must skip glyphs to be padded for a wide character. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
661 if (! CHAR_GLYPH_PADDING_P (*src))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
662 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
663 g = GLYPH_FROM_CHAR_GLYPH (src[0]);
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
664
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
665 if (g < 0 || g >= tlen)
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
666 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
667 /* This glyph doesn't has an entry in Vglyph_table. */
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
668 if (! CHAR_VALID_P (src->u.ch, 0))
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
669 {
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
670 len = 1;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
671 buf = " ";
29097
8b0db3f5a010 (encode_terminal_code): Set coding->src_multibyte properly.
Kenichi Handa <handa@m17n.org>
parents: 29019
diff changeset
672 coding->src_multibyte = 0;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
673 }
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
674 else
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
675 {
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
676 len = CHAR_STRING (src->u.ch, workbuf);
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
677 buf = workbuf;
29097
8b0db3f5a010 (encode_terminal_code): Set coding->src_multibyte properly.
Kenichi Handa <handa@m17n.org>
parents: 29019
diff changeset
678 coding->src_multibyte = 1;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
679 }
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
680 }
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
681 else
19035
0b4c1d43cb95 Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 18058
diff changeset
682 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
683 /* This glyph has an entry in Vglyph_table,
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
684 so process any alias before testing for simpleness. */
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
685 GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
686
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
687 if (GLYPH_SIMPLE_P (tbase, tlen, g))
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
688 {
27128
5cd86a04d3ef (encode_terminal_code): Fix the previous change.
Kenichi Handa <handa@m17n.org>
parents: 27087
diff changeset
689 /* We set the multi-byte form of a character in G
5cd86a04d3ef (encode_terminal_code): Fix the previous change.
Kenichi Handa <handa@m17n.org>
parents: 27087
diff changeset
690 (that should be an ASCII character) at
5cd86a04d3ef (encode_terminal_code): Fix the previous change.
Kenichi Handa <handa@m17n.org>
parents: 27087
diff changeset
691 WORKBUF. */
5cd86a04d3ef (encode_terminal_code): Fix the previous change.
Kenichi Handa <handa@m17n.org>
parents: 27087
diff changeset
692 workbuf[0] = FAST_GLYPH_CHAR (g);
5cd86a04d3ef (encode_terminal_code): Fix the previous change.
Kenichi Handa <handa@m17n.org>
parents: 27087
diff changeset
693 len = 1;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
694 buf = workbuf;
29097
8b0db3f5a010 (encode_terminal_code): Set coding->src_multibyte properly.
Kenichi Handa <handa@m17n.org>
parents: 29019
diff changeset
695 coding->src_multibyte = 0;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
696 }
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
697 else
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
698 {
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
699 /* We have a string in Vglyph_table. */
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
700 len = GLYPH_LENGTH (tbase, g);
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
701 buf = GLYPH_STRING (tbase, g);
29097
8b0db3f5a010 (encode_terminal_code): Set coding->src_multibyte properly.
Kenichi Handa <handa@m17n.org>
parents: 29019
diff changeset
702 coding->src_multibyte = STRING_MULTIBYTE (tbase[g]);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
703 }
19035
0b4c1d43cb95 Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 18058
diff changeset
704 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
705
24263
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
706 result = encode_coding (coding, buf, dst, len, dst_end - dst);
23338
0a2b76b09162 (encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents: 23066
diff changeset
707 len -= coding->consumed;
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
708 dst += coding->produced;
24263
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
709 if (result == CODING_FINISH_INSUFFICIENT_DST
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
710 || (result == CODING_FINISH_INSUFFICIENT_SRC
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
711 && len > dst_end - dst))
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
712 /* The remaining output buffer is too short. We must
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
713 break the loop here without increasing SRC so that the
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
714 next call of this function starts from the same glyph. */
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
715 break;
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
716
23338
0a2b76b09162 (encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents: 23066
diff changeset
717 if (len > 0)
0a2b76b09162 (encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents: 23066
diff changeset
718 {
24263
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
719 /* This is the case that a code of the range 0200..0237
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
720 exists in buf. We must just write out such a code. */
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
721 buf += coding->consumed;
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
722 while (len--)
e81f007b15fa (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 23338
diff changeset
723 *dst++ = *buf++;
23338
0a2b76b09162 (encode_terminal_code): Handle raw 8-bit codes correctly.
Kenichi Handa <handa@m17n.org>
parents: 23066
diff changeset
724 }
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
725 }
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
726 src++;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
727 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
728
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
729 *consumed = src - src_start;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
730 return (dst - dst_start);
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
731 }
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
732
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
733
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
734 /* Output LEN glyphs starting at STRING at the nominal cursor position.
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
735 Advance the nominal cursor over the text. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
736
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
737 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
738 write_glyphs (f, string, len)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
739 struct frame *f;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
740 register struct glyph *string;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741 register int len;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
742 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
743 if (FRAME_DISPLAY (f)->write_glyphs_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
744 (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
745 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
746
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
747 /* An implementation of write_glyphs for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
748
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
749 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
750 tty_write_glyphs (struct frame *f, struct glyph *string, int len)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
751 {
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
752 int produced, consumed;
30836
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
753 unsigned char conversion_buffer[1024];
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
754 int conversion_buffer_size = sizeof conversion_buffer;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
755
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
756 struct tty_display_info *tty = FRAME_TTY (f);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
757
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
758 turn_off_insert (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
759 tty_hide_cursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
760
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
761 /* Don't dare write in last column of bottom line, if Auto-Wrap,
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
762 since that would scroll the whole frame on some terminals. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
763
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
764 if (AutoWrap (tty)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
765 && curY (tty) + 1 == FRAME_LINES (f)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
766 && (curX (tty) + len) == FRAME_COLS (f))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
767 len --;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
768 if (len <= 0)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
769 return;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
770
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
771 cmplus (tty, len);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
772
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
773 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
774 the tail. */
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
775 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
776
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
777 while (len > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
778 {
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
779 /* Identify a run of glyphs with the same face. */
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
780 int face_id = string->face_id;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
781 int n;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
782
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
783 for (n = 1; n < len; ++n)
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
784 if (string[n].face_id != face_id)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
785 break;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
786
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
787 /* Turn appearance modes of the face of the run on. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
788 highlight_if_desired (tty);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
789 turn_on_face (f, face_id);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
790
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
791 while (n > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
792 {
30836
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
793 /* We use a fixed size (1024 bytes) of conversion buffer.
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
794 Usually it is sufficient, but if not, we just repeat the
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
795 loop. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
796 produced = encode_terminal_code (string, conversion_buffer,
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
797 n, conversion_buffer_size,
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
798 &consumed);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
799 if (produced > 0)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
800 {
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
801 fwrite (conversion_buffer, 1, produced,
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
802 tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
803 if (ferror (tty->output))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
804 clearerr (tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
805 if (tty->termscript)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
806 fwrite (conversion_buffer, 1, produced,
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
807 tty->termscript);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
808 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
809 len -= consumed;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
810 n -= consumed;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
811 string += consumed;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
813
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
814 /* Turn appearance modes off. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
815 turn_off_face (f, face_id);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
816 turn_off_highlight (tty);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
817 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
818
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
819 /* We may have to output some codes to terminate the writing. */
20223
1e30a8b4ff3f (encode_terminal_code): Use new macros defined in
Kenichi Handa <handa@m17n.org>
parents: 19385
diff changeset
820 if (CODING_REQUIRE_FLUSHING (&terminal_coding))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
821 {
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
822 terminal_coding.mode |= CODING_MODE_LAST_BLOCK;
23066
d40f9a8d7779 (write_glyphs): When terminal_coding require flushing,
Kenichi Handa <handa@m17n.org>
parents: 21827
diff changeset
823 encode_coding (&terminal_coding, "", conversion_buffer,
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
824 0, conversion_buffer_size);
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
825 if (terminal_coding.produced > 0)
19277
7ea957cd48e2 (encode_terminal_code): Use safe_terminal_coding if
Kenichi Handa <handa@m17n.org>
parents: 19035
diff changeset
826 {
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
827 fwrite (conversion_buffer, 1, terminal_coding.produced,
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
828 tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
829 if (ferror (tty->output))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
830 clearerr (tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
831 if (tty->termscript)
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
832 fwrite (conversion_buffer, 1, terminal_coding.produced,
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
833 tty->termscript);
19277
7ea957cd48e2 (encode_terminal_code): Use safe_terminal_coding if
Kenichi Handa <handa@m17n.org>
parents: 19035
diff changeset
834 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
835 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
836
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
837 cmcheckmagic (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
839
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
840 /* Insert LEN glyphs from START at the nominal cursor position.
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
841
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
842 If start is zero, insert blanks instead of a string at start */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
843
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
844 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
845 insert_glyphs (f, start, len)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
846 struct frame *f;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
847 register struct glyph *start;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 register int len;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 {
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
850 if (len <= 0)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
851 return;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
852
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
853 if (FRAME_DISPLAY (f)->insert_glyphs_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
854 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
855 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
856
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
857 /* An implementation of insert_glyphs for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
858
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
859 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
860 tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
861 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
862 char *buf;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
863 struct glyph *glyph = NULL;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
864
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
865 struct tty_display_info *tty = FRAME_TTY (f);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
866
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
867 if (tty->TS_ins_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
869 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
870 OUTPUT1 (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
871 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
872 if (start)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
873 write_glyphs (f, start, len);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
874 return;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
875 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
876
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
877 turn_on_insert (tty);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
878 cmplus (tty, len);
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
879 /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail. */
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
880 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
17191
36caec9c2e52 (insert_glyphs): Fix a bug which turns up when
Kenichi Handa <handa@m17n.org>
parents: 17180
diff changeset
881 while (len-- > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
882 {
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
883 int produced, consumed;
30836
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
884 unsigned char conversion_buffer[1024];
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
885 int conversion_buffer_size = sizeof conversion_buffer;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
886
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
887 OUTPUT1_IF (tty, tty->TS_ins_char);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
888 if (!start)
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
889 {
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
890 conversion_buffer[0] = SPACEGLYPH;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
891 produced = 1;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
892 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893 else
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
894 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
895 highlight_if_desired (tty);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
896 turn_on_face (f, start->face_id);
27085
59913a531d4e (insert_glyphs): Pass glyph, not &glyph, to
Eli Zaretskii <eliz@gnu.org>
parents: 26999
diff changeset
897 glyph = start;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
898 ++start;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
899 /* We must open sufficient space for a character which
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
900 occupies more than one column. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
901 while (len && CHAR_GLYPH_PADDING_P (*start))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
902 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
903 OUTPUT1_IF (tty, tty->TS_ins_char);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
904 start++, len--;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
905 }
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
906
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
907 if (len <= 0)
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
908 /* This is the last glyph. */
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
909 terminal_coding.mode |= CODING_MODE_LAST_BLOCK;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
910
30836
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
911 /* The size of conversion buffer (1024 bytes) is surely
b590724d8c48 (write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents: 30821
diff changeset
912 sufficient for just one glyph. */
27085
59913a531d4e (insert_glyphs): Pass glyph, not &glyph, to
Eli Zaretskii <eliz@gnu.org>
parents: 26999
diff changeset
913 produced = encode_terminal_code (glyph, conversion_buffer, 1,
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
914 conversion_buffer_size, &consumed);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
915 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
917 if (produced > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 {
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
919 fwrite (conversion_buffer, 1, produced,
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
920 tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
921 if (ferror (tty->output))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
922 clearerr (tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
923 if (tty->termscript)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
924 fwrite (conversion_buffer, 1, produced,
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
925 tty->termscript);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
928 OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
929 if (start)
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
930 {
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
931 turn_off_face (f, glyph->face_id);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
932 turn_off_highlight (tty);
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
933 }
10439
1fcbeb4410f6 (write_glyphs, insert_glyphs): Call checkmagic.
Karl Heuer <kwzh@gnu.org>
parents: 10332
diff changeset
934 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
935
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
936 cmcheckmagic (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
939 /* Delete N glyphs at the nominal cursor position. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
940
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
941 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
942 delete_glyphs (f, n)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
943 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 register int n;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
946 if (FRAME_DISPLAY (f)->delete_glyphs_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
947 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
948 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
949
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
950 /* An implementation of delete_glyphs for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
951
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
952 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
953 tty_delete_glyphs (struct frame *f, int n)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
954 {
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 char *buf;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
957
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
958 struct tty_display_info *tty = FRAME_TTY (f);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
959
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
960 if (tty->delete_in_insert_mode)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
962 turn_on_insert (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
966 turn_off_insert (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
967 OUTPUT_IF (tty, tty->TS_delete_mode);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
970 if (tty->TS_del_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
972 buf = tparam (tty->TS_del_multi_chars, 0, 0, n);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
973 OUTPUT1 (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
974 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 for (i = 0; i < n; i++)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
978 OUTPUT1 (tty, tty->TS_del_char);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
979 if (!tty->delete_in_insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
980 OUTPUT_IF (tty, tty->TS_end_delete_mode);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
981 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
982
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
983 /* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
984
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
985 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
986 ins_del_lines (f, vpos, n)
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
987 struct frame *f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 int vpos, n;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
990 if (FRAME_DISPLAY (f)->ins_del_lines_hook)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
991 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
992 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
993
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
994 /* An implementation of ins_del_lines for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
995
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
996 void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
997 tty_ins_del_lines (struct frame *f, int vpos, int n)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
998 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
999 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1000 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1001 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1002 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 register int i = n > 0 ? n : -n;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 register char *buf;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007 /* If the lines below the insertion are being pushed
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 into the end of the window, this is the same as clearing;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 and we know the lines are already clear, since the matching
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 deletion has already been done. So can ignore this. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 /* If the lines below the deletion are blank lines coming
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1012 out of the end of the window, don't bother,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013 as there will be a matching inslines later that will flush them. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1014 if (FRAME_SCROLL_REGION_OK (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1015 && vpos + i >= tty->specified_window)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1016 return;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1017 if (!FRAME_MEMORY_BELOW_FRAME (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1018 && vpos + i >= FRAME_LINES (f))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019 return;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1020
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021 if (multi)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 raw_cursor_to (vpos, 0);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1024 background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1025 buf = tparam (multi, 0, 0, i);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1026 OUTPUT (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
1027 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029 else if (single)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 raw_cursor_to (vpos, 0);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1032 background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033 while (--i >= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1034 OUTPUT (tty, single);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1035 if (tty->TF_teleray)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1036 curX (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1037 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1038 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
1040 set_scroll_region (f, vpos, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1041 if (n < 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1042 raw_cursor_to (tty->specified_window - 1, 0);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1043 else
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1044 raw_cursor_to (vpos, 0);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1045 background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1046 while (--i >= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1047 OUTPUTL (tty, scroll, tty->specified_window - vpos);
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
1048 set_scroll_region (f, 0, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1049 }
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1050
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1051 if (!FRAME_SCROLL_REGION_OK (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1052 && FRAME_MEMORY_BELOW_FRAME (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1053 && n < 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1054 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
1055 cursor_to (f, FRAME_LINES (f) + n, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
1056 clear_to_end (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1057 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1058 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1059
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1060 /* Compute cost of sending "str", in characters,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1061 not counting any line-dependent padding. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063 int
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1064 string_cost (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1065 char *str;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1066 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1067 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1068 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069 tputs (str, 0, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1071 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1073 /* Compute cost of sending "str", in characters,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1074 counting any line-dependent padding at one line. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1075
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1076 static int
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1077 string_cost_one_line (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1078 char *str;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1079 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1081 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1082 tputs (str, 1, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1083 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1084 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1085
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1086 /* Compute per line amount of line-dependent padding,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1087 in tenths of characters. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1088
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1089 int
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 per_line_cost (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091 register char *str;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1093 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1094 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1095 tputs (str, 0, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1096 cost = - cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1097 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098 tputs (str, 10, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1099 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1102 #ifndef old
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1103 /* char_ins_del_cost[n] is cost of inserting N characters.
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
1104 char_ins_del_cost[-n] is cost of deleting N characters.
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
1105 The length of this vector is based on max_frame_cols. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1106
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1107 int *char_ins_del_vector;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1108
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
1109 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))])
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1110 #endif
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1111
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1112 /* ARGSUSED */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1113 static void
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1114 calculate_ins_del_char_costs (f)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1115 FRAME_PTR f;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1116 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1117 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1118 int ins_startup_cost, del_startup_cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1119 int ins_cost_per_char, del_cost_per_char;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1120 register int i;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121 register int *p;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1122
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1123 if (tty->TS_ins_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1124 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1125 ins_cost_per_char = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1126 ins_startup_cost = string_cost_one_line (tty->TS_ins_multi_chars);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1127 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1128 else if (tty->TS_ins_char || tty->TS_pad_inserted_char
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1129 || (tty->TS_insert_mode && tty->TS_end_insert_mode))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1130 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1131 ins_startup_cost = (30 * (string_cost (tty->TS_insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1132 + string_cost (tty->TS_end_insert_mode))) / 100;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1133 ins_cost_per_char = (string_cost_one_line (tty->TS_ins_char)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1134 + string_cost_one_line (tty->TS_pad_inserted_char));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1135 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1136 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 ins_startup_cost = 9999;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 ins_cost_per_char = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1140 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1141
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1142 if (tty->TS_del_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1143 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1144 del_cost_per_char = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1145 del_startup_cost = string_cost_one_line (tty->TS_del_multi_chars);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1146 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1147 else if (tty->TS_del_char)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1148 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1149 del_startup_cost = (string_cost (tty->TS_delete_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1150 + string_cost (tty->TS_end_delete_mode));
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1151 if (tty->delete_in_insert_mode)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1152 del_startup_cost /= 2;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1153 del_cost_per_char = string_cost_one_line (tty->TS_del_char);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1154 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1155 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1156 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1157 del_startup_cost = 9999;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1158 del_cost_per_char = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1159 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1160
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1161 /* Delete costs are at negative offsets */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1162 p = &char_ins_del_cost (f)[0];
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1163 for (i = FRAME_COLS (f); --i >= 0;)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1164 *--p = (del_startup_cost += del_cost_per_char);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1165
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1166 /* Doing nothing is free */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1167 p = &char_ins_del_cost (f)[0];
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1168 *p++ = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1169
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1170 /* Insert costs are at positive offsets */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1171 for (i = FRAME_COLS (f); --i >= 0;)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1172 *p++ = (ins_startup_cost += ins_cost_per_char);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1173 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1174
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
1175 void
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
1176 calculate_costs (frame)
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
1177 FRAME_PTR frame;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1178 {
10121
3f9f77a9488d (calculate_costs): Set FRAME_COST_BAUD_RATE.
Richard M. Stallman <rms@gnu.org>
parents: 9797
diff changeset
1179 FRAME_COST_BAUD_RATE (frame) = baud_rate;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1180
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
1181 if (FRAME_TERMCAP_P (frame))
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1182 {
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1183 struct tty_display_info *tty = FRAME_TTY (frame);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1184 register char *f = (tty->TS_set_scroll_region
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1185 ? tty->TS_set_scroll_region
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1186 : tty->TS_set_scroll_region_1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1187
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1188 FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1189
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1190 tty->costs_set = 1;
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1191
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1192 /* These variables are only used for terminal stuff. They are
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1193 allocated once for the terminal frame of X-windows emacs, but not
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1194 used afterwards.
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1195
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1196 char_ins_del_vector (i.e., char_ins_del_cost) isn't used because
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1197 X turns off char_ins_del_ok. */
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1198
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1199 max_frame_lines = max (max_frame_lines, FRAME_LINES (frame));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1200 max_frame_cols = max (max_frame_cols, FRAME_COLS (frame));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1201
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1202 if (char_ins_del_vector != 0)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1203 char_ins_del_vector
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1204 = (int *) xrealloc (char_ins_del_vector,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1205 (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1206 + 2 * max_frame_cols * sizeof (int)));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1207 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1208 char_ins_del_vector
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1209 = (int *) xmalloc (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1210 + 2 * max_frame_cols * sizeof (int));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1211
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1212 bzero (char_ins_del_vector, (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1213 + 2 * max_frame_cols * sizeof (int)));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1214
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1215
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1216 if (f && (!tty->TS_ins_line && !tty->TS_del_line))
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1217 do_line_insertion_deletion_costs (frame,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1218 tty->TS_rev_scroll, tty->TS_ins_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1219 tty->TS_fwd_scroll, tty->TS_del_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1220 f, f, 1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1221 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1222 do_line_insertion_deletion_costs (frame,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1223 tty->TS_ins_line, tty->TS_ins_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1224 tty->TS_del_line, tty->TS_del_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1225 0, 0, 1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1226
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1227 calculate_ins_del_char_costs (frame);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1228
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1229 /* Don't use TS_repeat if its padding is worse than sending the chars */
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1230 if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1231 tty->RPov = string_cost (tty->TS_repeat);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1232 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1233 tty->RPov = FRAME_COLS (frame) * 2;
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1234
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1235 cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1236 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1237 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1238
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1239 struct fkey_table {
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1240 char *cap, *name;
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1241 };
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1242
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1243 /* Termcap capability names that correspond directly to X keysyms.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1244 Some of these (marked "terminfo") aren't supplied by old-style
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1245 (Berkeley) termcap entries. They're listed in X keysym order;
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1246 except we put the keypad keys first, so that if they clash with
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1247 other keys (as on the IBM PC keyboard) they get overridden.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1248 */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1249
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1250 static struct fkey_table keys[] =
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1251 {
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1252 {"kh", "home"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1253 {"kl", "left"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1254 {"ku", "up"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1255 {"kr", "right"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1256 {"kd", "down"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1257 {"%8", "prior"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1258 {"%5", "next"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1259 {"@7", "end"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1260 {"@1", "begin"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1261 {"*6", "select"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1262 {"%9", "print"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1263 {"@4", "execute"}, /* terminfo --- actually the `command' key */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1264 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1265 * "insert" --- see below
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1266 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1267 {"&8", "undo"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1268 {"%0", "redo"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1269 {"%7", "menu"}, /* terminfo --- actually the `options' key */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1270 {"@0", "find"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1271 {"@2", "cancel"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1272 {"%1", "help"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1273 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1274 * "break" goes here, but can't be reliably intercepted with termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1275 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1276 {"&4", "reset"}, /* terminfo --- actually `restart' */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1277 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1278 * "system" and "user" --- no termcaps
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1279 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1280 {"kE", "clearline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1281 {"kA", "insertline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1282 {"kL", "deleteline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1283 {"kI", "insertchar"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1284 {"kD", "deletechar"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1285 {"kB", "backtab"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1286 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1287 * "kp_backtab", "kp-space", "kp-tab" --- no termcaps
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1288 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1289 {"@8", "kp-enter"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1290 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1291 * "kp-f1", "kp-f2", "kp-f3" "kp-f4",
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1292 * "kp-multiply", "kp-add", "kp-separator",
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1293 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0";
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1294 * --- no termcaps for any of these.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1295 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1296 {"K4", "kp-1"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1297 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1298 * "kp-2" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1299 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1300 {"K5", "kp-3"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1301 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1302 * "kp-4" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1303 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1304 {"K2", "kp-5"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1305 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1306 * "kp-6" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1307 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1308 {"K1", "kp-7"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1309 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1310 * "kp-8" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1311 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1312 {"K3", "kp-9"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1313 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1314 * "kp-equal" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1315 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1316 {"k1", "f1"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1317 {"k2", "f2"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1318 {"k3", "f3"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1319 {"k4", "f4"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1320 {"k5", "f5"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1321 {"k6", "f6"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1322 {"k7", "f7"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1323 {"k8", "f8"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1324 {"k9", "f9"}
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1325 };
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1326
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1327 static char **term_get_fkeys_arg;
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1328 static Lisp_Object term_get_fkeys_1 ();
4543
929e4c850e76 (term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 4499
diff changeset
1329
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1330 /* Find the escape codes sent by the function keys for Vfunction_key_map.
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1331 This function scans the termcap function key sequence entries, and
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1332 adds entries to Vfunction_key_map for each function key it finds. */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1333
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1334 void
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1335 term_get_fkeys (address)
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1336 char **address;
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1337 {
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1338 /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1339 errors during the call. The only errors should be from Fdefine_key
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1340 when given a key sequence containing an invalid prefix key. If the
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1341 termcap defines function keys which use a prefix that is already bound
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1342 to a command by the default bindings, we should silently ignore that
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1343 function key specification, rather than giving the user an error and
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1344 refusing to run at all on such a terminal. */
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1345
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1346 extern Lisp_Object Fidentity ();
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1347 term_get_fkeys_arg = address;
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1348 internal_condition_case (term_get_fkeys_1, Qerror, Fidentity);
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1349 }
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1350
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1351 static Lisp_Object
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1352 term_get_fkeys_1 ()
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1353 {
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1354 int i;
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1355
6250
a08cca81d0bd (term_get_fkeys_1): Use term_get_fkeys_arg, not term_get_fkeys_address.
Roland McGrath <roland@gnu.org>
parents: 6249
diff changeset
1356 char **address = term_get_fkeys_arg;
6249
365e7cbd7292 (term_get_fkeys_1): New local var ADDRESS, init to term_get_fkeys_address.
Roland McGrath <roland@gnu.org>
parents: 6248
diff changeset
1357
3359
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1358 /* This can happen if CANNOT_DUMP or with strange options. */
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1359 if (!initialized)
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1360 Vfunction_key_map = Fmake_sparse_keymap (Qnil);
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1361
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1362 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1363 {
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1364 char *sequence = tgetstr (keys[i].cap, address);
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1365 if (sequence)
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1366 Fdefine_key (Vfunction_key_map, build_string (sequence),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1367 Fmake_vector (make_number (1),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1368 intern (keys[i].name)));
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1369 }
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1370
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1371 /* The uses of the "k0" capability are inconsistent; sometimes it
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1372 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3489
diff changeset
1373 We will attempt to politely accommodate both systems by testing for
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1374 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1375 */
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1376 {
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1377 char *k_semi = tgetstr ("k;", address);
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1378 char *k0 = tgetstr ("k0", address);
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1379 char *k0_name = "f10";
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1380
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1381 if (k_semi)
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1382 {
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1383 if (k0)
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1384 /* Define f0 first, so that f10 takes precedence in case the
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1385 key sequences happens to be the same. */
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1386 Fdefine_key (Vfunction_key_map, build_string (k0),
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1387 Fmake_vector (make_number (1), intern ("f0")));
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1388 Fdefine_key (Vfunction_key_map, build_string (k_semi),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1389 Fmake_vector (make_number (1), intern ("f10")));
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1390 }
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1391 else if (k0)
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1392 Fdefine_key (Vfunction_key_map, build_string (k0),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1393 Fmake_vector (make_number (1), intern (k0_name)));
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1394 }
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1395
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1396 /* Set up cookies for numbered function keys above f10. */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1397 {
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1398 char fcap[3], fkey[4];
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1399
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1400 fcap[0] = 'F'; fcap[2] = '\0';
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1401 for (i = 11; i < 64; i++)
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1402 {
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1403 if (i <= 19)
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1404 fcap[1] = '1' + i - 11;
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1405 else if (i <= 45)
10481
24756aef26e3 (term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents: 10439
diff changeset
1406 fcap[1] = 'A' + i - 20;
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1407 else
10481
24756aef26e3 (term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents: 10439
diff changeset
1408 fcap[1] = 'a' + i - 46;
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1409
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1410 {
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1411 char *sequence = tgetstr (fcap, address);
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1412 if (sequence)
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1413 {
4543
929e4c850e76 (term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 4499
diff changeset
1414 sprintf (fkey, "f%d", i);
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1415 Fdefine_key (Vfunction_key_map, build_string (sequence),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1416 Fmake_vector (make_number (1),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1417 intern (fkey)));
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1418 }
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1419 }
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1420 }
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1421 }
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1422
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1423 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1424 * Various mappings to try and get a better fit.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1425 */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1426 {
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1427 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1428 if (!tgetstr (cap1, address)) \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1429 { \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1430 char *sequence = tgetstr (cap2, address); \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1431 if (sequence) \
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1432 Fdefine_key (Vfunction_key_map, build_string (sequence), \
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1433 Fmake_vector (make_number (1), \
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1434 intern (sym))); \
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1435 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1436
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1437 /* if there's no key_next keycap, map key_npage to `next' keysym */
2243
23228edebc59 Fix spacing conventions.
Richard M. Stallman <rms@gnu.org>
parents: 2239
diff changeset
1438 CONDITIONAL_REASSIGN ("%5", "kN", "next");
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1439 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
3706
5a563b062c0d (term_get_fkeys): Use `prior', not `previous', for %8/kP.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1440 CONDITIONAL_REASSIGN ("%8", "kP", "prior");
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1441 /* if there's no key_dc keycap, map key_ic to `insert' keysym */
2243
23228edebc59 Fix spacing conventions.
Richard M. Stallman <rms@gnu.org>
parents: 2239
diff changeset
1442 CONDITIONAL_REASSIGN ("kD", "kI", "insert");
19385
8f58b5d12021 (term_get_fkeys_1): Use kH as alternate for move-to-last-line.
Richard M. Stallman <rms@gnu.org>
parents: 19277
diff changeset
1443 /* if there's no key_end keycap, map key_ll to 'end' keysym */
8f58b5d12021 (term_get_fkeys_1): Use kH as alternate for move-to-last-line.
Richard M. Stallman <rms@gnu.org>
parents: 19277
diff changeset
1444 CONDITIONAL_REASSIGN ("@7", "kH", "end");
9524
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1445
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1446 /* IBM has their own non-standard dialect of terminfo.
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1447 If the standard name isn't found, try the IBM name. */
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1448 CONDITIONAL_REASSIGN ("kB", "KO", "backtab");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1449 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1450 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1451 CONDITIONAL_REASSIGN ("%7", "ki", "menu");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1452 CONDITIONAL_REASSIGN ("@7", "kw", "end");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1453 CONDITIONAL_REASSIGN ("F1", "k<", "f11");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1454 CONDITIONAL_REASSIGN ("F2", "k>", "f12");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1455 CONDITIONAL_REASSIGN ("%1", "kq", "help");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1456 CONDITIONAL_REASSIGN ("*6", "kU", "select");
2224
49bda4cf498c Supply second arg for tgetstr() calls.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2179
diff changeset
1457 #undef CONDITIONAL_REASSIGN
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1458 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1459
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1460 return Qnil;
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1461 }
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1462
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1463
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1464 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1465 Character Display Information
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1466 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1467
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1468 static void append_glyph P_ ((struct it *));
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1469 static void produce_stretch_glyph P_ ((struct it *));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1470
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1471
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1472 /* Append glyphs to IT's glyph_row. Called from produce_glyphs for
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1473 terminal frames if IT->glyph_row != NULL. IT->c is the character
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1474 for which to produce glyphs; IT->face_id contains the character's
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1475 face. Padding glyphs are appended if IT->c has a IT->pixel_width >
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1476 1. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1477
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1478 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1479 append_glyph (it)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1480 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1481 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1482 struct glyph *glyph, *end;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1483 int i;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1484
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1485 xassert (it->glyph_row);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1486 glyph = (it->glyph_row->glyphs[it->area]
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1487 + it->glyph_row->used[it->area]);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1488 end = it->glyph_row->glyphs[1 + it->area];
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1489
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1490 for (i = 0;
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1491 i < it->pixel_width && glyph < end;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1492 ++i)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1493 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1494 glyph->type = CHAR_GLYPH;
29462
3306af2e4f3d (append_glyph): Revert change of 2000-06-06.
Gerd Moellmann <gerd@gnu.org>
parents: 29448
diff changeset
1495 glyph->pixel_width = 1;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1496 glyph->u.ch = it->c;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1497 glyph->face_id = it->face_id;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1498 glyph->padding_p = i > 0;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1499 glyph->charpos = CHARPOS (it->position);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1500 glyph->object = it->object;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1501
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1502 ++it->glyph_row->used[it->area];
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1503 ++glyph;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1504 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1505 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1506
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1507
44372
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1508 /* Produce glyphs for the display element described by IT. *IT
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1509 specifies what we want to produce a glyph for (character, image, ...),
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1510 and where in the glyph matrix we currently are (glyph row and hpos).
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1511 produce_glyphs fills in output fields of *IT with information such as the
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1512 pixel width and height of a character, and maybe output actual glyphs at
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1513 the same time if IT->glyph_row is non-null. See the explanation of
44372
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1514 struct display_iterator in dispextern.h for an overview.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1515
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1516 produce_glyphs also stores the result of glyph width, ascent
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1517 etc. computations in *IT.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1518
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1519 IT->glyph_row may be null, in which case produce_glyphs does not
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1520 actually fill in the glyphs. This is used in the move_* functions
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1521 in xdisp.c for text width and height computations.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1522
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1523 Callers usually don't call produce_glyphs directly;
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1524 instead they use the macro PRODUCE_GLYPHS. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1525
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1526 void
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1527 produce_glyphs (it)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1528 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1529 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1530 /* If a hook is installed, let it do the work. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1531 xassert (it->what == IT_CHARACTER
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1532 || it->what == IT_COMPOSITION
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1533 || it->what == IT_STRETCH);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1534
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1535 if (it->what == IT_STRETCH)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1536 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1537 produce_stretch_glyph (it);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1538 goto done;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1539 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1540
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1541 /* Nothing but characters are supported on terminal frames. For a
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1542 composition sequence, it->c is the first character of the
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1543 sequence. */
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1544 xassert (it->what == IT_CHARACTER
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1545 || it->what == IT_COMPOSITION);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1546
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1547 if (it->c >= 040 && it->c < 0177)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1548 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1549 it->pixel_width = it->nglyphs = 1;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1550 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1551 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1552 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1553 else if (it->c == '\n')
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1554 it->pixel_width = it->nglyphs = 0;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1555 else if (it->c == '\t')
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1556 {
28685
b4310b6f3b5e (produce_glyphs): Remove reference to struct it's prompt_width.
Gerd Moellmann <gerd@gnu.org>
parents: 28507
diff changeset
1557 int absolute_x = (it->current_x
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1558 + it->continuation_lines_width);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1559 int next_tab_x
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1560 = (((1 + absolute_x + it->tab_width - 1)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1561 / it->tab_width)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1562 * it->tab_width);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1563 int nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1564
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1565 /* If part of the TAB has been displayed on the previous line
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1566 which is continued now, continuation_lines_width will have
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1567 been incremented already by the part that fitted on the
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1568 continued line. So, we will get the right number of spaces
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1569 here. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1570 nspaces = next_tab_x - absolute_x;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1571
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1572 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1573 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1574 int n = nspaces;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1575
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1576 it->c = ' ';
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1577 it->pixel_width = it->len = 1;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1578
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1579 while (n--)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1580 append_glyph (it);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1581
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1582 it->c = '\t';
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1583 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1584
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1585 it->pixel_width = nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1586 it->nglyphs = nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1587 }
29262
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1588 else if (SINGLE_BYTE_CHAR_P (it->c))
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1589 {
29263
167d236e633b Correct a typo in a comment.
Eli Zaretskii <eliz@gnu.org>
parents: 29262
diff changeset
1590 /* Coming here means that it->c is from display table, thus we
29262
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1591 must send the code as is to the terminal. Although there's
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1592 no way to know how many columns it occupies on a screen, it
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1593 is a good assumption that a single byte code has 1-column
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1594 width. */
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1595 it->pixel_width = it->nglyphs = 1;
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1596 if (it->glyph_row)
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1597 append_glyph (it);
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1598 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1599 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1600 {
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1601 /* A multi-byte character. The display width is fixed for all
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1602 characters of the set. Some of the glyphs may have to be
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1603 ignored because they are already displayed in a continued
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1604 line. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1605 int charset = CHAR_CHARSET (it->c);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1606
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1607 it->pixel_width = CHARSET_WIDTH (charset);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1608 it->nglyphs = it->pixel_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1609
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1610 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1611 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1612 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1613
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1614 done:
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1615 /* Advance current_x by the pixel width as a convenience for
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1616 the caller. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1617 if (it->area == TEXT_AREA)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1618 it->current_x += it->pixel_width;
25187
39feb68ed3c7 (produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents: 25002
diff changeset
1619 it->ascent = it->max_ascent = it->phys_ascent = it->max_phys_ascent = 0;
39feb68ed3c7 (produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents: 25002
diff changeset
1620 it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1621 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1622
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1623
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1624 /* Produce a stretch glyph for iterator IT. IT->object is the value
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1625 of the glyph property displayed. The value must be a list
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1626 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1627 being recognized:
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1628
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1629 1. `:width WIDTH' specifies that the space should be WIDTH *
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1630 canonical char width wide. WIDTH may be an integer or floating
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1631 point number.
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1632
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1633 2. `:align-to HPOS' specifies that the space should be wide enough
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1634 to reach HPOS, a value in canonical character units. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1635
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1636 static void
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1637 produce_stretch_glyph (it)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1638 struct it *it;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1639 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1640 /* (space :width WIDTH ...) */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1641 Lisp_Object prop, plist;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1642 int width = 0, align_to = -1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1643 int zero_width_ok_p = 0;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1644 double tem;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1645
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1646 /* List should start with `space'. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1647 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1648 plist = XCDR (it->object);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1649
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1650 /* Compute the width of the stretch. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1651 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1652 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, 0))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1653 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1654 /* Absolute width `:width WIDTH' specified and valid. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1655 zero_width_ok_p = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1656 width = (int)(tem + 0.5);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1657 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1658 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1659 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, &align_to))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1660 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1661 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1662 align_to = (align_to < 0
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1663 ? 0
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1664 : align_to - window_box_left_offset (it->w, TEXT_AREA));
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1665 else if (align_to < 0)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1666 align_to = window_box_left_offset (it->w, TEXT_AREA);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1667 width = max (0, (int)(tem + 0.5) + align_to - it->current_x);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1668 zero_width_ok_p = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1669 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1670 else
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1671 /* Nothing specified -> width defaults to canonical char width. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1672 width = FRAME_COLUMN_WIDTH (it->f);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1673
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1674 if (width <= 0 && (width < 0 || !zero_width_ok_p))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1675 width = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1676
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1677 if (width > 0 && it->glyph_row)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1678 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1679 Lisp_Object o_object = it->object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1680 Lisp_Object object = it->stack[it->sp - 1].string;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1681 int n = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1682 int c = it->c;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1683
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1684 if (!STRINGP (object))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1685 object = it->w->buffer;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1686 it->object = object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1687 it->c = ' ';
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1688 it->pixel_width = it->len = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1689 while (n--)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1690 append_glyph (it);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1691 it->object = o_object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1692 it->c = c;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1693 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1694 it->pixel_width = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1695 it->nglyphs = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1696 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1697
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1698
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1699 /* Get information about special display element WHAT in an
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1700 environment described by IT. WHAT is one of IT_TRUNCATION or
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1701 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1702 non-null glyph_row member. This function ensures that fields like
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1703 face_id, c, len of IT are left untouched. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1704
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1705 void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1706 produce_special_glyphs (it, what)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1707 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1708 enum display_element_type what;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1709 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1710 struct it temp_it;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1711
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1712 temp_it = *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1713 temp_it.dp = NULL;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1714 temp_it.what = IT_CHARACTER;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1715 temp_it.len = 1;
28507
b6f06a755c7d make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP
Ken Raeburn <raeburn@raeburn.org>
parents: 28465
diff changeset
1716 temp_it.object = make_number (0);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1717 bzero (&temp_it.current, sizeof temp_it.current);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1718
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1719 if (what == IT_CONTINUATION)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1720 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1721 /* Continuation glyph. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1722 if (it->dp
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1723 && INTEGERP (DISP_CONTINUE_GLYPH (it->dp))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1724 && GLYPH_CHAR_VALID_P (XINT (DISP_CONTINUE_GLYPH (it->dp))))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1725 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1726 temp_it.c = FAST_GLYPH_CHAR (XINT (DISP_CONTINUE_GLYPH (it->dp)));
29019
50e144ba4af7 (produce_special_glyphs): Use CHAR_BYTES instead of
Kenichi Handa <handa@m17n.org>
parents: 28685
diff changeset
1727 temp_it.len = CHAR_BYTES (temp_it.c);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1728 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1729 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1730 temp_it.c = '\\';
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1731
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1732 produce_glyphs (&temp_it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1733 it->pixel_width = temp_it.pixel_width;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1734 it->nglyphs = temp_it.pixel_width;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1735 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1736 else if (what == IT_TRUNCATION)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1737 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1738 /* Truncation glyph. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1739 if (it->dp
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1740 && INTEGERP (DISP_TRUNC_GLYPH (it->dp))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1741 && GLYPH_CHAR_VALID_P (XINT (DISP_TRUNC_GLYPH (it->dp))))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1742 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1743 temp_it.c = FAST_GLYPH_CHAR (XINT (DISP_TRUNC_GLYPH (it->dp)));
29019
50e144ba4af7 (produce_special_glyphs): Use CHAR_BYTES instead of
Kenichi Handa <handa@m17n.org>
parents: 28685
diff changeset
1744 temp_it.len = CHAR_BYTES (temp_it.c);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1745 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1746 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1747 temp_it.c = '$';
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1748
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1749 produce_glyphs (&temp_it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1750 it->pixel_width = temp_it.pixel_width;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1751 it->nglyphs = temp_it.pixel_width;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1752 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1753 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1754 abort ();
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1755 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1756
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1757
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1758
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1759 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1760 Faces
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1761 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1762
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1763 /* Value is non-zero if attribute ATTR may be used. ATTR should be
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1764 one of the enumerators from enum no_color_bit, or a bit set built
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1765 from them. Some display attributes may not be used together with
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1766 color; the termcap capability `NC' specifies which ones. */
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1767
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1768 #define MAY_USE_WITH_COLORS_P(tty, ATTR) \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1769 (tty->TN_max_colors > 0 \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1770 ? (tty->TN_no_color_video & (ATTR)) == 0 \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1771 : 1)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1772
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1773 /* Turn appearances of face FACE_ID on tty frame F on. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1774
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1775 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1776 turn_on_face (f, face_id)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1777 struct frame *f;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1778 int face_id;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1779 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1780 struct face *face = FACE_FROM_ID (f, face_id);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1781 long fg = face->foreground;
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1782 long bg = face->background;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1783 struct tty_display_info *tty = FRAME_TTY (f);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1784
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1785 /* Do this first because TS_end_standout_mode may be the same
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1786 as TS_exit_attribute_mode, which turns all appearances off. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1787 if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE))
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1788 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1789 if (tty->TN_max_colors > 0)
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1790 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1791 if (fg >= 0 && bg >= 0)
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1792 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1793 /* If the terminal supports colors, we can set them
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1794 below without using reverse video. The face's fg
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1795 and bg colors are set as they should appear on
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1796 the screen, i.e. they take the inverse-video'ness
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1797 of the face already into account. */
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1798 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1799 else if (inverse_video)
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1800 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1801 if (fg == FACE_TTY_DEFAULT_FG_COLOR
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1802 || bg == FACE_TTY_DEFAULT_BG_COLOR)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1803 toggle_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1804 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1805 else
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1806 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1807 if (fg == FACE_TTY_DEFAULT_BG_COLOR
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1808 || bg == FACE_TTY_DEFAULT_FG_COLOR)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1809 toggle_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1810 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1811 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1812 else
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1813 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1814 /* If we can't display colors, use reverse video
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1815 if the face specifies that. */
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1816 if (inverse_video)
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1817 {
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1818 if (fg == FACE_TTY_DEFAULT_FG_COLOR
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1819 || bg == FACE_TTY_DEFAULT_BG_COLOR)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1820 toggle_highlight (tty);
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1821 }
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1822 else
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1823 {
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1824 if (fg == FACE_TTY_DEFAULT_BG_COLOR
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1825 || bg == FACE_TTY_DEFAULT_FG_COLOR)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1826 toggle_highlight (tty);
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1827 }
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1828 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1829 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1830
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1831 if (face->tty_bold_p)
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1832 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1833 if (MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1834 OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1835 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1836 else if (face->tty_dim_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1837 if (MAY_USE_WITH_COLORS_P (tty, NC_DIM))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1838 OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1839
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1840 /* Alternate charset and blinking not yet used. */
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1841 if (face->tty_alt_charset_p
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1842 && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1843 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1844
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1845 if (face->tty_blinking_p
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1846 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1847 OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1848
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1849 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1850 OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1851
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1852 if (tty->TN_max_colors > 0)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1853 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1854 char *p;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1855
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1856 if (fg >= 0 && tty->TS_set_foreground)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1857 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1858 p = tparam (tty->TS_set_foreground, NULL, 0, (int) fg);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
1859 OUTPUT (tty, p);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1860 xfree (p);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1861 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1862
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1863 if (bg >= 0 && tty->TS_set_background)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1864 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1865 p = tparam (tty->TS_set_background, NULL, 0, (int) bg);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
1866 OUTPUT (tty, p);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1867 xfree (p);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1868 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1869 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1870 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1871
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1872
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1873 /* Turn off appearances of face FACE_ID on tty frame F. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1874
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1875 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1876 turn_off_face (f, face_id)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1877 struct frame *f;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1878 int face_id;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1879 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1880 struct face *face = FACE_FROM_ID (f, face_id);
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1881 struct tty_display_info *tty = FRAME_TTY (f);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1882
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1883 xassert (face != NULL);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1884
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1885 if (tty->TS_exit_attribute_mode)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1886 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1887 /* Capability "me" will turn off appearance modes double-bright,
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1888 half-bright, reverse-video, standout, underline. It may or
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1889 may not turn off alt-char-mode. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1890 if (face->tty_bold_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1891 || face->tty_dim_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1892 || face->tty_reverse_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1893 || face->tty_alt_charset_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1894 || face->tty_blinking_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1895 || face->tty_underline_p)
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
1896 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1897 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1898 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1899 tty->standout_mode = 0;
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
1900 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1901
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1902 if (face->tty_alt_charset_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1903 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1904 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1905 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1906 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1907 /* If we don't have "me" we can only have those appearances
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1908 that have exit sequences defined. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1909 if (face->tty_alt_charset_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1910 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1911
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
1912 if (face->tty_underline_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1913 OUTPUT_IF (tty, tty->TS_exit_underline_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1914 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1915
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1916 /* Switch back to default colors. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1917 if (tty->TN_max_colors > 0
26902
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1918 && ((face->foreground != FACE_TTY_DEFAULT_COLOR
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1919 && face->foreground != FACE_TTY_DEFAULT_FG_COLOR)
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1920 || (face->background != FACE_TTY_DEFAULT_COLOR
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1921 && face->background != FACE_TTY_DEFAULT_BG_COLOR)))
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1922 OUTPUT1_IF (tty, tty->TS_orig_pair);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1923 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1924
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1925
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1926 /* Return non-zero if the terminal on frame F supports all of the
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1927 capabilities in CAPS simultaneously, with foreground and background
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1928 colors FG and BG. */
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1929
45548
612208417377 C style fix.
Miles Bader <miles@gnu.org>
parents: 45522
diff changeset
1930 int
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1931 tty_capable_p (tty, caps, fg, bg)
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1932 struct tty_display_info *tty;
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1933 unsigned caps;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1934 unsigned long fg, bg;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1935 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1936 #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1937 if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit))) \
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1938 return 0;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1939
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1940 TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE, tty->TS_standout_mode, NC_REVERSE);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1941 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1942 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1943 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1944 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1945 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1946
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1947 /* We can do it! */
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1948 return 1;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1949 }
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1950
83041
94b1d2cd8189 Fix list-colors-display and other functions on a termcap frame
Karoly Lorentey <lorentey@elte.hu>
parents: 83032
diff changeset
1951 /* Return the tty display object specified by DISPLAY. DISPLAY may be
94b1d2cd8189 Fix list-colors-display and other functions on a termcap frame
Karoly Lorentey <lorentey@elte.hu>
parents: 83032
diff changeset
1952 a frame, a string, or nil for the display device of the current
94b1d2cd8189 Fix list-colors-display and other functions on a termcap frame
Karoly Lorentey <lorentey@elte.hu>
parents: 83032
diff changeset
1953 frame. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1954
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1955 static struct display *
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1956 get_tty_display (Lisp_Object display)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1957 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1958 struct display *d;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1959
83041
94b1d2cd8189 Fix list-colors-display and other functions on a termcap frame
Karoly Lorentey <lorentey@elte.hu>
parents: 83032
diff changeset
1960 if (NILP (display))
94b1d2cd8189 Fix list-colors-display and other functions on a termcap frame
Karoly Lorentey <lorentey@elte.hu>
parents: 83032
diff changeset
1961 display = selected_frame;
94b1d2cd8189 Fix list-colors-display and other functions on a termcap frame
Karoly Lorentey <lorentey@elte.hu>
parents: 83032
diff changeset
1962
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1963 if (! FRAMEP (display) && ! STRINGP (display))
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1964 return 0;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1965
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1966 /* The initial frame does not support colors. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1967 if (FRAMEP (display) && FRAME_INITIAL_P (XFRAME (display)))
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1968 return 0;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1969
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1970 if (FRAMEP (display))
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1971 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1972 if (! FRAME_TERMCAP_P (XFRAME (display)))
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1973 #if 0 /* XXX We need a predicate as the first argument; find one. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1974 wrong_type_argument ("Not a termcap frame", display);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1975 #else /* Until we fix the wrong_type_argument call above, simply throw
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1976 a dumb error. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1977 error ("DISPLAY is not a termcap frame");
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1978 #endif
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1979
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1980 d = FRAME_DISPLAY (XFRAME (display));
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1981 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1982 else if (STRINGP (display))
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1983 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1984 char *name = (char *) alloca (SBYTES (display) + 1);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1985 strncpy (name, SDATA (display), SBYTES (display));
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1986 name[SBYTES (display)] = 0;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1987
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1988 d = get_named_tty_display (name);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1989
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1990 if (!d)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1991 error ("There is no tty display on %s", name);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1992 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1993
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1994 return d;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1995 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1996
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1997
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1998 /* Return non-zero if the terminal is capable to display colors. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1999
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2000 DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
27087
8de2d17323c2 (Ftty_display_color_p): Accept an optional argument FRAME.
Eli Zaretskii <eliz@gnu.org>
parents: 27085
diff changeset
2001 0, 1, 0,
42959
478fca8e08b4 (Ftty_display_color_cells, Ftty_display_color_p): Change the
Eli Zaretskii <eliz@gnu.org>
parents: 42954
diff changeset
2002 doc: /* Return non-nil if TTY can display colors on DISPLAY. */)
478fca8e08b4 (Ftty_display_color_cells, Ftty_display_color_p): Change the
Eli Zaretskii <eliz@gnu.org>
parents: 42954
diff changeset
2003 (display)
478fca8e08b4 (Ftty_display_color_cells, Ftty_display_color_p): Change the
Eli Zaretskii <eliz@gnu.org>
parents: 42954
diff changeset
2004 Lisp_Object display;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2005 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2006 struct display *d = get_tty_display (display);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2007 if (!d)
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2008 return Qnil;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2009 else
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2010 return d->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2011 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2012
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
2013 /* Return the number of supported colors. */
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
2014 DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
2015 Stty_display_color_cells, 0, 1, 0,
42959
478fca8e08b4 (Ftty_display_color_cells, Ftty_display_color_p): Change the
Eli Zaretskii <eliz@gnu.org>
parents: 42954
diff changeset
2016 doc: /* Return the number of colors supported by TTY on DISPLAY. */)
478fca8e08b4 (Ftty_display_color_cells, Ftty_display_color_p): Change the
Eli Zaretskii <eliz@gnu.org>
parents: 42954
diff changeset
2017 (display)
478fca8e08b4 (Ftty_display_color_cells, Ftty_display_color_p): Change the
Eli Zaretskii <eliz@gnu.org>
parents: 42954
diff changeset
2018 Lisp_Object display;
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
2019 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2020 struct display *d = get_tty_display (display);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2021 if (!d)
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2022 return Qnil;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2023 else
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2024 return make_number (d->display_info.tty->TN_max_colors);
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
2025 }
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
2026
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2027 #ifndef WINDOWSNT
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2028
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2029 /* Save or restore the default color-related capabilities of this
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2030 terminal. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2031 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2032 tty_default_color_capabilities (struct tty_display_info *tty, int save)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2033 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2034 static char
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2035 *default_orig_pair, *default_set_foreground, *default_set_background;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2036 static int default_max_colors, default_max_pairs, default_no_color_video;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2037
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2038 if (save)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2039 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2040 if (default_orig_pair)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2041 xfree (default_orig_pair);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2042 default_orig_pair = tty->TS_orig_pair ? xstrdup (tty->TS_orig_pair) : NULL;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2043
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2044 if (default_set_foreground)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2045 xfree (default_set_foreground);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2046 default_set_foreground = tty->TS_set_foreground ? xstrdup (tty->TS_set_foreground)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2047 : NULL;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2048
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2049 if (default_set_background)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2050 xfree (default_set_background);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2051 default_set_background = tty->TS_set_background ? xstrdup (tty->TS_set_background)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2052 : NULL;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2053
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2054 default_max_colors = tty->TN_max_colors;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2055 default_max_pairs = tty->TN_max_pairs;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2056 default_no_color_video = tty->TN_no_color_video;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2057 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2058 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2059 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2060 tty->TS_orig_pair = default_orig_pair;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2061 tty->TS_set_foreground = default_set_foreground;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2062 tty->TS_set_background = default_set_background;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2063 tty->TN_max_colors = default_max_colors;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2064 tty->TN_max_pairs = default_max_pairs;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2065 tty->TN_no_color_video = default_no_color_video;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2066 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2067 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2068
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2069 /* Setup one of the standard tty color schemes according to MODE.
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2070 MODE's value is generally the number of colors which we want to
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2071 support; zero means set up for the default capabilities, the ones
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2072 we saw at term_init time; -1 means turn off color support. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2073 void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2074 tty_setup_colors (struct tty_display_info *tty, int mode)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2075 {
52652
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2076 /* Canonicalize all negative values of MODE. */
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2077 if (mode < -1)
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2078 mode = -1;
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2079
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2080 switch (mode)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2081 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2082 case -1: /* no colors at all */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2083 tty->TN_max_colors = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2084 tty->TN_max_pairs = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2085 tty->TN_no_color_video = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2086 tty->TS_set_foreground = tty->TS_set_background = tty->TS_orig_pair = NULL;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2087 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2088 case 0: /* default colors, if any */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2089 default:
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2090 tty_default_color_capabilities (tty, 0);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2091 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2092 case 8: /* 8 standard ANSI colors */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2093 tty->TS_orig_pair = "\033[0m";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2094 #ifdef TERMINFO
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2095 tty->TS_set_foreground = "\033[3%p1%dm";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2096 tty->TS_set_background = "\033[4%p1%dm";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2097 #else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2098 tty->TS_set_foreground = "\033[3%dm";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2099 tty->TS_set_background = "\033[4%dm";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2100 #endif
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2101 tty->TN_max_colors = 8;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2102 tty->TN_max_pairs = 64;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2103 tty->TN_no_color_video = 0;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2104 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2105 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2106 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2107
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2108 void
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2109 set_tty_color_mode (f, val)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2110 struct frame *f;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2111 Lisp_Object val;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2112 {
42808
cb0b3b9b61ec (set_tty_color_mode): Remove unused variable `tem'.
Pavel Janík <Pavel@Janik.cz>
parents: 42742
diff changeset
2113 Lisp_Object color_mode_spec, current_mode_spec;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2114 Lisp_Object color_mode, current_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2115 int mode, old_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2116 extern Lisp_Object Qtty_color_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2117 Lisp_Object tty_color_mode_alist;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2118
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2119 tty_color_mode_alist = Fintern_soft (build_string ("tty-color-mode-alist"),
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2120 Qnil);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2121
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
2122 if (INTEGERP (val))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2123 color_mode = val;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2124 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2125 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2126 if (NILP (tty_color_mode_alist))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2127 color_mode_spec = Qnil;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2128 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2129 color_mode_spec = Fassq (val, XSYMBOL (tty_color_mode_alist)->value);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2130
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2131 if (CONSP (color_mode_spec))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2132 color_mode = XCDR (color_mode_spec);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2133 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2134 color_mode = Qnil;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2135 }
52681
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
2136
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
2137 current_mode_spec = assq_no_quit (Qtty_color_mode, f->param_alist);
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
2138
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2139 if (CONSP (current_mode_spec))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2140 current_mode = XCDR (current_mode_spec);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2141 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2142 current_mode = Qnil;
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
2143 if (INTEGERP (color_mode))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2144 mode = XINT (color_mode);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2145 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2146 mode = 0; /* meaning default */
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
2147 if (INTEGERP (current_mode))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2148 old_mode = XINT (current_mode);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2149 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2150 old_mode = 0;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2151
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2152 if (mode != old_mode)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2153 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2154 tty_setup_colors (FRAME_TTY (f), mode);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2155 /* This recomputes all the faces given the new color
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2156 definitions. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2157 call0 (intern ("tty-set-up-initial-frame-faces"));
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2158 redraw_frame (f);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2159 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2160 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2161
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2162 #endif /* !WINDOWSNT */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2163
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2164
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2165
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2166 /* Return the termcap display with the given name. If NAME is null,
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2167 return the display corresponding to our controlling terminal.
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2168
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2169 Returns NULL if the named terminal device is not opened. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2170
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2171 struct display *
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2172 get_named_tty_display (name)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2173 char *name;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2174 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2175 struct display *d;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2176
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2177 for (d = display_list; d; d = d->next_display) {
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2178 if (d->type == output_termcap
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2179 && ((d->display_info.tty->name == 0 && name == 0)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2180 || (name && d->display_info.tty->name
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2181 && !strcmp (d->display_info.tty->name, name))))
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2182 return d;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2183 };
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2184
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2185 return 0;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2186 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2187
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2188
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2189
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2190 DEFUN ("frame-tty-name", Fframe_tty_name, Sframe_tty_name, 0, 1, 0,
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2191 doc: /* Return the name of the TTY device that FRAME is displayed on. */)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2192 (frame)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2193 Lisp_Object frame;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2194 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2195 struct frame *f;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2196
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2197 if (NILP (frame))
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2198 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2199 f = XFRAME (selected_frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2200 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2201 else
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2202 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2203 CHECK_LIVE_FRAME (frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2204 f = XFRAME (frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2205 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2206
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2207 if (f->output_method != output_termcap)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2208 wrong_type_argument (Qframe_tty_name, frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2209
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2210 if (FRAME_TTY (f)->name)
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2211 return build_string (FRAME_TTY (f)->name);
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2212 else
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2213 return Qnil;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2214 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2215
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2216 DEFUN ("frame-tty-type", Fframe_tty_type, Sframe_tty_type, 0, 1, 0,
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2217 doc: /* Return the type of the TTY device that FRAME is displayed on. */)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2218 (frame)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2219 Lisp_Object frame;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2220 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2221 struct frame *f;
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2222
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2223 if (NILP (frame))
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2224 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2225 f = XFRAME (selected_frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2226 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2227 else
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2228 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2229 CHECK_LIVE_FRAME (frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2230 f = XFRAME (frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2231 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2232
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2233 if (f->output_method != output_termcap)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2234 wrong_type_argument (Qframe_tty_type, frame);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2235
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2236 if (FRAME_TTY (f)->type)
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2237 return build_string (FRAME_TTY (f)->type);
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2238 else
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2239 return Qnil;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2240 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2241
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2242
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2243 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2244 Initialization
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2245 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2246
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2247 /* Create the bootstrap display device for the initial frame.
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2248 Returns a display of type output_initial. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2249
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2250 struct display *
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2251 init_initial_display (void)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2252 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2253 if (initialized || display_list || tty_list)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2254 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2255
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2256 initial_display = create_display ();
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2257 initial_display->type = output_initial;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2258
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2259 initial_display->delete_display_hook = &delete_initial_display;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2260 /* All other hooks are NULL. */
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2261
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2262 return initial_display;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2263 }
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2264
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2265 /* Deletes the bootstrap display device.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2266 Called through delete_display_hook. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2267
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
2268 void
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2269 delete_initial_display (struct display *display)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2270 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2271 if (display != initial_display)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2272 abort ();
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2273
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2274 delete_display (display);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2275 initial_display = NULL;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2276 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2277
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2278 /* Drop the controlling terminal if fd is the same device. */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2279 void
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2280 dissociate_if_controlling_tty (int fd)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2281 {
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2282 #if defined (USG) && !defined (BSD_PGRPS)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2283 int pgid;
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2284 EMACS_GET_TTY_PGRP (fd, &pgid);
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2285 if (pgid != -1)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2286 {
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2287 setpgrp ();
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2288 no_controlling_tty = 1;
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2289 }
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2290 #else
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2291 #ifdef TIOCNOTTY /* Try BSD ioctls. */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2292 sigblock (sigmask (SIGTTOU));
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2293 if (ioctl (fd, TIOCNOTTY, 0) != -1)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2294 {
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2295 no_controlling_tty = 1;
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2296 }
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2297 sigunblock (sigmask (SIGTTOU));
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2298 #else
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2299 /* Unknown system. */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2300 croak ();
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2301 #endif /* ! TIOCNOTTY */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2302 #endif /* ! USG */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2303 }
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2304
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2305 /* Create a termcap display on the tty device with the given name and
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2306 type.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2307
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2308 If NAME is NULL, then use the controlling tty, i.e., stdin/stdout.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2309 Otherwise NAME should be a path to the tty device file,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2310 e.g. "/dev/pts/7".
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2311
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2312 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100".
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2313
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2314 If MUST_SUCCEED is true, then all errors are fatal. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2315
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2316 struct display *
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2317 term_init (char *name, char *terminal_type, int must_succeed)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2318 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2319 char *area;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2320 char **address = &area;
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2321 char *buffer = NULL;
52314
529dd59ee898 (term_init): Remove `const' from buffer_size's declaration.
Eli Zaretskii <eliz@gnu.org>
parents: 52294
diff changeset
2322 int buffer_size = 4096;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2323 register char *p;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2324 int status;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2325 struct tty_display_info *tty;
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2326 struct display *display;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2327
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2328 static void maybe_fatal();
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2329
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2330 if (!terminal_type)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2331 maybe_fatal (must_succeed, 0, 0,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2332 "Unknown terminal type",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2333 "Unknown terminal type");
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2334
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2335 display = get_named_tty_display (name);
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2336 if (display)
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2337 {
83074
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2338 /* XXX We would be able to support multiple emacsclients from
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2339 the same terminal if display devices were Lisp objects.
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2340 (Lisp code must know the difference between two separate
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2341 displays on the same terminal device.) -- lorentey */
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2342 if (! display->display_info.tty->input)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2343 error ("%s already has a suspended frame on it, can't open it twice", name);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2344 return display;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2345 }
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2346
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2347 display = create_display ();
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2348 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2349 bzero (tty, sizeof (struct tty_display_info));
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2350 tty->next = tty_list;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2351 tty_list = tty;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2352
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2353 display->type = output_termcap;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2354 display->display_info.tty = tty;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2355 tty->display = display;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2356
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2357 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2358 Wcm_clear (tty);
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2359
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2360 display->rif = 0; /* ttys don't support window-based redisplay. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2361
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2362 display->cursor_to_hook = &tty_cursor_to;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2363 display->raw_cursor_to_hook = &tty_raw_cursor_to;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2364
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2365 display->clear_to_end_hook = &tty_clear_to_end;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2366 display->clear_frame_hook = &tty_clear_frame;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2367 display->clear_end_of_line_hook = &tty_clear_end_of_line;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2368
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2369 display->ins_del_lines_hook = &tty_ins_del_lines;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2370
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2371 display->insert_glyphs_hook = &tty_insert_glyphs;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2372 display->write_glyphs_hook = &tty_write_glyphs;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2373 display->delete_glyphs_hook = &tty_delete_glyphs;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2374
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2375 display->ring_bell_hook = &tty_ring_bell;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2376
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2377 display->reset_terminal_modes_hook = &tty_reset_terminal_modes;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2378 display->set_terminal_modes_hook = &tty_set_terminal_modes;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2379 display->update_begin_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2380 display->update_end_hook = &tty_update_end;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2381 display->set_terminal_window_hook = &tty_set_terminal_window;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2382
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2383 display->mouse_position_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2384 display->frame_rehighlight_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2385 display->frame_raise_lower_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2386
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2387 display->set_vertical_scroll_bar_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2388 display->condemn_scroll_bars_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2389 display->redeem_scroll_bar_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2390 display->judge_scroll_bars_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2391
83011
c4d4cbf86260 Changed tty input code to use read_socket_hook.
Karoly Lorentey <lorentey@elte.hu>
parents: 83008
diff changeset
2392 display->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2393 display->frame_up_to_date_hook = 0; /* Not needed. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2394
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2395 display->delete_frame_hook = &delete_tty_output;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2396 display->delete_display_hook = &delete_tty;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2397
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2398 if (name)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2399 {
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2400 int fd;
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2401 FILE *file;
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2402
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2403 #ifdef O_IGNORE_CTTY
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2404 /* Open the terminal device. Don't recognize it as our
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2405 controlling terminal, and don't make it the controlling tty
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2406 if we don't have one at the moment. */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2407 fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0);
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2408 #else
83074
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2409 /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2410 defined on Hurd. On other systems, we need to dissociate
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2411 ourselves from the controlling tty when we want to open a
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2412 frame on the same terminal. */
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2413
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2414 fd = emacs_open (name, O_RDWR | O_NOCTTY, 0);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2415
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2416 #endif /* O_IGNORE_CTTY */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2417
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2418 if (fd < 0)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2419 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2420 delete_tty (display);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2421 error ("Could not open file: %s", name);
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2422 }
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2423 if (! isatty (fd))
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2424 {
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2425 close (fd);
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2426 error ("Not a tty device: %s", name);
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2427 }
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2428
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2429 dissociate_if_controlling_tty (fd);
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2430
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2431 file = fdopen (fd, "w+");
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2432 tty->name = xstrdup (name);
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2433 tty->input = file;
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2434 tty->output = file;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2435 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2436 else
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2437 {
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2438 if (no_controlling_tty)
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2439 {
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2440 /* Opening a frame on stdout is unsafe if we have
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2441 disconnected our controlling terminal. */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2442 error ("There is no controlling terminal any more");
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2443 }
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2444 tty->name = 0;
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2445 tty->input = stdin;
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2446 tty->output = stdout;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2447 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2448
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2449 tty->type = xstrdup (terminal_type);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2450
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2451 add_keyboard_wait_descriptor (fileno (tty->input));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2452
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2453 #ifdef WINDOWSNT
16885
ddd632f61ce3 (term_init): Use new name initialize_w32_display.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16260
diff changeset
2454 initialize_w32_display ();
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2455
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2456 Wcm_clear (tty);
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2457
24431
00398ed56396 (term_init): Use xmalloc, not malloc.
Karl Heuer <kwzh@gnu.org>
parents: 24263
diff changeset
2458 area = (char *) xmalloc (2044);
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2459
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2460 FrameRows (tty) = FRAME_LINES (f); /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2461 FrameCols (tty) = FRAME_COLS (f); /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2462 tty->specified_window = FRAME_LINES (f); /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2463
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2464 tty->display->delete_in_insert_mode = 1;
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2465
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2466 UseTabs (tty) = 0;
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2467 display->scroll_region_ok = 0;
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2468
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2469 /* Seems to insert lines when it's not supposed to, messing
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2470 up the display. In doing a trace, it didn't seem to be
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2471 called much, so I don't think we're losing anything by
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2472 turning it off. */
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2473 display->line_ins_del_ok = 0;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2474 display->char_ins_del_ok = 1;
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2475
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2476 baud_rate = 19200;
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2477
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2478 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2479 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */
27519
fd4d74bc1e42 (term_init) [WINDOWSNT]: Initialize TN_max_colors.
Jason Rumney <jasonr@gnu.org>
parents: 27128
diff changeset
2480 TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2481
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2482 return display;
21827
87c7f4bd99da Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents: 21624
diff changeset
2483 #else /* not WINDOWSNT */
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2484
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2485 Wcm_clear (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2486
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2487 buffer = (char *) xmalloc (buffer_size);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2488
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2489 /* On some systems, tgetent tries to access the controlling
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2490 terminal. */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2491 sigblock (sigmask (SIGTTOU));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2492 status = tgetent (buffer, terminal_type);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2493 sigunblock (sigmask (SIGTTOU));
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2494
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2495 if (status < 0)
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2496 {
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2497 #ifdef TERMINFO
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2498 maybe_fatal (must_succeed, buffer, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2499 "Cannot open terminfo database file",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2500 "Cannot open terminfo database file");
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2501 #else
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2502 maybe_fatal (must_succeed, buffer, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2503 "Cannot open termcap database file",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2504 "Cannot open termcap database file");
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2505 #endif
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2506 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2507 if (status == 0)
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2508 {
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2509 #ifdef TERMINFO
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2510 maybe_fatal (must_succeed, buffer, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2511 "Terminal type %s is not defined",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2512 "Terminal type %s is not defined.\n\
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2513 If that is not the actual type of terminal you have,\n\
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2514 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2515 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2516 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2517 terminal_type);
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2518 #else
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2519 maybe_fatal (must_succeed, buffer, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2520 "Terminal type %s is not defined",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2521 "Terminal type %s is not defined.\n\
4499
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2522 If that is not the actual type of terminal you have,\n\
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2523 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2524 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2525 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2526 terminal_type);
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2527 #endif
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2528 }
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2529
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
2530 #ifndef TERMINFO
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2531 if (strlen (buffer) >= buffer_size)
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2532 abort ();
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
2533 buffer_size = strlen (buffer);
52293
473d34d4814c (term_init): Fix previous change; don't rely on the
Kenichi Handa <handa@m17n.org>
parents: 52265
diff changeset
2534 #endif
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
2535 area = (char *) xmalloc (buffer_size);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2536
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2537 tty->TS_ins_line = tgetstr ("al", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2538 tty->TS_ins_multi_lines = tgetstr ("AL", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2539 tty->TS_bell = tgetstr ("bl", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2540 BackTab (tty) = tgetstr ("bt", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2541 tty->TS_clr_to_bottom = tgetstr ("cd", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2542 tty->TS_clr_line = tgetstr ("ce", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2543 tty->TS_clr_frame = tgetstr ("cl", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2544 ColPosition (tty) = NULL; /* tgetstr ("ch", address); */
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2545 AbsPosition (tty) = tgetstr ("cm", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2546 CR (tty) = tgetstr ("cr", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2547 tty->TS_set_scroll_region = tgetstr ("cs", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2548 tty->TS_set_scroll_region_1 = tgetstr ("cS", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2549 RowPosition (tty) = tgetstr ("cv", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2550 tty->TS_del_char = tgetstr ("dc", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2551 tty->TS_del_multi_chars = tgetstr ("DC", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2552 tty->TS_del_line = tgetstr ("dl", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2553 tty->TS_del_multi_lines = tgetstr ("DL", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2554 tty->TS_delete_mode = tgetstr ("dm", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2555 tty->TS_end_delete_mode = tgetstr ("ed", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2556 tty->TS_end_insert_mode = tgetstr ("ei", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2557 Home (tty) = tgetstr ("ho", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2558 tty->TS_ins_char = tgetstr ("ic", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2559 tty->TS_ins_multi_chars = tgetstr ("IC", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2560 tty->TS_insert_mode = tgetstr ("im", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2561 tty->TS_pad_inserted_char = tgetstr ("ip", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2562 tty->TS_end_keypad_mode = tgetstr ("ke", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2563 tty->TS_keypad_mode = tgetstr ("ks", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2564 LastLine (tty) = tgetstr ("ll", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2565 Right (tty) = tgetstr ("nd", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2566 Down (tty) = tgetstr ("do", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2567 if (!Down (tty))
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2568 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2569 #ifdef VMS
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2570 /* VMS puts a carriage return before each linefeed,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2571 so it is not safe to use linefeeds. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2572 if (Down (tty) && Down (tty)[0] == '\n' && Down (tty)[1] == '\0')
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2573 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2574 #endif /* VMS */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2575 if (tgetflag ("bs"))
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2576 Left (tty) = "\b"; /* can't possibly be longer! */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2577 else /* (Actually, "bs" is obsolete...) */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2578 Left (tty) = tgetstr ("le", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2579 if (!Left (tty))
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2580 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2581 tty->TS_pad_char = tgetstr ("pc", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2582 tty->TS_repeat = tgetstr ("rp", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2583 tty->TS_end_standout_mode = tgetstr ("se", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2584 tty->TS_fwd_scroll = tgetstr ("sf", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2585 tty->TS_standout_mode = tgetstr ("so", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2586 tty->TS_rev_scroll = tgetstr ("sr", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2587 tty->Wcm->cm_tab = tgetstr ("ta", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2588 tty->TS_end_termcap_modes = tgetstr ("te", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2589 tty->TS_termcap_modes = tgetstr ("ti", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2590 Up (tty) = tgetstr ("up", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2591 tty->TS_visible_bell = tgetstr ("vb", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2592 tty->TS_cursor_normal = tgetstr ("ve", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2593 tty->TS_cursor_visible = tgetstr ("vs", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2594 tty->TS_cursor_invisible = tgetstr ("vi", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2595 tty->TS_set_window = tgetstr ("wi", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2596
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2597 tty->TS_enter_underline_mode = tgetstr ("us", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2598 tty->TS_exit_underline_mode = tgetstr ("ue", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2599 tty->TS_enter_bold_mode = tgetstr ("md", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2600 tty->TS_enter_dim_mode = tgetstr ("mh", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2601 tty->TS_enter_blink_mode = tgetstr ("mb", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2602 tty->TS_enter_reverse_mode = tgetstr ("mr", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2603 tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2604 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2605 tty->TS_exit_attribute_mode = tgetstr ("me", address);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
2606
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2607 MultiUp (tty) = tgetstr ("UP", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2608 MultiDown (tty) = tgetstr ("DO", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2609 MultiLeft (tty) = tgetstr ("LE", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2610 MultiRight (tty) = tgetstr ("RI", address);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2611
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2612 /* SVr4/ANSI color suppert. If "op" isn't available, don't support
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2613 color because we can't switch back to the default foreground and
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2614 background. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2615 tty->TS_orig_pair = tgetstr ("op", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2616 if (tty->TS_orig_pair)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2617 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2618 tty->TS_set_foreground = tgetstr ("AF", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2619 tty->TS_set_background = tgetstr ("AB", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2620 if (!tty->TS_set_foreground)
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2621 {
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2622 /* SVr4. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2623 tty->TS_set_foreground = tgetstr ("Sf", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2624 tty->TS_set_background = tgetstr ("Sb", address);
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2625 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
2626
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2627 tty->TN_max_colors = tgetnum ("Co");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2628 tty->TN_max_pairs = tgetnum ("pa");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2629
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2630 tty->TN_no_color_video = tgetnum ("NC");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2631 if (tty->TN_no_color_video == -1)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2632 tty->TN_no_color_video = 0;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2633 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2634
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2635 tty_default_color_capabilities (tty, 1);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2636
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2637 MagicWrap (tty) = tgetflag ("xn");
11530
a265aaa699e0 (term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
2638 /* Since we make MagicWrap terminals look like AutoWrap, we need to have
a265aaa699e0 (term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
2639 the former flag imply the latter. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2640 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2641 display->memory_below_frame = tgetflag ("db");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2642 tty->TF_hazeltine = tgetflag ("hz");
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2643 display->must_write_spaces = tgetflag ("in");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2644 tty->meta_key = tgetflag ("km") || tgetflag ("MT");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2645 tty->TF_insmode_motion = tgetflag ("mi");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2646 tty->TF_standout_motion = tgetflag ("ms");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2647 tty->TF_underscore = tgetflag ("ul");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2648 tty->TF_teleray = tgetflag ("xt");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2649
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
2650 term_get_fkeys (address);
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
2651
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
2652 /* Get frame size from system, or else from termcap. */
16093
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2653 {
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2654 int height, width;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2655 get_tty_size (fileno (tty->input), &width, &height);
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2656 FrameCols (tty) = width;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2657 FrameRows (tty) = height;
16093
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2658 }
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2659
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2660 if (FrameCols (tty) <= 0)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2661 FrameCols (tty) = tgetnum ("co");
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2662 if (FrameRows (tty) <= 0)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2663 FrameRows (tty) = tgetnum ("li");
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2664
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2665 if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2666 maybe_fatal (must_succeed, NULL, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2667 "Screen size %dx%d is too small"
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2668 "Screen size %dx%d is too small",
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2669 FrameCols (tty), FrameRows (tty));
10332
e14daed4a820 (term_init): Fatal error if screen is too small.
Richard M. Stallman <rms@gnu.org>
parents: 10261
diff changeset
2670
53225
4250e7e26247 Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents: 52681
diff changeset
2671 #if 0 /* This is not used anywhere. */
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2672 tty->display->min_padding_speed = tgetnum ("pb");
53225
4250e7e26247 Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents: 52681
diff changeset
2673 #endif
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2674
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2675 TabWidth (tty) = tgetnum ("tw");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2676
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2677 #ifdef VMS
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2678 /* These capabilities commonly use ^J.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2679 I don't know why, but sending them on VMS does not work;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2680 it causes following spaces to be lost, sometimes.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2681 For now, the simplest fix is to avoid using these capabilities ever. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2682 if (Down (tty) && Down (tty)[0] == '\n')
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2683 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2684 #endif /* VMS */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2685
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2686 if (!tty->TS_bell)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2687 tty->TS_bell = "\07";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2688
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2689 if (!tty->TS_fwd_scroll)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2690 tty->TS_fwd_scroll = Down (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2691
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2692 PC = tty->TS_pad_char ? *tty->TS_pad_char : 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2693
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2694 if (TabWidth (tty) < 0)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2695 TabWidth (tty) = 8;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
2696
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2697 /* Turned off since /etc/termcap seems to have :ta= for most terminals
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2698 and newer termcap doc does not seem to say there is a default.
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2699 if (!tty->Wcm->cm_tab)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2700 tty->Wcm->cm_tab = "\t";
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2701 */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2702
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2703 /* We don't support standout modes that use `magic cookies', so
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2704 turn off any that do. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2705 if (tty->TS_standout_mode && tgetnum ("sg") >= 0)
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2706 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2707 tty->TS_standout_mode = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2708 tty->TS_end_standout_mode = 0;
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2709 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2710 if (tty->TS_enter_underline_mode && tgetnum ("ug") >= 0)
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2711 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2712 tty->TS_enter_underline_mode = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2713 tty->TS_exit_underline_mode = 0;
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2714 }
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2715
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2716 /* If there's no standout mode, try to use underlining instead. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2717 if (tty->TS_standout_mode == 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2718 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2719 tty->TS_standout_mode = tty->TS_enter_underline_mode;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2720 tty->TS_end_standout_mode = tty->TS_exit_underline_mode;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2721 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2722
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2723 /* If no `se' string, try using a `me' string instead.
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2724 If that fails, we can't use standout mode at all. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2725 if (tty->TS_end_standout_mode == 0)
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2726 {
8612
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
2727 char *s = tgetstr ("me", address);
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2728 if (s != 0)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2729 tty->TS_end_standout_mode = s;
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2730 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2731 tty->TS_standout_mode = 0;
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2732 }
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2733
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2734 if (tty->TF_teleray)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2735 {
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2736 tty->Wcm->cm_tab = 0;
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2737 /* We can't support standout mode, because it uses magic cookies. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2738 tty->TS_standout_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2739 /* But that means we cannot rely on ^M to go to column zero! */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2740 CR (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2741 /* LF can't be trusted either -- can alter hpos */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2742 /* if move at column 0 thru a line with TS_standout_mode */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2743 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2744 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2745
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2746 /* Special handling for certain terminal types known to need it */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2747
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2748 if (!strcmp (terminal_type, "supdup"))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2749 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2750 display->memory_below_frame = 1;
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2751 tty->Wcm->cm_losewrap = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2752 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2753 if (!strncmp (terminal_type, "c10", 3)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2754 || !strcmp (terminal_type, "perq"))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2755 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2756 /* Supply a makeshift :wi string.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2757 This string is not valid in general since it works only
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2758 for windows starting at the upper left corner;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2759 but that is all Emacs uses.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2760
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
2761 This string works only if the frame is using
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2762 the top of the video memory, because addressing is memory-relative.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2763 So first check the :ti string to see if that is true.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2764
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2765 It would be simpler if the :wi string could go in the termcap
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2766 entry, but it can't because it is not fully valid.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2767 If it were in the termcap entry, it would confuse other programs. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2768 if (!tty->TS_set_window)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2769 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2770 p = tty->TS_termcap_modes;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2771 while (*p && strcmp (p, "\033v "))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2772 p++;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2773 if (*p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2774 tty->TS_set_window = "\033v%C %C %C %C ";
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2775 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2776 /* Termcap entry often fails to have :in: flag */
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2777 display->must_write_spaces = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2778 /* :ti string typically fails to have \E^G! in it */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2779 /* This limits scope of insert-char to one line. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2780 strcpy (area, tty->TS_termcap_modes);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2781 strcat (area, "\033\007!");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2782 tty->TS_termcap_modes = area;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2783 area += strlen (area) + 1;
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2784 p = AbsPosition (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2785 /* Change all %+ parameters to %C, to handle
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2786 values above 96 correctly for the C100. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2787 while (*p)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2788 {
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2789 if (p[0] == '%' && p[1] == '+')
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2790 p[1] = 'C';
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2791 p++;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2792 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2793 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2794
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2795 tty->specified_window = FrameRows (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2796
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2797 if (Wcm_init (tty) == -1) /* can't do cursor motion */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2798 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2799 maybe_fatal (must_succeed, NULL, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2800 "Terminal type \"%s\" is not powerful enough to run Emacs",
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2801 #ifdef VMS
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2802 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2803 It lacks the ability to position the cursor.\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2804 If that is not the actual type of terminal you have, use either the\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2805 DCL command `SET TERMINAL/DEVICE= ...' for DEC-compatible terminals,\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2806 or `define EMACS_TERM \"terminal type\"' for non-DEC terminals.",
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2807 #else /* not VMS */
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2808 # ifdef TERMINFO
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2809 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2810 It lacks the ability to position the cursor.\n\
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2811 If that is not the actual type of terminal you have,\n\
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2812 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2813 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2814 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2815 # else /* TERMCAP */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2816 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2817 It lacks the ability to position the cursor.\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2818 If that is not the actual type of terminal you have,\n\
4499
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2819 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2820 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2821 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2822 # endif /* TERMINFO */
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2823 #endif /*VMS */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2824 terminal_type);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2825 }
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2826
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2827 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2828 maybe_fatal (must_succeed, NULL, display,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2829 "Could not determine the frame size",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2830 "Could not determine the frame size");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2831
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2832 tty->delete_in_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2833 = tty->TS_delete_mode && tty->TS_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2834 && !strcmp (tty->TS_delete_mode, tty->TS_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2835
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2836 tty->se_is_so = (tty->TS_standout_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2837 && tty->TS_end_standout_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2838 && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2839
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2840 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2841
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2842 display->scroll_region_ok
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2843 = (tty->Wcm->cm_abs
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2844 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2845
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2846 display->line_ins_del_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2847 = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2848 && (tty->TS_del_line || tty->TS_del_multi_lines))
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2849 || (display->scroll_region_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2850 && tty->TS_fwd_scroll && tty->TS_rev_scroll));
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2851
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2852 display->char_ins_del_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2853 = ((tty->TS_ins_char || tty->TS_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2854 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2855 && (tty->TS_del_char || tty->TS_del_multi_chars));
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2856
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2857 display->fast_clear_end_of_line = tty->TS_clr_line != 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2858
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2859 init_baud_rate (fileno (tty->input));
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2860
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2861 #ifdef AIXHFT
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2862 /* The HFT system on AIX doesn't optimize for scrolling, so it's
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2863 really ugly at times. */
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2864 display->line_ins_del_ok = 0;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2865 display->char_ins_del_ok = 0;
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2866 #endif
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2867
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2868 #ifdef MULTI_KBOARD
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2869 tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2870 init_kboard (tty->kboard);
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2871 tty->kboard->next_kboard = all_kboards;
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2872 all_kboards = tty->kboard;
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2873 /* Don't let the initial kboard remain current longer than necessary.
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2874 That would cause problems if a file loaded on startup tries to
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2875 prompt in the mini-buffer. */
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2876 if (current_kboard == initial_kboard)
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2877 current_kboard = tty->kboard;
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2878 tty->kboard->reference_count++;
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2879 #endif
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2880
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2881 /* Don't do this. I think termcap may still need the buffer. */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2882 /* xfree (buffer); */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2883
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2884 /* Init system terminal modes (RAW or CBREAK, etc.). */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2885 init_sys_modes (tty);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2886
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2887 return display;
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2888 #endif /* not WINDOWSNT */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2889 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2890
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2891 /* Auxiliary error-handling function for term_init.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2892 Free BUFFER and delete DISPLAY, then call error or fatal
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2893 with str1 or str2, respectively, according to MUST_SUCCEED. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2894
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2895 static void
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2896 maybe_fatal (must_succeed, buffer, display, str1, str2, arg1, arg2)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2897 int must_succeed;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2898 char *buffer;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2899 struct display *display;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2900 char *str1, *str2, *arg1, *arg2;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2901 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2902 if (buffer)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2903 xfree (buffer);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2904
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2905 if (display)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2906 delete_tty (display);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2907
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2908 if (must_succeed)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2909 fatal (str2, arg1, arg2);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2910 else
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2911 error (str1, arg1, arg2);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2912
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2913 abort ();
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2914 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2915
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2916 /* VARARGS 1 */
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
2917 void
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2918 fatal (str, arg1, arg2)
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 533
diff changeset
2919 char *str, *arg1, *arg2;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2920 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2921 fprintf (stderr, "emacs: ");
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2922 fprintf (stderr, str, arg1, arg2);
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2923 fprintf (stderr, "\n");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2924 fflush (stderr);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2925 exit (1);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2926 }
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
2927
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2928
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2929
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2930 DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0,
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2931 doc: /* Delete all frames on the terminal named TTY, and close the device.
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2932 If omitted, TTY defaults to the controlling terminal.
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2933
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2934 This function runs `delete-tty-after-functions' after closing the
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2935 tty. The functions are run with one arg, the frame to be deleted. */)
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2936 (tty)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2937 Lisp_Object tty;
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
2938 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2939 struct display *d;
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2940 char *name = 0;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2941
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2942 CHECK_STRING (tty);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2943
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2944 if (SBYTES (tty) > 0)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2945 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2946 name = (char *) alloca (SBYTES (tty) + 1);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2947 strncpy (name, SDATA (tty), SBYTES (tty));
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2948 name[SBYTES (tty)] = 0;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2949 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2950
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2951 d = get_named_tty_display (name);
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2952
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2953 if (! d)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2954 error ("No such terminal device: %s", name);
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2955
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2956 delete_tty (d);
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2957
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2958 return Qnil;
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
2959 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2960
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2961 static int deleting_tty = 0;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2962
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2963
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2964 /* Delete the given terminal device, closing all frames on it. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2965
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2966 void
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2967 delete_tty (struct display *display)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2968 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2969 struct tty_display_info *tty;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2970 Lisp_Object tail, frame;
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2971 char *tty_name;
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2972 int last_display;
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2973
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2974 if (deleting_tty)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2975 /* We get a recursive call when we delete the last frame on this
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2976 display. */
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2977 return;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2978
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2979 if (display->type != output_termcap)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2980 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2981
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2982 tty = display->display_info.tty;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2983
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2984 last_display = 1;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2985 FOR_EACH_FRAME (tail, frame)
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2986 {
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2987 struct frame *f = XFRAME (frame);
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2988 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty))
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2989 {
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2990 last_display = 0;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2991 break;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2992 }
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2993 }
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2994 if (last_display)
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2995 error ("Attempt to delete the sole display with live frames");
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2996
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2997 if (tty == tty_list)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2998 tty_list = tty->next;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2999 else
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3000 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3001 struct tty_display_info *p;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3002 for (p = tty_list; p && p->next != tty; p = p->next)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3003 ;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3004
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3005 if (! p)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3006 /* This should not happen. */
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3007 abort ();
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3008
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3009 p->next = tty->next;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3010 tty->next = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3011 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3012
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3013 deleting_tty = 1;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3014
53340
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3015 FOR_EACH_FRAME (tail, frame)
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3016 {
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3017 struct frame *f = XFRAME (frame);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3018 if (FRAME_TERMCAP_P (f) && FRAME_LIVE_P (f) && FRAME_TTY (f) == tty)
53340
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3019 {
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3020 Fdelete_frame (frame, Qt);
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3021 }
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
3022 }
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3023
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3024 /* reset_sys_modes needs a valid display, so this call needs to be
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3025 before delete_display. */
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3026 reset_sys_modes (tty);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3027
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3028 delete_display (display);
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3029
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3030 tty_name = tty->name;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3031 if (tty->type)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3032 xfree (tty->type);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3033
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3034 if (tty->input)
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3035 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3036 delete_keyboard_wait_descriptor (fileno (tty->input));
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3037 if (tty->input != stdin)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3038 fclose (tty->input);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3039 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3040 if (tty->output && tty->output != stdout && tty->output != tty->input)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3041 fclose (tty->output);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3042 if (tty->termscript)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3043 fclose (tty->termscript);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3044
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3045 if (tty->old_tty)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3046 xfree (tty->old_tty);
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3047
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3048 if (tty->Wcm)
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3049 xfree (tty->Wcm);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3050
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3051 #ifdef MULTI_KBOARD
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3052 if (tty->kboard && --tty->kboard->reference_count > 0)
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3053 abort ();
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3054 if (tty->kboard)
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3055 delete_kboard (tty->kboard);
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3056 #endif
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3057
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3058 bzero (tty, sizeof (struct tty_display_info));
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3059 xfree (tty);
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3060 deleting_tty = 0;
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3061
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3062 /* Run `delete-tty-after-functions'. */
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3063 if (!NILP (Vrun_hooks))
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3064 {
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3065 Lisp_Object args[2];
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3066 args[0] = intern ("delete-tty-after-functions");
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3067 if (tty_name)
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3068 {
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3069 args[1] = build_string (tty_name);
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3070 xfree (tty_name);
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3071 }
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3072 else
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3073 args[1] = Qnil;
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3074 Frun_hook_with_args (2, args);
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3075 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3076 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3077
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3078
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3079
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3080 /* Initialize the tty-dependent part of frame F. The frame must
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3081 already have its display initialized. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3082
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3083 void
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3084 create_tty_output (struct frame *f)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3085 {
83018
1465425fe2d3 Romain Francoise's and Ami Fischman's bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83012
diff changeset
3086 struct tty_output *t;
1465425fe2d3 Romain Francoise's and Ami Fischman's bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83012
diff changeset
3087
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3088 if (! FRAME_TERMCAP_P (f))
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3089 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3090
83018
1465425fe2d3 Romain Francoise's and Ami Fischman's bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83012
diff changeset
3091 t = xmalloc (sizeof (struct tty_output));
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3092 bzero (t, sizeof (struct tty_output));
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3093
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3094 t->display_info = FRAME_DISPLAY (f)->display_info.tty;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3095
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3096 f->output_data.tty = t;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3097 }
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3098
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3099 /* Delete the tty-dependent part of frame F. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3100
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3101 void
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3102 delete_tty_output (struct frame *f)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3103 {
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3104 if (! FRAME_TERMCAP_P (f))
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3105 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3106
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3107 xfree (f->output_data.tty);
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3108 }
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3109
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3110
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3111
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3112
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3113 /* Mark the pointers in the tty_display_info objects.
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3114 Called by the Fgarbage_collector. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3115
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3116 void
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3117 mark_ttys ()
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3118 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3119 struct tty_display_info *tty;
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
3120
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3121 for (tty = tty_list; tty; tty = tty->next)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3122 {
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3123 if (tty->top_frame)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3124 mark_object (tty->top_frame);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3125 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3126 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3127
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3128
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3129
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3130 /* Create a new display object and add it to the display list. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3131
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3132 struct display *
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3133 create_display (void)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3134 {
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3135 struct display *dev = (struct display *) xmalloc (sizeof (struct display));
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3136
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3137 bzero (dev, sizeof (struct display));
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3138 dev->next_display = display_list;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3139 display_list = dev;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3140
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3141 return dev;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3142 }
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3143
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3144 /* Remove a display from the display list and free its memory. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3145
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3146 void
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3147 delete_display (struct display *dev)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3148 {
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3149 struct display **dp;
83021
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3150 Lisp_Object tail, frame;
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3151
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3152 /* Check for and close live frames that are still on this
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3153 display. */
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3154 FOR_EACH_FRAME (tail, frame)
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3155 {
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3156 struct frame *f = XFRAME (frame);
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3157 if (FRAME_LIVE_P (f) && f->display == dev)
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3158 {
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3159 Fdelete_frame (frame, Qt);
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3160 }
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3161 }
32bf8e7cc0c2 Fixed tty faces during combo sessions. Plus other assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
3162
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3163 for (dp = &display_list; *dp != dev; dp = &(*dp)->next_display)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3164 if (! *dp)
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3165 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3166 *dp = dev->next_display;
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3167
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3168 bzero (dev, sizeof (struct display));
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3169 xfree (dev);
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3170 }
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3171
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3172
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3173
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3174 DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3175 doc: /* Suspend the terminal device TTY.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3176 The terminal is restored to its default state, and Emacs closes all
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3177 access to the terminal device. Frames that use the device are not
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3178 deleted, but input is not read from them and if they change, their
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3179 display is not updated.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3180
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3181 TTY may a string (a device name), a frame, or nil for the display
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3182 device of the currently selected frame.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3183
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3184 This function runs `suspend-tty-functions' after suspending the
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3185 device. The functions are run with one arg, the name of the terminal
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3186 device.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3187
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3188 `suspend-tty' does nothing if it is called on an already suspended
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3189 device.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3190
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3191 A suspended terminal device may be resumed by calling `resume-tty' on
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3192 it. */)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3193 (tty)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3194 Lisp_Object tty;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3195 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3196 struct display *d = get_tty_display (tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3197 FILE *f;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3198
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3199 if (!d)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3200 error ("Unknown tty device");
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3201
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3202 f = d->display_info.tty->input;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3203
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3204 if (f)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3205 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3206 reset_sys_modes (d->display_info.tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3207
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3208 delete_keyboard_wait_descriptor (fileno (f));
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3209
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3210 fclose (f);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3211 if (f != d->display_info.tty->output)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3212 fclose (d->display_info.tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3213
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3214 d->display_info.tty->input = 0;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3215 d->display_info.tty->output = 0;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3216
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3217 if (FRAMEP (d->display_info.tty->top_frame))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3218 FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 0);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3219
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3220 /* Run `suspend-tty-functions'. */
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3221 if (!NILP (Vrun_hooks))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3222 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3223 Lisp_Object args[2];
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3224 args[0] = intern ("suspend-tty-functions");
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3225 if (d->display_info.tty->name)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3226 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3227 args[1] = build_string (d->display_info.tty->name);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3228 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3229 else
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3230 args[1] = Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3231 Frun_hook_with_args (2, args);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3232 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3233 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3234
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3235 return Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3236 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3237
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3238
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3239 DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3240 doc: /* Resume the previously suspended terminal device TTY.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3241 The terminal is opened and reinitialized. Frames that used the
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3242 suspended device are revived.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3243
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3244 This function runs `resume-tty-functions' after resuming the device.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3245 The functions are run with one arg, the name of the terminal device.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3246
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3247 `resume-tty' does nothing if it is called on a device that is not
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3248 suspended.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3249
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3250 TTY may a string (a device name), a frame, or nil for the display
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3251 device of the currently selected frame. */)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3252 (tty)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3253 Lisp_Object tty;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3254 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3255 struct display *d = get_tty_display (tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3256 int fd;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3257
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3258 if (!d)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3259 error ("Unknown tty device");
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3260
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3261 if (!d->display_info.tty->input)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3262 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3263 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3264
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3265 /* XXX What if open fails? */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3266
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3267 dissociate_if_controlling_tty (fd);
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3268
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3269 d->display_info.tty->output = fdopen (fd, "w+");
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3270 d->display_info.tty->input = d->display_info.tty->output;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3271
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3272 add_keyboard_wait_descriptor (fd);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3273
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3274 if (FRAMEP (d->display_info.tty->top_frame))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3275 FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 1);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3276
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3277 init_sys_modes (d->display_info.tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3278
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3279 /* Run `suspend-tty-functions'. */
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3280 if (!NILP (Vrun_hooks))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3281 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3282 Lisp_Object args[2];
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3283 args[0] = intern ("resume-tty-functions");
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3284 if (d->display_info.tty->name)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3285 {
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3286 args[1] = build_string (d->display_info.tty->name);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3287 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3288 else
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3289 args[1] = Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3290 Frun_hook_with_args (2, args);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3291 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3292 }
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3293
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3294 return Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3295 }
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3296
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3297
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
3298 void
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3299 syms_of_term ()
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3300 {
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3301 DEFVAR_BOOL ("system-uses-terminfo", &system_uses_terminfo,
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3302 doc: /* Non-nil means the system uses terminfo rather than termcap.
39914
91951fb5b9e5 Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents: 39697
diff changeset
3303 This variable can be used by terminal emulator packages. */);
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3304 #ifdef TERMINFO
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3305 system_uses_terminfo = 1;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3306 #else
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3307 system_uses_terminfo = 0;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3308 #endif
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
3309
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3310 DEFVAR_LISP ("ring-bell-function", &Vring_bell_function,
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3311 doc: /* Non-nil means call this function to ring the bell.
39914
91951fb5b9e5 Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents: 39697
diff changeset
3312 The function should accept no arguments. */);
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
3313 Vring_bell_function = Qnil;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3314
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3315 DEFVAR_LISP ("delete-tty-after-functions", &Vdelete_tty_after_functions,
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3316 doc: /* Functions to be run after deleting a tty.
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3317 The functions are run with one argument, the name of the tty to be deleted.
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3318 See `delete-tty'. */);
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3319 Vdelete_tty_after_functions = Qnil;
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3320
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3321
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3322 DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3323 doc: /* Functions to be run after suspending a tty.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3324 The functions are run with one argument, the name of the tty to be suspended.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3325 See `suspend-tty'. */);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3326 Vsuspend_tty_functions = Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3327
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3328
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3329 DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions,
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3330 doc: /* Functions to be run after resuming a tty.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3331 The functions are run with one argument, the name of the tty that was revived.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3332 See `resume-tty'. */);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3333 Vresume_tty_functions = Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3334
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3335 Qframe_tty_name = intern ("frame-tty-name");
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3336 staticpro (&Qframe_tty_name);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3337
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3338 Qframe_tty_type = intern ("frame-tty-type");
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3339 staticpro (&Qframe_tty_type);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3340
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3341 defsubr (&Stty_display_color_p);
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
3342 defsubr (&Stty_display_color_cells);
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3343 defsubr (&Sframe_tty_name);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3344 defsubr (&Sframe_tty_type);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3345 defsubr (&Sdelete_tty);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3346 defsubr (&Ssuspend_tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3347 defsubr (&Sresume_tty);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3348
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3349 Fprovide (intern ("multi-tty"), Qnil);
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3350
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3351 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3352
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3353
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3354
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52314
diff changeset
3355 /* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52314
diff changeset
3356 (do not change this comment) */