annotate src/term.c @ 84849:ba20cee1aec0

(init_tty): Call init_sys_modes on WINDOWSNT also.
author Jason Rumney <jasonr@gnu.org>
date Tue, 25 Sep 2007 08:53:23 +0000
parents 67e430e38471
children dfbee4931a6a
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
64770
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1998, 2000, 2001,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 73864
diff changeset
3 2002, 2003, 2004, 2005, 2006, 2007 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
78260
922696f363b0 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 76627
diff changeset
9 the Free Software Foundation; either version 3, 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
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63880
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63880
diff changeset
20 Boston, MA 02110-1301, 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>
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
28 #include <errno.h>
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
29 #include <sys/file.h>
83644
0ece58f6e0aa Merge from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83635 81817
diff changeset
30
81817
e6ed0991129c Include unistd.h only if HAVE_UNISTD_H.
Richard M. Stallman <rms@gnu.org>
parents: 81811
diff changeset
31 #ifdef HAVE_UNISTD_H
81811
c10410a3aa36 Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81308
diff changeset
32 #include <unistd.h>
81817
e6ed0991129c Include unistd.h only if HAVE_UNISTD_H.
Richard M. Stallman <rms@gnu.org>
parents: 81811
diff changeset
33 #endif
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
34
83095
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
35 #if HAVE_TERMIOS_H
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
36 #include <termios.h> /* For TIOCNOTTY. */
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
37 #endif
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
38
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
39 #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
40
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
41 #include "lisp.h"
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 #include "termchar.h"
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 #include "termopts.h"
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
44 #include "charset.h"
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
45 #include "coding.h"
31102
6a0caa788013 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 30848
diff changeset
46 #include "keyboard.h"
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
47 #include "frame.h"
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 #include "disptab.h"
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 #include "termhooks.h"
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
50 #include "dispextern.h"
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
51 #include "window.h"
39697
0b986bb45526 Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39682
diff changeset
52 #include "keymap.h"
76627
c53e7d075f1a Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 75348
diff changeset
53 #include "blockinput.h"
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
54 #include "syssignal.h"
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
55 #include "systty.h"
81308
16181a4d64bf Include intervals.h to declare Fget_text_property.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81127
diff changeset
56 #include "intervals.h"
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
57
33672
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
58 /* 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
59 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
60 won't find. */
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
61
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
62 #if defined HAVE_TERMCAP_H && 0
25727
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
63 #include <termcap.h>
29929
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
64 #else
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
65 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
66 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
67 extern int tgetflag P_ ((char *id));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
68 extern int tgetnum P_ ((char *id));
25727
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
69 #endif
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
70
21827
87c7f4bd99da Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents: 21624
diff changeset
71 #include "cm.h"
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
72 #ifdef HAVE_X_WINDOWS
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
73 #include "xterm.h"
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
74 #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
75 #ifdef MAC_OS
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31829
diff changeset
76 #include "macterm.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31829
diff changeset
77 #endif
8898
07bca49c7f84 Declare Fmake_sparse_keymap.
Karl Heuer <kwzh@gnu.org>
parents: 8806
diff changeset
78
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
79 #ifndef O_RDWR
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
80 #define O_RDWR 2
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
81 #endif
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
82
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
83 #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
84 #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
85 #endif
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
86
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
87 /* The name of the default console device. */
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
88 #ifdef WINDOWSNT
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
89 #define DEV_TTY "CONOUT$"
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
90 #else
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
91 #define DEV_TTY "/dev/tty"
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
92 #endif
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
93
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
94 static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
95 static void turn_on_face P_ ((struct frame *, int face_id));
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
96 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
97 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
98 static void tty_hide_cursor P_ ((struct tty_display_info *));
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
99 static void tty_background_highlight P_ ((struct tty_display_info *tty));
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
100 static void clear_tty_hooks P_ ((struct terminal *terminal));
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
101 static void set_tty_hooks P_ ((struct terminal *terminal));
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
102 static void dissociate_if_controlling_tty P_ ((int fd));
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
103 static void delete_tty P_ ((struct terminal *));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
104
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
105 #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
106 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
107 (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
108 - curY (tty)), \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
109 cmputc)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
110
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
111 #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
112 #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
113
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
114 #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
115 do { \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
116 if (a) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
117 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
118 (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
119 - curY (tty) ), \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
120 cmputc); \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
121 } while (0)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
122
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
123 #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
124
67935
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
125 /* If true, use "vs", otherwise use "ve" to make the cursor visible. */
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
126
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
127 static int visible_cursor;
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
128
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
129 /* Display space properties */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
130
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
131 extern Lisp_Object Qspace, QCalign_to, QCwidth;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
132
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
133 /* Functions to call after suspending a tty. */
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
134 Lisp_Object Vsuspend_tty_functions;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
135
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
136 /* Functions to call after resuming a tty. */
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
137 Lisp_Object Vresume_tty_functions;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
138
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
139 /* 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
140 struct tty_display_info *tty_list;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
142 /* 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
143 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
144 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
145 else. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 int no_redraw_on_reenter;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147
28465
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;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
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 ();
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
185
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
186 static void term_clear_mouse_face ();
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
187 static void term_mouse_highlight (struct frame *f, int x, int y);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
189
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
190 #ifdef HAVE_GPM
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
191 #include <sys/fcntl.h>
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
192 #include "buffer.h"
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
193
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
194 /* The device for which we have enabled gpm support (or NULL). */
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
195 struct tty_display_info *gpm_tty = NULL;
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
196
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
197 /* These variables describe the range of text currently shown in its
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
198 mouse-face, together with the window they apply to. As long as
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
199 the mouse stays within this range, we need not redraw anything on
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
200 its account. Rows and columns are glyph matrix positions in
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
201 MOUSE_FACE_WINDOW. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
202 static int mouse_face_beg_row, mouse_face_beg_col;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
203 static int mouse_face_end_row, mouse_face_end_col;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
204 static int mouse_face_past_end;
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
205 static Lisp_Object Qmouse_face_window;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
206 static int mouse_face_face_id;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
207
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
208 static int pos_x, pos_y;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
209 static int last_mouse_x, last_mouse_y;
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
210 #endif /* HAVE_GPM */
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
211
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
212 /* 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
213
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
214 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
215 tty_ring_bell (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
217 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
218
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
219 if (tty->output)
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
220 {
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
221 OUTPUT (tty, (tty->TS_visible_bell && visible_bell
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
222 ? tty->TS_visible_bell
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
223 : tty->TS_bell));
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
224 fflush (tty->output);
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
225 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
228 /* 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
229
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
230 void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
231 tty_set_terminal_modes (struct terminal *terminal)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
233 struct tty_display_info *tty = terminal->display_info.tty;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
234
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
235 if (tty->output)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 {
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
237 if (tty->TS_termcap_modes)
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
238 OUTPUT (tty, tty->TS_termcap_modes);
64773
aebbf7125281 (set_terminal_modes): If no TS_termcap_modes string,
Richard M. Stallman <rms@gnu.org>
parents: 64770
diff changeset
239 else
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
240 {
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
241 /* Output enough newlines to scroll all the old screen contents
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
242 off the screen, so it won't be overwritten and lost. */
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
243 int i;
83382
7a3090aca393 Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83370
diff changeset
244 current_tty = tty;
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
245 for (i = 0; i < FRAME_LINES (XFRAME (selected_frame)); i++)
83382
7a3090aca393 Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83370
diff changeset
246 cmputc ('\n');
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
247 }
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
248
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
249 OUTPUT_IF (tty, tty->TS_termcap_modes);
83450
c69d44922688 Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
parents: 83431 67935
diff changeset
250 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
251 OUTPUT_IF (tty, tty->TS_keypad_mode);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
252 losecursor (tty);
83330
233c9974025b Fix the original cause of the "arrow keys don't work on screen" bug.
Karoly Lorentey <lorentey@elte.hu>
parents: 83323
diff changeset
253 fflush (tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
257 /* 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
258
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
259 void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
260 tty_reset_terminal_modes (struct terminal *terminal)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
262 struct tty_display_info *tty = terminal->display_info.tty;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
263
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
264 if (tty->output)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
266 tty_turn_off_highlight (tty);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
267 tty_turn_off_insert (tty);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
268 OUTPUT_IF (tty, tty->TS_end_keypad_mode);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
269 OUTPUT_IF (tty, tty->TS_cursor_normal);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
270 OUTPUT_IF (tty, tty->TS_end_termcap_modes);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
271 OUTPUT_IF (tty, tty->TS_orig_pair);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
272 /* 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
273 current_tty = tty;
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
274 cmputc ('\r');
83330
233c9974025b Fix the original cause of the "arrow keys don't work on screen" bug.
Karoly Lorentey <lorentey@elte.hu>
parents: 83323
diff changeset
275 fflush (tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
279 /* Flag the end of a display update on a termcap terminal. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
280
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
281 static void
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
282 tty_update_end (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
284 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
285
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
286 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
287 tty_show_cursor (tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
288 tty_turn_off_insert (tty);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
289 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
292 /* 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
293
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
294 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
295 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
296 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
297 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
298
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
299 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
300 if (FRAME_SCROLL_REGION_OK (f))
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
301 tty_set_scroll_region (f, 0, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
304 static void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
305 tty_set_scroll_region (struct frame *f, int start, int stop)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 char *buf;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
308 struct tty_display_info *tty = FRAME_TTY (f);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
309
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
310 if (tty->TS_set_scroll_region)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
311 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
312 else if (tty->TS_set_scroll_region_1)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
313 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
314 FRAME_LINES (f), start,
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
315 FRAME_LINES (f) - stop,
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
316 FRAME_LINES (f));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
318 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
319
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
320 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
321 xfree (buf);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
322 losecursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 }
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
324
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
326 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
327 tty_turn_on_insert (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
329 if (!tty->insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
330 OUTPUT (tty, tty->TS_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
331 tty->insert_mode = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
334 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
335 tty_turn_off_insert (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
337 if (tty->insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
338 OUTPUT (tty, tty->TS_end_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
339 tty->insert_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
342 /* Handle highlighting. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
344 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
345 tty_turn_off_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
347 if (tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
348 OUTPUT_IF (tty, tty->TS_end_standout_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
349 tty->standout_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
352 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
353 tty_turn_on_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
355 if (!tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
356 OUTPUT_IF (tty, tty->TS_standout_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
357 tty->standout_mode = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
360 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
361 tty_toggle_highlight (struct tty_display_info *tty)
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
362 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
363 if (tty->standout_mode)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
364 tty_turn_off_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
365 else
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
366 tty_turn_on_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
367 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
368
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
369
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
370 /* Make cursor invisible. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
371
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
372 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
373 tty_hide_cursor (struct tty_display_info *tty)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
374 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
375 if (tty->cursor_hidden == 0)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
376 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
377 tty->cursor_hidden = 1;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
378 OUTPUT_IF (tty, tty->TS_cursor_invisible);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
379 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
380 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
381
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
382
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
383 /* Ensure that cursor is visible. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
384
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
385 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
386 tty_show_cursor (struct tty_display_info *tty)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
387 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
388 if (tty->cursor_hidden)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
389 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
390 tty->cursor_hidden = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
391 OUTPUT_IF (tty, tty->TS_cursor_normal);
67935
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
392 if (visible_cursor)
83450
c69d44922688 Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
parents: 83431 67935
diff changeset
393 OUTPUT_IF (tty, tty->TS_cursor_visible);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
394 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
395 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
396
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
397
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 /* Set standout mode to the state it should be in for
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 empty space inside windows. What this is,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 depends on the user option inverse-video. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
402 static void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
403 tty_background_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 if (inverse_video)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
406 tty_turn_on_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407 else
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
408 tty_turn_off_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 /* Set standout mode to the mode specified for the text to be output. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
413 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
414 tty_highlight_if_desired (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 {
40081
07d7dbf18784 (reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents: 39988
diff changeset
416 if (inverse_video)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
417 tty_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
418 else
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
419 tty_turn_off_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
423 /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
424 frame-relative coordinates. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
426 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
427 tty_cursor_to (struct frame *f, int vpos, int hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
429 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
431 /* 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
432 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
433 if (! tty->costs_set)
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
434 return;
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
435
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
436 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
437 && curX (tty) == hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
439 if (!tty->TF_standout_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
440 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
441 if (!tty->TF_insmode_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
442 tty_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
443 cmgoto (tty, vpos, hpos);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 /* Similar but don't take any account of the wasted characters. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
448 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
449 tty_raw_cursor_to (struct frame *f, int row, int col)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
451 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
452
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
453 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
454 && curX (tty) == col)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
456 if (!tty->TF_standout_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
457 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
458 if (!tty->TF_insmode_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
459 tty_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
460 cmgoto (tty, row, col);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 /* Erase operations */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
465 /* 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
466
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
467 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
468 tty_clear_to_end (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
471 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
472
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
473 if (tty->TS_clr_to_bottom)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
475 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
476 OUTPUT (tty, tty->TS_clr_to_bottom);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 {
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
480 for (i = curY (tty); i < FRAME_LINES (f); i++)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
482 cursor_to (f, i, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
483 clear_end_of_line (f, FRAME_COLS (f));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
488 /* Clear an entire termcap frame. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
489
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
490 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
491 tty_clear_frame (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
493 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
494
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
495 if (tty->TS_clr_frame)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
497 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
498 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
499 cmat (tty, 0, 0);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
503 cursor_to (f, 0, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
504 clear_to_end (f);
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
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
508 /* An implementation of clear_end_of_line for termcap frames.
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 Note that the cursor may be moved, on terminals lacking a `ce' string. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
512 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
513 tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
516 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
518 /* 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
519 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
520 if (! tty->costs_set)
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
521 return;
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
522
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
523 if (curX (tty) >= first_unused_hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 return;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
525 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
526 if (tty->TS_clr_line)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
528 OUTPUT1 (tty, tty->TS_clr_line);
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 { /* have to do it the hard way */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
532 tty_turn_off_insert (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
534 /* 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
535 if (AutoWrap (tty)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
536 && curY (tty) == FrameRows (tty) - 1
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
537 && first_unused_hpos == FrameCols (tty))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538 first_unused_hpos--;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
540 for (i = curX (tty); i < first_unused_hpos; i++)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541 {
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
542 if (tty->termscript)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
543 fputc (' ', tty->termscript);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
544 fputc (' ', tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545 }
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
546 cmplus (tty, first_unused_hpos - curX (tty));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
550 /* Buffer to store the source and result of code conversion for terminal. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
551 static unsigned char *encode_terminal_buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
552 /* Allocated size of the above buffer. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
553 static int encode_terminal_bufsize;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
554
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
555 /* Encode SRC_LEN glyphs starting at SRC to terminal output codes.
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
556 Set CODING->produced to the byte-length of the resulting byte
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
557 sequence, and return a pointer to that byte sequence. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
558
58701
24c51e9d8586 (encode_terminal_code): Don't make it "static".
Kenichi Handa <handa@m17n.org>
parents: 58638
diff changeset
559 unsigned char *
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
560 encode_terminal_code (src, src_len, coding)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
561 struct glyph *src;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
562 int src_len;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
563 struct coding_system *coding;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
564 {
66238
d3f5aa0f18c4 (encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents: 65795
diff changeset
565 struct glyph *src_end = src + src_len;
17180
364327df6e7c (encode_terminal_code): Check validity of character code.
Kenichi Handa <handa@m17n.org>
parents: 17046
diff changeset
566 register GLYPH g;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
567 unsigned char *buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
568 int nchars, nbytes, required;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
569 register int tlen = GLYPH_TABLE_LENGTH;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
570 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
571
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
572 /* Allocate sufficient size of buffer to store all characters in
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
573 multibyte-form. But, it may be enlarged on demand if
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
574 Vglyph_table contains a string. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
575 required = MAX_MULTIBYTE_LENGTH * src_len;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
576 if (encode_terminal_bufsize < required)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
577 {
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
578 if (encode_terminal_bufsize == 0)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
579 encode_terminal_buf = xmalloc (required);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
580 else
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
581 encode_terminal_buf = xrealloc (encode_terminal_buf, required);
58906
b55034e18dd2 (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 58701
diff changeset
582 encode_terminal_bufsize = required;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
583 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
584
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
585 buf = encode_terminal_buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
586 nchars = 0;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
587 while (src < src_end)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
588 {
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
589 /* We must skip glyphs to be padded for a wide character. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
590 if (! CHAR_GLYPH_PADDING_P (*src))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
591 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
592 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
593
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
594 if (g < 0 || g >= tlen)
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
595 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
596 /* This glyph doesn't has an entry in Vglyph_table. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
597 if (CHAR_VALID_P (src->u.ch, 0))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
598 buf += CHAR_STRING (src->u.ch, buf);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
599 else
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
600 *buf++ = SPACEGLYPH;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
601 nchars++;
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
602 }
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
603 else
19035
0b4c1d43cb95 Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 18058
diff changeset
604 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
605 /* 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
606 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
607 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
608
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
609 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
610 {
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
611 int c = FAST_GLYPH_CHAR (g);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
612
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
613 if (CHAR_VALID_P (c, 0))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
614 buf += CHAR_STRING (c, buf);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
615 else
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
616 *buf++ = SPACEGLYPH;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
617 nchars++;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
618 }
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
619 else
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
620 {
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
621 /* We have a string in Vglyph_table. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
622 Lisp_Object string;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
623
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
624 string = tbase[g];
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
625 if (! STRING_MULTIBYTE (string))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
626 string = string_to_multibyte (string);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
627 nbytes = buf - encode_terminal_buf;
59382
e25d041a3a6e (encode_terminal_code): Fix buffer size computation.
Kenichi Handa <handa@m17n.org>
parents: 58906
diff changeset
628 if (encode_terminal_bufsize < nbytes + SBYTES (string))
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
629 {
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
630 encode_terminal_bufsize = nbytes + SBYTES (string);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
631 encode_terminal_buf = xrealloc (encode_terminal_buf,
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
632 encode_terminal_bufsize);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
633 buf = encode_terminal_buf + nbytes;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
634 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
635 bcopy (SDATA (string), buf, SBYTES (string));
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
636 buf += SBYTES (string);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
637 nchars += SCHARS (string);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
638 }
19035
0b4c1d43cb95 Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 18058
diff changeset
639 }
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
640 }
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
641 src++;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
642 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
643
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
644 nbytes = buf - encode_terminal_buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
645 coding->src_multibyte = 1;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
646 coding->dst_multibyte = 0;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
647 if (SYMBOLP (coding->pre_write_conversion)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
648 && ! NILP (Ffboundp (coding->pre_write_conversion)))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
649 {
66238
d3f5aa0f18c4 (encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents: 65795
diff changeset
650 run_pre_write_conversin_on_c_str (&encode_terminal_buf,
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
651 &encode_terminal_bufsize,
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
652 nchars, nbytes, coding);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
653 nchars = coding->produced_char;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
654 nbytes = coding->produced;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
655 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
656 required = nbytes + encoding_buffer_size (coding, nbytes);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
657 if (encode_terminal_bufsize < required)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
658 {
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
659 encode_terminal_bufsize = required;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
660 encode_terminal_buf = xrealloc (encode_terminal_buf, required);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
661 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
662
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
663 encode_coding (coding, encode_terminal_buf, encode_terminal_buf + nbytes,
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
664 nbytes, encode_terminal_bufsize - nbytes);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
665 return encode_terminal_buf + nbytes;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
666 }
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
667
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
668
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
669 /* 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
670
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
671 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
672 tty_write_glyphs (struct frame *f, struct glyph *string, int len)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
673 {
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
674 unsigned char *conversion_buffer;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
675 struct coding_system *coding;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
676
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
677 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
678
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
679 tty_turn_off_insert (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
680 tty_hide_cursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
681
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
682 /* 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
683 since that would scroll the whole frame on some terminals. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
684
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
685 if (AutoWrap (tty)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
686 && 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
687 && (curX (tty) + len) == FRAME_COLS (f))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
688 len --;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
689 if (len <= 0)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
690 return;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
691
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
692 cmplus (tty, len);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
693
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
694 /* If terminal_coding does any conversion, use it, otherwise use
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
695 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
696 because it always return 1 if the member src_multibyte is 1. */
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
697 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
698 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
699 /* 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
700 the tail. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
701 coding->mode &= ~CODING_MODE_LAST_BLOCK;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
702
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
703 while (len > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704 {
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
705 /* 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
706 int face_id = string->face_id;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
707 int n;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
708
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
709 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
710 if (string[n].face_id != face_id)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
711 break;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
712
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
713 /* Turn appearance modes of the face of the run on. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
714 tty_highlight_if_desired (tty);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
715 turn_on_face (f, face_id);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
716
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
717 if (n == len)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
718 /* This is the last run. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
719 coding->mode |= CODING_MODE_LAST_BLOCK;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
720 conversion_buffer = encode_terminal_code (string, n, coding);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
721 if (coding->produced > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
722 {
76627
c53e7d075f1a Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 75348
diff changeset
723 BLOCK_INPUT;
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
724 fwrite (conversion_buffer, 1, coding->produced, tty->output);
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
725 if (ferror (tty->output))
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
726 clearerr (tty->output);
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
727 if (tty->termscript)
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
728 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
76627
c53e7d075f1a Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 75348
diff changeset
729 UNBLOCK_INPUT;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
730 }
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
731 len -= n;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
732 string += n;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
733
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
734 /* Turn appearance modes off. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
735 turn_off_face (f, face_id);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
736 tty_turn_off_highlight (tty);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
737 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
738
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
739 cmcheckmagic (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
740 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
742 static void
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
743 tty_write_glyphs_with_face (f, string, len, face_id)
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
744 register struct frame *f;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
745 register struct glyph *string;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
746 register int len, face_id;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
747 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
748 unsigned char *conversion_buffer;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
749 struct coding_system *coding;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
750
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
751 struct tty_display_info *tty = FRAME_TTY (f);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
752
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
753 tty_turn_off_insert (tty);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
754 tty_hide_cursor (tty);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
755
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
756 /* Don't dare write in last column of bottom line, if Auto-Wrap,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
757 since that would scroll the whole frame on some terminals. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
758
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
759 if (AutoWrap (tty)
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
760 && curY (tty) + 1 == FRAME_LINES (f)
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
761 && (curX (tty) + len) == FRAME_COLS (f))
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
762 len --;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
763 if (len <= 0)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
764 return;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
765
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
766 cmplus (tty, len);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
767
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
768 /* If terminal_coding does any conversion, use it, otherwise use
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
769 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
770 because it always return 1 if the member src_multibyte is 1. */
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
771 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
772 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
773 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
774 the tail. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
775 coding->mode &= ~CODING_MODE_LAST_BLOCK;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
776
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
777 /* Turn appearance modes of the face. */
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
778 tty_highlight_if_desired (tty);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
779 turn_on_face (f, face_id);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
780
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
781 coding->mode |= CODING_MODE_LAST_BLOCK;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
782 conversion_buffer = encode_terminal_code (string, len, coding);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
783 if (coding->produced > 0)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
784 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
785 BLOCK_INPUT;
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
786 fwrite (conversion_buffer, 1, coding->produced, tty->output);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
787 if (ferror (tty->output))
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
788 clearerr (tty->output);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
789 if (tty->termscript)
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
790 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
791 UNBLOCK_INPUT;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
792 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
793
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
794 /* Turn appearance modes off. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
795 turn_off_face (f, face_id);
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
796 tty_turn_off_highlight (tty);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
797
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
798 cmcheckmagic (tty);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
799 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
800
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
801
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
802 /* 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
803
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
804 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
805 tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807 char *buf;
31829
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31102
diff changeset
808 struct glyph *glyph = NULL;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
809 unsigned char *conversion_buffer;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
810 unsigned char space[1];
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
811 struct coding_system *coding;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
813 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
814
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
815 if (tty->TS_ins_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
817 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
818 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
819 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
820 if (start)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
821 write_glyphs (f, start, len);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
822 return;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
823 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
824
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
825 tty_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
826 cmplus (tty, len);
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
827
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
828 if (! start)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
829 space[0] = SPACEGLYPH;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
830
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
831 /* If terminal_coding does any conversion, use it, otherwise use
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
832 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
833 because it always return 1 if the member src_multibyte is 1. */
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
834 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
835 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
836 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
837 the tail. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
838 coding->mode &= ~CODING_MODE_LAST_BLOCK;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
839
17191
36caec9c2e52 (insert_glyphs): Fix a bug which turns up when
Kenichi Handa <handa@m17n.org>
parents: 17180
diff changeset
840 while (len-- > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
842 OUTPUT1_IF (tty, tty->TS_ins_char);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843 if (!start)
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
844 {
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
845 conversion_buffer = space;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
846 coding->produced = 1;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
847 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 else
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
849 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
850 tty_highlight_if_desired (tty);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
851 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
852 glyph = start;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
853 ++start;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
854 /* 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
855 occupies more than one column. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
856 while (len && CHAR_GLYPH_PADDING_P (*start))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
857 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
858 OUTPUT1_IF (tty, tty->TS_ins_char);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
859 start++, len--;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
860 }
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
861
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
862 if (len <= 0)
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
863 /* This is the last glyph. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
864 coding->mode |= CODING_MODE_LAST_BLOCK;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
865
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
866 conversion_buffer = encode_terminal_code (glyph, 1, coding);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
867 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
869 if (coding->produced > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
870 {
76627
c53e7d075f1a Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 75348
diff changeset
871 BLOCK_INPUT;
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
872 fwrite (conversion_buffer, 1, coding->produced, tty->output);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
873 if (ferror (tty->output))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
874 clearerr (tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
875 if (tty->termscript)
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
876 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
76627
c53e7d075f1a Include blockinput.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 75348
diff changeset
877 UNBLOCK_INPUT;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
880 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
881 if (start)
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
882 {
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
883 turn_off_face (f, glyph->face_id);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
884 tty_turn_off_highlight (tty);
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
885 }
10439
1fcbeb4410f6 (write_glyphs, insert_glyphs): Call checkmagic.
Karl Heuer <kwzh@gnu.org>
parents: 10332
diff changeset
886 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
887
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
888 cmcheckmagic (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
891 /* 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
892
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
893 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
894 tty_delete_glyphs (struct frame *f, int n)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 char *buf;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 register int i;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
899 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
900
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
901 if (tty->delete_in_insert_mode)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
903 tty_turn_on_insert (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
907 tty_turn_off_insert (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
908 OUTPUT_IF (tty, tty->TS_delete_mode);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
911 if (tty->TS_del_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
913 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
914 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
915 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 for (i = 0; i < n; i++)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
919 OUTPUT1 (tty, tty->TS_del_char);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
920 if (!tty->delete_in_insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
921 OUTPUT_IF (tty, tty->TS_end_delete_mode);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
924 /* 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
925
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
926 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
927 tty_ins_del_lines (struct frame *f, int vpos, int n)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
929 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
930 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
931 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
932 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 register int i = n > 0 ? n : -n;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 register char *buf;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 /* If the lines below the insertion are being pushed
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938 into the end of the window, this is the same as clearing;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 and we know the lines are already clear, since the matching
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 deletion has already been done. So can ignore this. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941 /* If the lines below the deletion are blank lines coming
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 out of the end of the window, don't bother,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943 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
944 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
945 && vpos + i >= tty->specified_window)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 return;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
947 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
948 && vpos + i >= FRAME_LINES (f))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 return;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
950
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951 if (multi)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 {
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
953 raw_cursor_to (f, vpos, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
954 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 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
956 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
957 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959 else if (single)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960 {
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
961 raw_cursor_to (f, vpos, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
962 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 while (--i >= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
964 OUTPUT (tty, single);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
965 if (tty->TF_teleray)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
966 curX (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
970 tty_set_scroll_region (f, vpos, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 if (n < 0)
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
972 raw_cursor_to (f, tty->specified_window - 1, 0);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 else
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
974 raw_cursor_to (f, vpos, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
975 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 while (--i >= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
977 OUTPUTL (tty, scroll, tty->specified_window - vpos);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
978 tty_set_scroll_region (f, 0, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979 }
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
980
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
981 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
982 && 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
983 && n < 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
984 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
985 cursor_to (f, FRAME_LINES (f) + n, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
986 clear_to_end (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990 /* Compute cost of sending "str", in characters,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991 not counting any line-dependent padding. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 int
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
994 string_cost (char *str)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 tputs (str, 0, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 /* Compute cost of sending "str", in characters,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 counting any line-dependent padding at one line. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 static int
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
1006 string_cost_one_line (char *str)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 tputs (str, 1, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1012 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 /* Compute per line amount of line-dependent padding,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015 in tenths of characters. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1016
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1017 int
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
1018 per_line_cost (char *str)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1020 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022 tputs (str, 0, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 cost = - cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1024 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1025 tputs (str, 10, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1026 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1027 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029 #ifndef old
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 /* 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
1031 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
1032 The length of this vector is based on max_frame_cols. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034 int *char_ins_del_vector;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
1036 #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
1037 #endif
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1038
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 /* ARGSUSED */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1040 static void
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
1041 calculate_ins_del_char_costs (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1042 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1043 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1044 int ins_startup_cost, del_startup_cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1045 int ins_cost_per_char, del_cost_per_char;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1046 register int i;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1047 register int *p;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1048
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1049 if (tty->TS_ins_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1050 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1051 ins_cost_per_char = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1052 ins_startup_cost = string_cost_one_line (tty->TS_ins_multi_chars);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1053 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1054 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
1055 || (tty->TS_insert_mode && tty->TS_end_insert_mode))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1056 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1057 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
1058 + string_cost (tty->TS_end_insert_mode))) / 100;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1059 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
1060 + string_cost_one_line (tty->TS_pad_inserted_char));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1061 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1064 ins_startup_cost = 9999;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1065 ins_cost_per_char = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1066 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1067
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1068 if (tty->TS_del_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070 del_cost_per_char = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1071 del_startup_cost = string_cost_one_line (tty->TS_del_multi_chars);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1073 else if (tty->TS_del_char)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1074 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1075 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
1076 + string_cost (tty->TS_end_delete_mode));
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1077 if (tty->delete_in_insert_mode)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1078 del_startup_cost /= 2;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1079 del_cost_per_char = string_cost_one_line (tty->TS_del_char);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1081 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1082 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1083 del_startup_cost = 9999;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1084 del_cost_per_char = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1085 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1086
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1087 /* Delete costs are at negative offsets */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1088 p = &char_ins_del_cost (f)[0];
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1089 for (i = FRAME_COLS (f); --i >= 0;)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 *--p = (del_startup_cost += del_cost_per_char);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 /* Doing nothing is free */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1093 p = &char_ins_del_cost (f)[0];
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1094 *p++ = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1095
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1096 /* Insert costs are at positive offsets */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1097 for (i = FRAME_COLS (f); --i >= 0;)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098 *p++ = (ins_startup_cost += ins_cost_per_char);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1099 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
1101 void
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
1102 calculate_costs (struct frame *frame)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1103 {
10121
3f9f77a9488d (calculate_costs): Set FRAME_COST_BAUD_RATE.
Richard M. Stallman <rms@gnu.org>
parents: 9797
diff changeset
1104 FRAME_COST_BAUD_RATE (frame) = baud_rate;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
1106 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
1107 {
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1108 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
1109 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
1110 ? 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
1111 : 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
1112
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1113 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
1114
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1115 tty->costs_set = 1;
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1116
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1117 /* 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
1118 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
1119 used afterwards.
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1120
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1121 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
1122 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
1123
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1124 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
1125 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
1126
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1127 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
1128 char_ins_del_vector
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1129 = (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
1130 (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1131 + 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
1132 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1133 char_ins_del_vector
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1134 = (int *) xmalloc (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1135 + 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
1136
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1137 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
1138 + 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
1139
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1140
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1141 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
1142 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
1143 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
1144 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
1145 f, f, 1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1146 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1147 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
1148 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
1149 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
1150 0, 0, 1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1151
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1152 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
1153
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1154 /* 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
1155 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
1156 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
1157 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1158 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
1159
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1160 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
1161 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1162 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1163
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1164 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
1165 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
1166 };
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1167
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
1168 /* 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
1169 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
1170 (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
1171 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
1172 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
1173 */
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
1174
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1175 static struct fkey_table keys[] =
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1176 {
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1177 {"kh", "home"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1178 {"kl", "left"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1179 {"ku", "up"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1180 {"kr", "right"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1181 {"kd", "down"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1182 {"%8", "prior"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1183 {"%5", "next"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1184 {"@7", "end"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1185 {"@1", "begin"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1186 {"*6", "select"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1187 {"%9", "print"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1188 {"@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
1189 /*
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
1190 * "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
1191 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1192 {"&8", "undo"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1193 {"%0", "redo"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1194 {"%7", "menu"}, /* terminfo --- actually the `options' key */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1195 {"@0", "find"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1196 {"@2", "cancel"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1197 {"%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
1198 /*
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
1199 * "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
1200 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1201 {"&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
1202 /*
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
1203 * "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
1204 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1205 {"kE", "clearline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1206 {"kA", "insertline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1207 {"kL", "deleteline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1208 {"kI", "insertchar"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1209 {"kD", "deletechar"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1210 {"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
1211 /*
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
1212 * "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
1213 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1214 {"@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
1215 /*
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
1216 * "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
1217 * "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
1218 * "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
1219 * --- 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
1220 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1221 {"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
1222 /*
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
1223 * "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
1224 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1225 {"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
1226 /*
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
1227 * "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
1228 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1229 {"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
1230 /*
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
1231 * "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
1232 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1233 {"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
1234 /*
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
1235 * "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
1236 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1237 {"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
1238 /*
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
1239 * "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
1240 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1241 {"k1", "f1"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1242 {"k2", "f2"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1243 {"k3", "f3"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1244 {"k4", "f4"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1245 {"k5", "f5"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1246 {"k6", "f6"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1247 {"k7", "f7"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1248 {"k8", "f8"},
61591
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1249 {"k9", "f9"},
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1250
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1251 {"&0", "S-cancel"}, /*shifted cancel key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1252 {"&9", "S-begin"}, /*shifted begin key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1253 {"*0", "S-find"}, /*shifted find key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1254 {"*1", "S-execute"}, /*shifted execute? actually shifted command key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1255 {"*4", "S-delete"}, /*shifted delete-character key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1256 {"*7", "S-end"}, /*shifted end key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1257 {"*8", "S-clearline"}, /*shifted clear-to end-of-line key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1258 {"#1", "S-help"}, /*shifted help key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1259 {"#2", "S-home"}, /*shifted home key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1260 {"#3", "S-insert"}, /*shifted insert-character key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1261 {"#4", "S-left"}, /*shifted left-arrow key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1262 {"%d", "S-menu"}, /*shifted menu? actually shifted options key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1263 {"%c", "S-next"}, /*shifted next key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1264 {"%e", "S-prior"}, /*shifted previous key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1265 {"%f", "S-print"}, /*shifted print key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1266 {"%g", "S-redo"}, /*shifted redo key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1267 {"%i", "S-right"}, /*shifted right-arrow key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1268 {"!3", "S-undo"} /*shifted undo key*/
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1269 };
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1270
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1271 static char **term_get_fkeys_address;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1272 static KBOARD *term_get_fkeys_kboard;
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1273 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
1274
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
1275 /* 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
1276 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
1277 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
1278
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1279 static void
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1280 term_get_fkeys (address, kboard)
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1281 char **address;
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1282 KBOARD *kboard;
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1283 {
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1284 /* 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
1285 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
1286 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
1287 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
1288 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
1289 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
1290 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
1291
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1292 extern Lisp_Object Fidentity ();
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1293 term_get_fkeys_address = address;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1294 term_get_fkeys_kboard = kboard;
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1295 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
1296 }
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1297
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1298 static Lisp_Object
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1299 term_get_fkeys_1 ()
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1300 {
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1301 int i;
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1302
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1303 char **address = term_get_fkeys_address;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1304 KBOARD *kboard = term_get_fkeys_kboard;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1305
3359
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1306 /* 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
1307 if (!initialized)
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1308 kboard->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
3359
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1309
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1310 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1311 {
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1312 char *sequence = tgetstr (keys[i].cap, address);
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1313 if (sequence)
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1314 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1315 Fmake_vector (make_number (1),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1316 intern (keys[i].name)));
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1317 }
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1318
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1319 /* 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
1320 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
1321 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
1322 "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
1323 */
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1324 {
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1325 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
1326 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
1327 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
1328
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1329 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
1330 {
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1331 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
1332 /* 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
1333 key sequences happens to be the same. */
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1334 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0),
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1335 Fmake_vector (make_number (1), intern ("f0")));
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1336 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k_semi),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1337 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
1338 }
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1339 else if (k0)
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1340 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1341 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
1342 }
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
1343
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
1344 /* 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
1345 {
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
1346 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
1347
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1348 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
1349 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
1350 {
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
1351 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
1352 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
1353 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
1354 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
1355 else
10481
24756aef26e3 (term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents: 10439
diff changeset
1356 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
1357
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1358 {
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1359 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
1360 if (sequence)
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1361 {
4543
929e4c850e76 (term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 4499
diff changeset
1362 sprintf (fkey, "f%d", i);
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1363 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1364 Fmake_vector (make_number (1),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1365 intern (fkey)));
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1366 }
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1367 }
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
1368 }
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
1369 }
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
1370
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
1371 /*
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
1372 * 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
1373 */
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
1374 {
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1375 #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
1376 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
1377 { \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1378 char *sequence = tgetstr (cap2, address); \
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1379 if (sequence) \
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1380 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), \
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1381 Fmake_vector (make_number (1), \
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1382 intern (sym))); \
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1383 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1384
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
1385 /* 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
1386 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
1387 /* 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
1388 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
1389 /* 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
1390 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
1391 /* 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
1392 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
1393
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1394 /* 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
1395 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
1396 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
1397 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
1398 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
1399 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
1400 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
1401 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
1402 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
1403 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
1404 CONDITIONAL_REASSIGN ("*6", "kU", "select");
2224
49bda4cf498c Supply second arg for tgetstr() calls.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2179
diff changeset
1405 #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
1406 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1407
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1408 return Qnil;
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1409 }
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1410
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1411
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1412 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1413 Character Display Information
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1414 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1415
69637
8b3e0cacc358 Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents: 68661
diff changeset
1416 /* Avoid name clash with functions defined in xterm.c */
8b3e0cacc358 Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents: 68661
diff changeset
1417 #ifdef static
8b3e0cacc358 Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents: 68661
diff changeset
1418 #define append_glyph append_glyph_term
8b3e0cacc358 Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents: 68661
diff changeset
1419 #define produce_stretch_glyph produce_stretch_glyph_term
8b3e0cacc358 Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents: 68661
diff changeset
1420 #endif
8b3e0cacc358 Define aliases for append_glyph and produce_stretch_glyph
Kim F. Storm <storm@cua.dk>
parents: 68661
diff changeset
1421
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1422 static void append_glyph P_ ((struct it *));
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1423 static void produce_stretch_glyph P_ ((struct it *));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1424
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1425
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1426 /* Append glyphs to IT's glyph_row. Called from produce_glyphs for
68661
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1427 terminal frames if IT->glyph_row != NULL. IT->char_to_display is
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1428 the character for which to produce glyphs; IT->face_id contains the
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1429 character's face. Padding glyphs are appended if IT->c has a
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1430 IT->pixel_width > 1. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1431
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1432 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1433 append_glyph (it)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1434 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1435 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1436 struct glyph *glyph, *end;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1437 int i;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1438
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1439 xassert (it->glyph_row);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1440 glyph = (it->glyph_row->glyphs[it->area]
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1441 + it->glyph_row->used[it->area]);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1442 end = it->glyph_row->glyphs[1 + it->area];
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1443
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1444 for (i = 0;
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1445 i < it->pixel_width && glyph < end;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1446 ++i)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1447 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1448 glyph->type = CHAR_GLYPH;
29462
3306af2e4f3d (append_glyph): Revert change of 2000-06-06.
Gerd Moellmann <gerd@gnu.org>
parents: 29448
diff changeset
1449 glyph->pixel_width = 1;
68661
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1450 glyph->u.ch = it->char_to_display;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1451 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
1452 glyph->padding_p = i > 0;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1453 glyph->charpos = CHARPOS (it->position);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1454 glyph->object = it->object;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1455
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1456 ++it->glyph_row->used[it->area];
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1457 ++glyph;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1458 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1459 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1460
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1461
44372
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1462 /* Produce glyphs for the display element described by IT. *IT
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1463 specifies what we want to produce a glyph for (character, image, ...),
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1464 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
1465 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
1466 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
1467 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
1468 struct display_iterator in dispextern.h for an overview.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1469
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1470 produce_glyphs also stores the result of glyph width, ascent
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1471 etc. computations in *IT.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1472
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1473 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
1474 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
1475 in xdisp.c for text width and height computations.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1476
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1477 Callers usually don't call produce_glyphs directly;
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1478 instead they use the macro PRODUCE_GLYPHS. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1479
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1480 void
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1481 produce_glyphs (it)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1482 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1483 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1484 /* If a hook is installed, let it do the work. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1485 xassert (it->what == IT_CHARACTER
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1486 || it->what == IT_COMPOSITION
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1487 || it->what == IT_STRETCH);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1488
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1489 if (it->what == IT_STRETCH)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1490 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1491 produce_stretch_glyph (it);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1492 goto done;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1493 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1494
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1495 /* 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
1496 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
1497 sequence. */
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1498 xassert (it->what == IT_CHARACTER
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1499 || it->what == IT_COMPOSITION);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1500
68661
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1501 /* Maybe translate single-byte characters to multibyte. */
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1502 it->char_to_display = it->c;
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1503
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1504 if (it->c >= 040 && it->c < 0177)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1505 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1506 it->pixel_width = it->nglyphs = 1;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1507 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1508 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1509 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1510 else if (it->c == '\n')
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1511 it->pixel_width = it->nglyphs = 0;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1512 else if (it->c == '\t')
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1513 {
28685
b4310b6f3b5e (produce_glyphs): Remove reference to struct it's prompt_width.
Gerd Moellmann <gerd@gnu.org>
parents: 28507
diff changeset
1514 int absolute_x = (it->current_x
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1515 + it->continuation_lines_width);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1516 int next_tab_x
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1517 = (((1 + absolute_x + it->tab_width - 1)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1518 / it->tab_width)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1519 * it->tab_width);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1520 int nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1521
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1522 /* If part of the TAB has been displayed on the previous line
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1523 which is continued now, continuation_lines_width will have
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1524 been incremented already by the part that fitted on the
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1525 continued line. So, we will get the right number of spaces
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1526 here. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1527 nspaces = next_tab_x - absolute_x;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1528
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1529 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1530 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1531 int n = nspaces;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1532
68661
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1533 it->char_to_display = ' ';
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1534 it->pixel_width = it->len = 1;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1535
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1536 while (n--)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1537 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1538 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1539
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1540 it->pixel_width = nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1541 it->nglyphs = nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1542 }
29262
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1543 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
1544 {
68661
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1545 if (unibyte_display_via_language_environment
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1546 && (it->c >= 0240
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1547 || !NILP (Vnonascii_translation_table)))
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1548 {
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1549 int charset;
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1550
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1551 it->char_to_display = unibyte_char_to_multibyte (it->c);
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1552 charset = CHAR_CHARSET (it->char_to_display);
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1553 it->pixel_width = CHARSET_WIDTH (charset);
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1554 it->nglyphs = it->pixel_width;
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1555 if (it->glyph_row)
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1556 append_glyph (it);
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1557 }
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1558 else
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1559 {
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1560 /* Coming here means that it->c is from display table, thus we
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1561 must send the code as is to the terminal. Although there's
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1562 no way to know how many columns it occupies on a screen, it
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1563 is a good assumption that a single byte code has 1-column
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1564 width. */
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1565 it->pixel_width = it->nglyphs = 1;
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1566 if (it->glyph_row)
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1567 append_glyph (it);
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1568 }
29262
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1569 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1570 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1571 {
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1572 /* 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
1573 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
1574 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
1575 line. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1576 int charset = CHAR_CHARSET (it->c);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1577
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1578 it->pixel_width = CHARSET_WIDTH (charset);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1579 it->nglyphs = it->pixel_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1580
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1581 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1582 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1583 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1584
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1585 done:
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1586 /* Advance current_x by the pixel width as a convenience for
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1587 the caller. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1588 if (it->area == TEXT_AREA)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1589 it->current_x += it->pixel_width;
25187
39feb68ed3c7 (produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents: 25002
diff changeset
1590 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
1591 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
1592 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1593
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1594
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1595 /* 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
1596 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
1597 `(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
1598 being recognized:
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1599
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1600 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
1601 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
1602 point number.
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1603
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1604 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
1605 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
1606
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1607 static void
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1608 produce_stretch_glyph (it)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1609 struct it *it;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1610 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1611 /* (space :width WIDTH ...) */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1612 Lisp_Object prop, plist;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1613 int width = 0, align_to = -1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1614 int zero_width_ok_p = 0;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1615 double tem;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1616
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1617 /* List should start with `space'. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1618 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
1619 plist = XCDR (it->object);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1620
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1621 /* Compute the width of the stretch. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1622 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1623 && 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
1624 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1625 /* Absolute width `:width WIDTH' specified and valid. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1626 zero_width_ok_p = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1627 width = (int)(tem + 0.5);
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 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
1630 && 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
1631 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1632 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
66238
d3f5aa0f18c4 (encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents: 65795
diff changeset
1633 align_to = (align_to < 0
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1634 ? 0
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1635 : 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
1636 else if (align_to < 0)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1637 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
1638 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
1639 zero_width_ok_p = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1640 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1641 else
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1642 /* Nothing specified -> width defaults to canonical char width. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1643 width = FRAME_COLUMN_WIDTH (it->f);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1644
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1645 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
1646 width = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1647
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1648 if (width > 0 && it->glyph_row)
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 Lisp_Object o_object = it->object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1651 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
1652 int n = width;
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 if (!STRINGP (object))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1655 object = it->w->buffer;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1656 it->object = object;
68661
4e22dd401a52 (append_glyph): Refer to it->char_to_display instead of
Kenichi Handa <handa@m17n.org>
parents: 68651
diff changeset
1657 it->char_to_display = ' ';
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1658 it->pixel_width = it->len = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1659 while (n--)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1660 append_glyph (it);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1661 it->object = o_object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1662 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1663 it->pixel_width = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1664 it->nglyphs = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1665 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1666
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1667
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1668 /* Get information about special display element WHAT in an
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1669 environment described by IT. WHAT is one of IT_TRUNCATION or
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1670 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1671 non-null glyph_row member. This function ensures that fields like
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1672 face_id, c, len of IT are left untouched. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1673
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1674 void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1675 produce_special_glyphs (it, what)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1676 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1677 enum display_element_type what;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1678 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1679 struct it temp_it;
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1680 GLYPH glyph;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1681
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1682 temp_it = *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1683 temp_it.dp = NULL;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1684 temp_it.what = IT_CHARACTER;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1685 temp_it.len = 1;
28507
b6f06a755c7d make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP
Ken Raeburn <raeburn@raeburn.org>
parents: 28465
diff changeset
1686 temp_it.object = make_number (0);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1687 bzero (&temp_it.current, sizeof temp_it.current);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1688
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1689 if (what == IT_CONTINUATION)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1690 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1691 /* Continuation glyph. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1692 if (it->dp
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1693 && INTEGERP (DISP_CONTINUE_GLYPH (it->dp))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1694 && GLYPH_CHAR_VALID_P (XINT (DISP_CONTINUE_GLYPH (it->dp))))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1695 {
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1696 glyph = XINT (DISP_CONTINUE_GLYPH (it->dp));
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1697 glyph = spec_glyph_lookup_face (XWINDOW (it->window), glyph);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1698 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1699 else
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1700 glyph = '\\';
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1701 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1702 else if (what == IT_TRUNCATION)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1703 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1704 /* Truncation glyph. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1705 if (it->dp
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1706 && INTEGERP (DISP_TRUNC_GLYPH (it->dp))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1707 && GLYPH_CHAR_VALID_P (XINT (DISP_TRUNC_GLYPH (it->dp))))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1708 {
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1709 glyph = XINT (DISP_TRUNC_GLYPH (it->dp));
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1710 glyph = spec_glyph_lookup_face (XWINDOW (it->window), glyph);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1711 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1712 else
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1713 glyph = '$';
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1714 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1715 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1716 abort ();
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1717
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1718 temp_it.c = FAST_GLYPH_CHAR (glyph);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1719 temp_it.face_id = FAST_GLYPH_FACE (glyph);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1720 temp_it.len = CHAR_BYTES (temp_it.c);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1721
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1722 produce_glyphs (&temp_it);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1723 it->pixel_width = temp_it.pixel_width;
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1724 it->nglyphs = temp_it.pixel_width;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1725 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1726
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1727
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1728
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1729 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1730 Faces
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1731 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1732
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1733 /* 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
1734 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
1735 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
1736 color; the termcap capability `NC' specifies which ones. */
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1737
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1738 #define MAY_USE_WITH_COLORS_P(tty, ATTR) \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1739 (tty->TN_max_colors > 0 \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1740 ? (tty->TN_no_color_video & (ATTR)) == 0 \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1741 : 1)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1742
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1743 /* Turn appearances of face FACE_ID on tty frame F on.
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1744 FACE_ID is a realized face ID number, in the face cache. */
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 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1747 turn_on_face (f, face_id)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1748 struct frame *f;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1749 int face_id;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1750 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1751 struct face *face = FACE_FROM_ID (f, face_id);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1752 long fg = face->foreground;
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1753 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
1754 struct tty_display_info *tty = FRAME_TTY (f);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1755
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1756 /* 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
1757 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
1758 if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE))
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1759 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1760 if (tty->TN_max_colors > 0)
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1761 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1762 if (fg >= 0 && bg >= 0)
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1763 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1764 /* If the terminal supports colors, we can set them
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1765 below without using reverse video. The face's fg
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1766 and bg colors are set as they should appear on
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1767 the screen, i.e. they take the inverse-video'ness
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1768 of the face already into account. */
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1769 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1770 else if (inverse_video)
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1771 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1772 if (fg == FACE_TTY_DEFAULT_FG_COLOR
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1773 || bg == FACE_TTY_DEFAULT_BG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1774 tty_toggle_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1775 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1776 else
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1777 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1778 if (fg == FACE_TTY_DEFAULT_BG_COLOR
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1779 || bg == FACE_TTY_DEFAULT_FG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1780 tty_toggle_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1781 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1782 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1783 else
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1784 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1785 /* If we can't display colors, use reverse video
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1786 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
1787 if (inverse_video)
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1788 {
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1789 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
1790 || bg == FACE_TTY_DEFAULT_BG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1791 tty_toggle_highlight (tty);
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1792 }
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1793 else
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1794 {
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1795 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
1796 || bg == FACE_TTY_DEFAULT_FG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1797 tty_toggle_highlight (tty);
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1798 }
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1799 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1800 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1801
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1802 if (face->tty_bold_p)
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1803 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1804 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
1805 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
1806 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1807 else if (face->tty_dim_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1808 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
1809 OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1810
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1811 /* Alternate charset and blinking not yet used. */
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1812 if (face->tty_alt_charset_p
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1813 && 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
1814 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1815
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1816 if (face->tty_blinking_p
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1817 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1818 OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1819
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1820 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
1821 OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1822
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1823 if (tty->TN_max_colors > 0)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1824 {
65072
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1825 char *ts, *p;
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1826
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1827 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
65072
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1828 if (fg >= 0 && ts)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1829 {
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1830 p = tparam (ts, 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
1831 OUTPUT (tty, p);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1832 xfree (p);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1833 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1834
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1835 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background;
65072
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1836 if (bg >= 0 && ts)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1837 {
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1838 p = tparam (ts, 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
1839 OUTPUT (tty, p);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1840 xfree (p);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1841 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1842 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1843 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1844
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1845
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1846 /* Turn off appearances of face FACE_ID on tty frame F. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1847
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1848 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1849 turn_off_face (f, face_id)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1850 struct frame *f;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1851 int face_id;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1852 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1853 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
1854 struct tty_display_info *tty = FRAME_TTY (f);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1855
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1856 xassert (face != NULL);
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 if (tty->TS_exit_attribute_mode)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1859 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1860 /* Capability "me" will turn off appearance modes double-bright,
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1861 half-bright, reverse-video, standout, underline. It may or
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1862 may not turn off alt-char-mode. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1863 if (face->tty_bold_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1864 || face->tty_dim_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1865 || face->tty_reverse_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1866 || face->tty_alt_charset_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1867 || face->tty_blinking_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1868 || face->tty_underline_p)
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
1869 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1870 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1871 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
1872 tty->standout_mode = 0;
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
1873 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1874
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1875 if (face->tty_alt_charset_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1876 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1877 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1878 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1879 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1880 /* If we don't have "me" we can only have those appearances
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1881 that have exit sequences defined. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1882 if (face->tty_alt_charset_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1883 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1884
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
1885 if (face->tty_underline_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1886 OUTPUT_IF (tty, tty->TS_exit_underline_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1887 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1888
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1889 /* Switch back to default colors. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1890 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
1891 && ((face->foreground != FACE_TTY_DEFAULT_COLOR
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1892 && 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
1893 || (face->background != FACE_TTY_DEFAULT_COLOR
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1894 && face->background != FACE_TTY_DEFAULT_BG_COLOR)))
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1895 OUTPUT1_IF (tty, tty->TS_orig_pair);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1896 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1897
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1898
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1899 /* 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
1900 capabilities in CAPS simultaneously, with foreground and background
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1901 colors FG and BG. */
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1902
45548
612208417377 C style fix.
Miles Bader <miles@gnu.org>
parents: 45522
diff changeset
1903 int
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1904 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
1905 struct tty_display_info *tty;
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1906 unsigned caps;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1907 unsigned long fg, bg;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1908 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1909 #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
1910 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
1911 return 0;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1912
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1913 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
1914 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
1915 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
1916 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
1917 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
1918 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
1919
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1920 /* We can do it! */
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1921 return 1;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1922 }
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1923
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1924 /* Return non-zero if the terminal is capable to display colors. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1925
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1926 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
1927 0, 1, 0,
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1928 doc: /* Return non-nil if the tty device TERMINAL can display colors.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1929
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1930 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1931 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1932 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1933 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1934 Lisp_Object terminal;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1935 {
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
1936 struct terminal *t = get_tty_terminal (terminal, 0);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1937 if (!t)
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
1938 return Qnil;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1939 else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1940 return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1941 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1942
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1943 /* Return the number of supported colors. */
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1944 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
1945 Stty_display_color_cells, 0, 1, 0,
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1946 doc: /* Return the number of colors supported by the tty device TERMINAL.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1947
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1948 TERMINAL can be a terminal id, a frame or nil (meaning the selected
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
1949 frame's terminal). This function always returns 0 if TERMINAL
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1950 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1951 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1952 Lisp_Object terminal;
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1953 {
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
1954 struct terminal *t = get_tty_terminal (terminal, 0);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1955 if (!t)
83161
8d62eda26760 Fix byte-compile errors during bootstrap. (Reported by Juraj Kubelka.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83158
diff changeset
1956 return make_number (0);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1957 else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1958 return make_number (t->display_info.tty->TN_max_colors);
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1959 }
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1960
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1961 #ifndef WINDOWSNT
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1962
82410
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1963 /* Declare here rather than in the function, as in the rest of Emacs,
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1964 to work around an HPUX compiler bug (?). See
82389
1822f754a65a Comment previous change.
Glenn Morris <rgm@gnu.org>
parents: 82387
diff changeset
1965 http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00410.html */
82410
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1966 static int default_max_colors;
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1967 static int default_max_pairs;
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1968 static int default_no_color_video;
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1969 static char *default_orig_pair;
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1970 static char *default_set_foreground;
fa95c556638e Tweak previous change (don't init statics).
Glenn Morris <rgm@gnu.org>
parents: 82389
diff changeset
1971 static char *default_set_background;
82387
69bcf35b14d3 Philippe Waroquiers <philippe.waroquiers at eurocontrol.int>
Glenn Morris <rgm@gnu.org>
parents: 82140
diff changeset
1972
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1973 /* 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
1974 terminal. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1975 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1976 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
1977 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1978
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1979 if (save)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1980 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1981 if (default_orig_pair)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1982 xfree (default_orig_pair);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1983 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
1984
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1985 if (default_set_foreground)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1986 xfree (default_set_foreground);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1987 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
1988 : NULL;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1989
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1990 if (default_set_background)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1991 xfree (default_set_background);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1992 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
1993 : NULL;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1994
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1995 default_max_colors = tty->TN_max_colors;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1996 default_max_pairs = tty->TN_max_pairs;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1997 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
1998 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1999 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2000 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2001 tty->TS_orig_pair = default_orig_pair;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2002 tty->TS_set_foreground = default_set_foreground;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2003 tty->TS_set_background = default_set_background;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2004 tty->TN_max_colors = default_max_colors;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2005 tty->TN_max_pairs = default_max_pairs;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2006 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
2007 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2008 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2009
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2010 /* 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
2011 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
2012 support; zero means set up for the default capabilities, the ones
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
2013 we saw at init_tty time; -1 means turn off color support. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2014 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2015 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
2016 {
52652
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2017 /* 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
2018 if (mode < -1)
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2019 mode = -1;
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
2020
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2021 switch (mode)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2022 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2023 case -1: /* no colors at all */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2024 tty->TN_max_colors = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2025 tty->TN_max_pairs = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2026 tty->TN_no_color_video = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2027 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
2028 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2029 case 0: /* default colors, if any */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2030 default:
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2031 tty_default_color_capabilities (tty, 0);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2032 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2033 case 8: /* 8 standard ANSI colors */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2034 tty->TS_orig_pair = "\033[0m";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2035 #ifdef TERMINFO
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2036 tty->TS_set_foreground = "\033[3%p1%dm";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2037 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
2038 #else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2039 tty->TS_set_foreground = "\033[3%dm";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2040 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
2041 #endif
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2042 tty->TN_max_colors = 8;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2043 tty->TN_max_pairs = 64;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2044 tty->TN_no_color_video = 0;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2045 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2046 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2047 }
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 void
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2050 set_tty_color_mode (f, val)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2051 struct frame *f;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2052 Lisp_Object val;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2053 {
42808
cb0b3b9b61ec (set_tty_color_mode): Remove unused variable `tem'.
Pavel Janík <Pavel@Janik.cz>
parents: 42742
diff changeset
2054 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
2055 Lisp_Object color_mode, current_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2056 int mode, old_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2057 extern Lisp_Object Qtty_color_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2058 Lisp_Object tty_color_mode_alist;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2059
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2060 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
2061 Qnil);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2062
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
2063 if (INTEGERP (val))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2064 color_mode = val;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2065 else
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 if (NILP (tty_color_mode_alist))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2068 color_mode_spec = Qnil;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2069 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2070 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
2071
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2072 if (CONSP (color_mode_spec))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2073 color_mode = XCDR (color_mode_spec);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2074 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2075 color_mode = Qnil;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2076 }
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
2077
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
2078 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
2079
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2080 if (CONSP (current_mode_spec))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2081 current_mode = XCDR (current_mode_spec);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2082 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2083 current_mode = Qnil;
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
2084 if (INTEGERP (color_mode))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2085 mode = XINT (color_mode);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2086 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2087 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
2088 if (INTEGERP (current_mode))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2089 old_mode = XINT (current_mode);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2090 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2091 old_mode = 0;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2092
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2093 if (mode != old_mode)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2094 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2095 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
2096 /* 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
2097 definitions. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2098 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
2099 redraw_frame (f);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2100 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2101 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2102
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2103 #endif /* !WINDOWSNT */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2104
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2105
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2106
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2107 /* Return the tty display object specified by TERMINAL. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2108
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2109 struct terminal *
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2110 get_tty_terminal (Lisp_Object terminal, int throw)
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2111 {
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2112 struct terminal *t = get_terminal (terminal, throw);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2113
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2114 if (t && t->type != output_termcap)
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2115 {
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2116 if (throw)
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2117 error ("Device %d is not a termcap terminal device", t->id);
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2118 else
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2119 return NULL;
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2120 }
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2121
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2122 return t;
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2123 }
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2124
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2125 /* Return an active termcap device that uses the tty device with the
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2126 given name.
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2127
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2128 This function ignores suspended devices.
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2129
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2130 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
2131
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2132 struct terminal *
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2133 get_named_tty (name)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2134 char *name;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2135 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2136 struct terminal *t;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2137
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2138 if (!name)
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2139 abort ();
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2140
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2141 for (t = terminal_list; t; t = t->next_terminal)
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2142 {
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2143 if (t->type == output_termcap
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2144 && !strcmp (t->display_info.tty->name, name)
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2145 && TERMINAL_ACTIVE_P (t))
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2146 return t;
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2147 }
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2148
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2149 return 0;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2150 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2151
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2152
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2153 DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0,
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2154 doc: /* Return the type of the tty device that TERMINAL uses.
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2155 Returns nil if TERMINAL is not on a tty device.
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2156
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2157 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2158 frame's terminal). */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2159 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2160 Lisp_Object terminal;
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2161 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2162 struct terminal *t = get_terminal (terminal, 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2163
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2164 if (t->type != output_termcap)
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2165 return Qnil;
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
2166
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2167 if (t->display_info.tty->type)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2168 return build_string (t->display_info.tty->type);
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2169 else
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2170 return Qnil;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2171 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2172
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2173 DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0,
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2174 doc: /* Return non-nil if TERMINAL is on the controlling tty of the Emacs process.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2175
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2176 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2177 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2178 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2179 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2180 Lisp_Object terminal;
83173
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2181 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2182 struct terminal *t = get_terminal (terminal, 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2183
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
2184 if (t->type != output_termcap || strcmp (t->display_info.tty->name, DEV_TTY))
83173
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2185 return Qnil;
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2186 else
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2187 return Qt;
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2188 }
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2189
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2190 DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2191 doc: /* Declare that the tty used by TERMINAL does not handle underlining.
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2192 This is used to override the terminfo data, for certain terminals that
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2193 do not really do underlining, but say that they do. This function has
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2194 no effect if used on a non-tty terminal.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2195
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2196 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2197 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2198 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2199 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2200 Lisp_Object terminal;
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2201 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2202 struct terminal *t = get_terminal (terminal, 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2203
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2204 if (t->type == output_termcap)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2205 t->display_info.tty->TS_enter_underline_mode = 0;
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2206 return Qnil;
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2207 }
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2208
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2209
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2210
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2211 DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2212 doc: /* Suspend the terminal device TTY.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2213
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2214 The device is restored to its default state, and Emacs ceases all
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2215 access to the tty device. Frames that use the device are not deleted,
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2216 but input is not read from them and if they change, their display is
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2217 not updated.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2218
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2219 TTY may be a terminal id, a frame, or nil for the terminal device of
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2220 the currently selected frame.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2221
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
2222 This function runs `suspend-tty-functions' after suspending the
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2223 device. The functions are run with one arg, the id of the suspended
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2224 terminal device.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2225
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2226 `suspend-tty' does nothing if it is called on a device that is already
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2227 suspended.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2228
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2229 A suspended tty may be resumed by calling `resume-tty' on it. */)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2230 (tty)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2231 Lisp_Object tty;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2232 {
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2233 struct terminal *t = get_tty_terminal (tty, 1);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2234 FILE *f;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2235
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2236 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2237 error ("Unknown tty device");
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2238
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2239 f = t->display_info.tty->input;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2240
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2241 if (f)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2242 {
84769
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2243 /* First run `suspend-tty-functions' and then clean up the tty
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2244 state because `suspend-tty-functions' might need to change
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2245 the tty state. */
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2246 if (!NILP (Vrun_hooks))
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2247 {
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2248 Lisp_Object args[2];
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2249 args[0] = intern ("suspend-tty-functions");
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2250 XSETTERMINAL (args[1], t);
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2251 Frun_hook_with_args (2, args);
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2252 }
cbcb89640ef2 * xt-mouse.el (xterm-mouse-mode): Re-enable suspend-tty-functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84768
diff changeset
2253
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2254 reset_sys_modes (t->display_info.tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2255
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2256 delete_keyboard_wait_descriptor (fileno (f));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2257
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2258 fclose (f);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2259 if (f != t->display_info.tty->output)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2260 fclose (t->display_info.tty->output);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2261
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2262 t->display_info.tty->input = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2263 t->display_info.tty->output = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2264
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2265 if (FRAMEP (t->display_info.tty->top_frame))
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2266 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2267
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2268 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2269
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
2270 /* Clear display hooks to prevent further output. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
2271 clear_tty_hooks (t);
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
2272
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2273 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2274 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2275
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2276 DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2277 doc: /* Resume the previously suspended terminal device TTY.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2278 The terminal is opened and reinitialized. Frames that are on the
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2279 suspended terminal are revived.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2280
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2281 It is an error to resume a terminal while another terminal is active
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2282 on the same device.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2283
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
2284 This function runs `resume-tty-functions' after resuming the terminal.
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2285 The functions are run with one arg, the id of the resumed terminal
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2286 device.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2287
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2288 `resume-tty' does nothing if it is called on a device that is not
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2289 suspended.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2290
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2291 TTY may be a terminal id, a frame, or nil for the terminal device of
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2292 the currently selected frame. */)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2293 (tty)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2294 Lisp_Object tty;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2295 {
83512
5d328dadd0f4 Make `tty-display-color-p' follow its doc string. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83502
diff changeset
2296 struct terminal *t = get_tty_terminal (tty, 1);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2297 int fd;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2298
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2299 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2300 error ("Unknown tty device");
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2301
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2302 if (!t->display_info.tty->input)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2303 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2304 if (get_named_tty (t->display_info.tty->name))
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2305 error ("Cannot resume display while another display is active on the same device");
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2306
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2307 fd = emacs_open (t->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2308
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
2309 if (fd == -1)
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
2310 error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
2311
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
2312 if (strcmp (t->display_info.tty->name, DEV_TTY))
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
2313 dissociate_if_controlling_tty (fd);
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
2314
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2315 t->display_info.tty->output = fdopen (fd, "w+");
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2316 t->display_info.tty->input = t->display_info.tty->output;
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
2317
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2318 add_keyboard_wait_descriptor (fd);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2319
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2320 if (FRAMEP (t->display_info.tty->top_frame))
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2321 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2322
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2323 init_sys_modes (t->display_info.tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2324
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
2325 /* Run `resume-tty-functions'. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2326 if (!NILP (Vrun_hooks))
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2327 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2328 Lisp_Object args[2];
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
2329 args[0] = intern ("resume-tty-functions");
84692
0d8dd9a91520 (get_tty_terminal): Don't treat output_initial specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84461
diff changeset
2330 XSETTERMINAL (args[1], t);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2331 Frun_hook_with_args (2, args);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2332 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2333 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2334
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
2335 set_tty_hooks (t);
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
2336
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2337 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2338 }
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2339
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2340
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2341 /***********************************************************************
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2342 Mouse
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2343 ***********************************************************************/
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2344
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
2345 #ifdef HAVE_GPM
81107
a9d423c1c1d4 Whitespace fix.
Richard M. Stallman <rms@gnu.org>
parents: 81102
diff changeset
2346 void
a9d423c1c1d4 Whitespace fix.
Richard M. Stallman <rms@gnu.org>
parents: 81102
diff changeset
2347 term_mouse_moveto (int x, int y)
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2348 {
81811
c10410a3aa36 Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81308
diff changeset
2349 /* TODO: how to set mouse position?
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2350 const char *name;
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2351 int fd;
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2352 name = (const char *) ttyname (0);
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2353 fd = open (name, O_WRONLY);
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2354 SOME_FUNCTION (x, y, fd);
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2355 close (fd);
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2356 last_mouse_x = x;
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2357 last_mouse_y = y; */
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2358 }
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2359
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2360 static void
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2361 term_show_mouse_face (enum draw_glyphs_face draw)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2362 {
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2363 struct window *w = XWINDOW (Qmouse_face_window);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2364 int save_x, save_y;
81811
c10410a3aa36 Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81308
diff changeset
2365 int i;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2366
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2367 struct frame *f = XFRAME (w->frame);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2368 struct tty_display_info *tty = FRAME_TTY (f);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2369
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2370 if (/* If window is in the process of being destroyed, don't bother
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2371 to do anything. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2372 w->current_matrix != NULL
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2373 /* Recognize when we are called to operate on rows that don't exist
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2374 anymore. This can happen when a window is split. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2375 && mouse_face_end_row < w->current_matrix->nrows)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2376 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2377 /* write_glyphs writes at cursor position, so we need to
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2378 temporarily move cursor coordinates to the beginning of
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2379 the highlight region. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2380
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2381 /* Save current cursor co-ordinates */
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2382 save_y = curY (tty);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2383 save_x = curX (tty);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2384
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2385 /* Note that mouse_face_beg_row etc. are window relative. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2386 for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2387 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2388 int start_hpos, end_hpos, nglyphs;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2389 struct glyph_row *row = MATRIX_ROW (w->current_matrix, i);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2390
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2391 /* Don't do anything if row doesn't have valid contents. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2392 if (!row->enabled_p)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2393 continue;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2394
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2395 /* For all but the first row, the highlight starts at column 0. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2396 if (i == mouse_face_beg_row)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2397 start_hpos = mouse_face_beg_col;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2398 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2399 start_hpos = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2400
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2401 if (i == mouse_face_end_row)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2402 end_hpos = mouse_face_end_col;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2403 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2404 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2405 end_hpos = row->used[TEXT_AREA];
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2406 if (draw == DRAW_NORMAL_TEXT)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2407 row->fill_line_p = 1; /* Clear to end of line */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2408 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2409
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2410 if (end_hpos <= start_hpos)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2411 continue;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2412 /* Record that some glyphs of this row are displayed in
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2413 mouse-face. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2414 row->mouse_face_p = draw > 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2415
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2416 nglyphs = end_hpos - start_hpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2417
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2418 if (end_hpos >= row->used[TEXT_AREA])
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2419 nglyphs = row->used[TEXT_AREA] - start_hpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2420
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2421 pos_y = row->y + WINDOW_TOP_EDGE_Y (w);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2422 pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2423 + WINDOW_LEFT_EDGE_X (w);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2424
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2425 cursor_to (f, pos_y, pos_x);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2426
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2427 if (draw == DRAW_MOUSE_FACE)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2428 {
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2429 tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos,
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2430 nglyphs, mouse_face_face_id);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2431 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2432 else /* draw == DRAW_NORMAL_TEXT */
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2433 write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2434 }
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2435 cursor_to (f, save_y, save_x);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2436 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2437 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2438
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2439 static void
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2440 term_clear_mouse_face ()
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2441 {
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2442 if (!NILP (Qmouse_face_window))
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2443 term_show_mouse_face (DRAW_NORMAL_TEXT);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2444
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2445 mouse_face_beg_row = mouse_face_beg_col = -1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2446 mouse_face_end_row = mouse_face_end_col = -1;
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2447 Qmouse_face_window = Qnil;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2448 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2449
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2450 /* Find the glyph matrix position of buffer position POS in window W.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2451 *HPOS and *VPOS are set to the positions found. W's current glyphs
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2452 must be up to date. If POS is above window start return (0, 0).
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2453 If POS is after end of W, return end of last line in W.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2454 - taken from msdos.c */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2455 static int
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2456 fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2457 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2458 int i, lastcol, line_start_position, maybe_next_line_p = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2459 int yb = window_text_bottom_y (w);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2460 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2461
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2462 while (row->y < yb)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2463 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2464 if (row->used[TEXT_AREA])
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2465 line_start_position = row->glyphs[TEXT_AREA]->charpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2466 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2467 line_start_position = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2468
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2469 if (line_start_position > pos)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2470 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2471 /* If the position sought is the end of the buffer,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2472 don't include the blank lines at the bottom of the window. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2473 else if (line_start_position == pos
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2474 && pos == BUF_ZV (XBUFFER (w->buffer)))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2475 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2476 maybe_next_line_p = 1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2477 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2478 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2479 else if (line_start_position > 0)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2480 best_row = row;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2481
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2482 /* Don't overstep the last matrix row, lest we get into the
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2483 never-never land... */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2484 if (row->y + 1 >= yb)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2485 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2486
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2487 ++row;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2488 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2489
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2490 /* Find the right column within BEST_ROW. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2491 lastcol = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2492 row = best_row;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2493 for (i = 0; i < row->used[TEXT_AREA]; i++)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2494 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2495 struct glyph *glyph = row->glyphs[TEXT_AREA] + i;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2496 int charpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2497
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2498 charpos = glyph->charpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2499 if (charpos == pos)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2500 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2501 *hpos = i;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2502 *vpos = row->y;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2503 return 1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2504 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2505 else if (charpos > pos)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2506 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2507 else if (charpos > 0)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2508 lastcol = i;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2509 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2510
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2511 /* If we're looking for the end of the buffer,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2512 and we didn't find it in the line we scanned,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2513 use the start of the following line. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2514 if (maybe_next_line_p)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2515 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2516 ++row;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2517 lastcol = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2518 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2519
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2520 *vpos = row->y;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2521 *hpos = lastcol + 1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2522 return 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2523 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2524
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2525 static void
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2526 term_mouse_highlight (struct frame *f, int x, int y)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2527 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2528 enum window_part part;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2529 Lisp_Object window;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2530 struct window *w;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2531 struct buffer *b;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2532
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2533 if (NILP (Vmouse_highlight)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2534 || !f->glyphs_initialized_p)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2535 return;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2536
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2537 /* Which window is that in? */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2538 window = window_from_coordinates (f, x, y, &part, &x, &y, 0);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2539
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2540 /* Not on a window -> return. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2541 if (!WINDOWP (window))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2542 return;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2543
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2544 if (!EQ (window, Qmouse_face_window))
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2545 term_clear_mouse_face ();
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2546
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2547 w = XWINDOW (window);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2548
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2549 /* Are we in a window whose display is up to date?
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2550 And verify the buffer's text has not changed. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2551 b = XBUFFER (w->buffer);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2552 if (part == ON_TEXT
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2553 && EQ (w->window_end_valid, w->buffer)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2554 && XFASTINT (w->last_modified) == BUF_MODIFF (b)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2555 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2556 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2557 int pos, i, nrows = w->current_matrix->nrows;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2558 struct glyph_row *row;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2559 struct glyph *glyph;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2560
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2561 /* Find the glyph under X/Y. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2562 glyph = NULL;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2563 if (y >= 0 && y < nrows)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2564 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2565 row = MATRIX_ROW (w->current_matrix, y);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2566 /* Give up if some row before the one we are looking for is
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2567 not enabled. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2568 for (i = 0; i <= y; i++)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2569 if (!MATRIX_ROW (w->current_matrix, i)->enabled_p)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2570 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2571 if (i > y /* all rows upto and including the one at Y are enabled */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2572 && row->displays_text_p
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2573 && x < window_box_width (w, TEXT_AREA))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2574 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2575 glyph = row->glyphs[TEXT_AREA];
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2576 if (x >= row->used[TEXT_AREA])
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2577 glyph = NULL;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2578 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2579 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2580 glyph += x;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2581 if (!BUFFERP (glyph->object))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2582 glyph = NULL;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2583 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2584 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2585 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2586
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2587 /* Clear mouse face if X/Y not over text. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2588 if (glyph == NULL)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2589 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2590 term_clear_mouse_face ();
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2591 return;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2592 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2593
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2594 if (!BUFFERP (glyph->object))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2595 abort ();
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2596 pos = glyph->charpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2597
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2598 /* Check for mouse-face. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2599 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2600 extern Lisp_Object Qmouse_face;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2601 Lisp_Object mouse_face, overlay, position, *overlay_vec;
81083
223bb8e66f74 * xfaces.c (syms_of_xfaces): Delete stray semicolon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80994
diff changeset
2602 int noverlays, obegv, ozv;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2603 struct buffer *obuf;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2604
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2605 /* If we get an out-of-range value, return now; avoid an error. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2606 if (pos > BUF_Z (b))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2607 return;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2608
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2609 /* Make the window's buffer temporarily current for
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2610 overlays_at and compute_char_face. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2611 obuf = current_buffer;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2612 current_buffer = b;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2613 obegv = BEGV;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2614 ozv = ZV;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2615 BEGV = BEG;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2616 ZV = Z;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2617
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2618 /* Is this char mouse-active? */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2619 XSETINT (position, pos);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2620
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2621 /* Put all the overlays we want in a vector in overlay_vec. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2622 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2623 /* Sort overlays into increasing priority order. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2624 noverlays = sort_overlays (overlay_vec, noverlays, w);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2625
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2626 /* Check mouse-face highlighting. */
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2627 if (!(EQ (window, Qmouse_face_window)
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2628 && y >= mouse_face_beg_row
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2629 && y <= mouse_face_end_row
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2630 && (y > mouse_face_beg_row
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2631 || x >= mouse_face_beg_col)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2632 && (y < mouse_face_end_row
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2633 || x < mouse_face_end_col
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2634 || mouse_face_past_end)))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2635 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2636 /* Clear the display of the old active region, if any. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2637 term_clear_mouse_face ();
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2638
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2639 /* Find the highest priority overlay that has a mouse-face
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2640 property. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2641 overlay = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2642 for (i = noverlays - 1; i >= 0; --i)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2643 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2644 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2645 if (!NILP (mouse_face))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2646 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2647 overlay = overlay_vec[i];
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2648 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2649 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2650 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2651
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2652 /* If no overlay applies, get a text property. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2653 if (NILP (overlay))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2654 mouse_face = Fget_text_property (position, Qmouse_face,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2655 w->buffer);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2656
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2657 /* Handle the overlay case. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2658 if (!NILP (overlay))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2659 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2660 /* Find the range of text around this char that
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2661 should be active. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2662 Lisp_Object before, after;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2663 int ignore;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2664
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2665
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2666 before = Foverlay_start (overlay);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2667 after = Foverlay_end (overlay);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2668 /* Record this as the current active region. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2669 fast_find_position (w, XFASTINT (before),
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2670 &mouse_face_beg_col,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2671 &mouse_face_beg_row);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2672
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2673 mouse_face_past_end
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2674 = !fast_find_position (w, XFASTINT (after),
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2675 &mouse_face_end_col,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2676 &mouse_face_end_row);
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2677 Qmouse_face_window = window;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2678
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2679 mouse_face_face_id
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2680 = face_at_buffer_position (w, pos, 0, 0,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2681 &ignore, pos + 1, 1);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2682
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2683 /* Display it as active. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2684 term_show_mouse_face (DRAW_MOUSE_FACE);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2685 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2686 /* Handle the text property case. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2687 else if (!NILP (mouse_face))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2688 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2689 /* Find the range of text around this char that
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2690 should be active. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2691 Lisp_Object before, after, beginning, end;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2692 int ignore;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2693
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2694 beginning = Fmarker_position (w->start);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2695 XSETINT (end, (BUF_Z (b) - XFASTINT (w->window_end_pos)));
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2696 before
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2697 = Fprevious_single_property_change (make_number (pos + 1),
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2698 Qmouse_face,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2699 w->buffer, beginning);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2700 after
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2701 = Fnext_single_property_change (position, Qmouse_face,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2702 w->buffer, end);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2703
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2704 /* Record this as the current active region. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2705 fast_find_position (w, XFASTINT (before),
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2706 &mouse_face_beg_col,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2707 &mouse_face_beg_row);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2708 mouse_face_past_end
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2709 = !fast_find_position (w, XFASTINT (after),
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2710 &mouse_face_end_col,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2711 &mouse_face_end_row);
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2712 Qmouse_face_window = window;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2713
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2714 mouse_face_face_id
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2715 = face_at_buffer_position (w, pos, 0, 0,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2716 &ignore, pos + 1, 1);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2717
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2718 /* Display it as active. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2719 term_show_mouse_face (DRAW_MOUSE_FACE);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2720 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2721 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2722
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2723 /* Look for a `help-echo' property. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2724 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2725 Lisp_Object help;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2726 extern Lisp_Object Qhelp_echo;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2727
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2728 /* Check overlays first. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2729 help = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2730 for (i = noverlays - 1; i >= 0 && NILP (help); --i)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2731 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2732 overlay = overlay_vec[i];
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2733 help = Foverlay_get (overlay, Qhelp_echo);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2734 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2735
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2736 if (!NILP (help))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2737 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2738 help_echo_string = help;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2739 help_echo_window = window;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2740 help_echo_object = overlay;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2741 help_echo_pos = pos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2742 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2743 /* Try text properties. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2744 else if (NILP (help)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2745 && ((STRINGP (glyph->object)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2746 && glyph->charpos >= 0
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2747 && glyph->charpos < SCHARS (glyph->object))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2748 || (BUFFERP (glyph->object)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2749 && glyph->charpos >= BEGV
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2750 && glyph->charpos < ZV)))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2751 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2752 help = Fget_text_property (make_number (glyph->charpos),
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2753 Qhelp_echo, glyph->object);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2754 if (!NILP (help))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2755 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2756 help_echo_string = help;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2757 help_echo_window = window;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2758 help_echo_object = glyph->object;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2759 help_echo_pos = glyph->charpos;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2760 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2761 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2762 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2763
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2764 BEGV = obegv;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2765 ZV = ozv;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2766 current_buffer = obuf;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2767 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2768 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2769 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2770
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2771 static int
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2772 term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2773 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2774 /* Has the mouse moved off the glyph it was on at the last sighting? */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2775 if (event->x != last_mouse_x || event->y != last_mouse_y)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2776 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2777 frame->mouse_moved = 1;
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2778 term_mouse_highlight (frame, event->x, event->y);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2779 /* Remember which glyph we're now on. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2780 last_mouse_x = event->x;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2781 last_mouse_y = event->y;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2782 return 1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2783 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2784 return 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2785 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2786
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2787 /* Return the current position of the mouse.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2788
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2789 Set *f to the frame the mouse is in, or zero if the mouse is in no
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2790 Emacs frame. If it is set to zero, all the other arguments are
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2791 garbage.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2792
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2793 Set *bar_window to Qnil, and *x and *y to the column and
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2794 row of the character cell the mouse is over.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2795
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2796 Set *time to the time the mouse was at the returned position.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2797
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2798 This clears mouse_moved until the next motion
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2799 event arrives. */
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2800 static void
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2801 term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2802 enum scroll_bar_part *part, Lisp_Object *x,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2803 Lisp_Object *y, unsigned long *time)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2804 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2805 struct timeval now;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2806
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2807 *fp = SELECTED_FRAME ();
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2808 (*fp)->mouse_moved = 0;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2809
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2810 *bar_window = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2811 *part = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2812
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2813 XSETINT (*x, last_mouse_x);
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2814 XSETINT (*y, last_mouse_y);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2815 gettimeofday(&now, 0);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2816 *time = (now.tv_sec * 1000) + (now.tv_usec / 1000);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2817 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2818
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2819 /* Prepare a mouse-event in *RESULT for placement in the input queue.
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2820
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2821 If the event is a button press, then note that we have grabbed
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2822 the mouse. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2823
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2824 static Lisp_Object
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2825 term_mouse_click (struct input_event *result, Gpm_Event *event,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2826 struct frame *f)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2827 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2828 struct timeval now;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2829 int i, j;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2830
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2831 result->kind = GPM_CLICK_EVENT;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2832 for (i = 0, j = GPM_B_LEFT; i < 3; i++, j >>= 1 )
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2833 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2834 if (event->buttons & j) {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2835 result->code = i; /* button number */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2836 break;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2837 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2838 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2839 gettimeofday(&now, 0);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2840 result->timestamp = (now.tv_sec * 1000) + (now.tv_usec / 1000);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2841
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2842 if (event->type & GPM_UP)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2843 result->modifiers = up_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2844 else if (event->type & GPM_DOWN)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2845 result->modifiers = down_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2846 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2847 result->modifiers = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2848
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2849 if (event->type & GPM_SINGLE)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2850 result->modifiers |= click_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2851
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2852 if (event->type & GPM_DOUBLE)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2853 result->modifiers |= double_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2854
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2855 if (event->type & GPM_TRIPLE)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2856 result->modifiers |= triple_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2857
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2858 if (event->type & GPM_DRAG)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2859 result->modifiers |= drag_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2860
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2861 if (!(event->type & (GPM_MOVE | GPM_DRAG))) {
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2862
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2863 /* 1 << KG_SHIFT */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2864 if (event->modifiers & (1 << 0))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2865 result->modifiers |= shift_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2866
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2867 /* 1 << KG_CTRL */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2868 if (event->modifiers & (1 << 2))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2869 result->modifiers |= ctrl_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2870
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2871 /* 1 << KG_ALT || KG_ALTGR */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2872 if (event->modifiers & (1 << 3)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2873 || event->modifiers & (1 << 1))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2874 result->modifiers |= meta_modifier;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2875 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2876
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2877 XSETINT (result->x, event->x);
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2878 XSETINT (result->y, event->y);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2879 XSETFRAME (result->frame_or_window, f);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2880 result->arg = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2881 return Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2882 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2883
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2884 int
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2885 handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct input_event* hold_quit)
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2886 {
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2887 struct frame *f = XFRAME (tty->top_frame);
81811
c10410a3aa36 Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81308
diff changeset
2888 int fd;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2889 struct input_event ie;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2890 int do_help = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2891 int count = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2892
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2893 EVENT_INIT (ie);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2894 ie.kind = NO_EVENT;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2895 ie.arg = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2896
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2897 if (event->type & (GPM_MOVE | GPM_DRAG)) {
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2898 unsigned char buf[6 * sizeof (short)];
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2899 unsigned short *arg = (unsigned short *) buf + 1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2900 const char *name;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2901
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2902 previous_help_echo_string = help_echo_string;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2903 help_echo_string = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2904
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2905 /* Display mouse pointer */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2906 buf[sizeof(short) - 1] = 2; /* set selection */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2907
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2908 arg[0] = arg[2] = (unsigned short) event->x + gpm_zerobased;
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2909 arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2910 arg[4] = (unsigned short) 3;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2911
81811
c10410a3aa36 Include unistd.h for ttyname, used in handle_one_term_event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81308
diff changeset
2912 name = ttyname (0);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2913 fd = open (name, O_WRONLY);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2914 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1);
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
2915 close (fd);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2916
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2917 if (!term_mouse_movement (f, event))
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2918 help_echo_string = previous_help_echo_string;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2919
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2920 /* If the contents of the global variable help_echo_string
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2921 has changed, generate a HELP_EVENT. */
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2922 if (!NILP (help_echo_string)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2923 || !NILP (previous_help_echo_string))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2924 do_help = 1;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2925
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2926 goto done;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2927 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2928 else {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2929 f->mouse_moved = 0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2930 term_mouse_click (&ie, event, f);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2931 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2932
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2933 done:
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2934 if (ie.kind != NO_EVENT)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2935 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2936 kbd_buffer_store_event_hold (&ie, hold_quit);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2937 count++;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2938 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2939
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2940 if (do_help
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2941 && !(hold_quit && hold_quit->kind != NO_EVENT))
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2942 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2943 Lisp_Object frame;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2944
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2945 if (f)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2946 XSETFRAME (frame, f);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2947 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2948 frame = Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2949
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2950 gen_help_event (help_echo_string, frame, help_echo_window,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2951 help_echo_object, help_echo_pos);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2952 count++;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2953 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2954
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2955 return count;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2956 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2957
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2958 DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2959 0, 0, 0,
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2960 doc: /* Open a connection to Gpm.
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2961 We only support Gpm on one tty at a time. */)
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2962 ()
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2963 {
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2964 struct frame *f = SELECTED_FRAME ();
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2965 struct tty_display_info *tty
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2966 = ((f)->output_method == output_termcap
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2967 ? (f)->terminal->display_info.tty : NULL);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2968 Gpm_Connect connection;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2969
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2970 if (gpm_tty || !tty) /* Already running, or not applicable. */
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2971 return Qnil;
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2972
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2973 connection.eventMask = ~0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2974 connection.defaultMask = ~GPM_HARD;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2975 connection.maxMod = ~0;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2976 connection.minMod = 0;
81127
d620b28641cd (term_mouse_highlight): Remove unused variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 81107
diff changeset
2977 gpm_zerobased = 1;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2978
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2979 if (Gpm_Open (&connection, 0) < 0)
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2980 return Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2981 else
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2982 {
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2983 gpm_tty = tty;
83622
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2984 reset_sys_modes (tty);
0a3247aa24a4 Merged from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 83619 80994
diff changeset
2985 init_sys_modes (tty);
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2986 add_gpm_wait_descriptor (gpm_fd);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2987 return Qt;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2988 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2989 }
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2990
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2991 DEFUN ("term-close-connection", Fterm_close_connection, Sterm_close_connection,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2992 0, 0, 0,
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2993 doc: /* Close a connection to Gpm. */)
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2994 ()
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2995 {
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2996 delete_gpm_wait_descriptor (gpm_fd);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2997 while (Gpm_Close()); /* close all the stack */
84768
53194ec05789 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84692
diff changeset
2998 gpm_tty = NULL;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
2999 return Qnil;
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3000 }
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
3001 #endif /* HAVE_GPM */
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3002
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3003
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3004 /***********************************************************************
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3005 Initialization
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3006 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3007
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3008 /* Initialize the tty-dependent part of frame F. The frame must
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3009 already have its device initialized. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3010
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
3011 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3012 create_tty_output (struct frame *f)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3013 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3014 struct tty_output *t;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3015
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3016 if (! FRAME_TERMCAP_P (f))
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3017 abort ();
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3018
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3019 t = xmalloc (sizeof (struct tty_output));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3020 bzero (t, sizeof (struct tty_output));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3021
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3022 t->display_info = FRAME_TERMINAL (f)->display_info.tty;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3023
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3024 f->output_data.tty = t;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3025 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3026
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3027 /* Delete the tty-dependent part of frame F. */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3028
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3029 static void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3030 delete_tty_output (struct frame *f)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3031 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3032 if (! FRAME_TERMCAP_P (f))
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3033 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3034
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3035 xfree (f->output_data.tty);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3036 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3037
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3038
84461
7ec30b352b6e * xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84359
diff changeset
3039 /* Reset the hooks in TERMINAL. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3040
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3041 static void
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3042 clear_tty_hooks (struct terminal *terminal)
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3043 {
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3044 terminal->rif = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3045 terminal->cursor_to_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3046 terminal->raw_cursor_to_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3047 terminal->clear_to_end_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3048 terminal->clear_frame_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3049 terminal->clear_end_of_line_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3050 terminal->ins_del_lines_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3051 terminal->insert_glyphs_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3052 terminal->write_glyphs_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3053 terminal->delete_glyphs_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3054 terminal->ring_bell_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3055 terminal->reset_terminal_modes_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3056 terminal->set_terminal_modes_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3057 terminal->update_begin_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3058 terminal->update_end_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3059 terminal->set_terminal_window_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3060 terminal->mouse_position_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3061 terminal->frame_rehighlight_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3062 terminal->frame_raise_lower_hook = 0;
83548
c71725faff1a Merged from emacs@sv.gnu.org. Last-minute emacsclient rewrites be damned!
Karoly Lorentey <lorentey@elte.hu>
parents: 83525 73864
diff changeset
3063 terminal->fullscreen_hook = 0;
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3064 terminal->set_vertical_scroll_bar_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3065 terminal->condemn_scroll_bars_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3066 terminal->redeem_scroll_bar_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3067 terminal->judge_scroll_bars_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3068 terminal->read_socket_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3069 terminal->frame_up_to_date_hook = 0;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3070
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3071 /* Leave these two set, or suspended frames are not deleted
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3072 correctly. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3073 terminal->delete_frame_hook = &delete_tty_output;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3074 terminal->delete_terminal_hook = &delete_tty;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3075 }
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3076
84461
7ec30b352b6e * xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84359
diff changeset
3077 /* Initialize hooks in TERMINAL with the values needed for a tty. */
7ec30b352b6e * xterm.c (x_create_terminal): Add comment.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84359
diff changeset
3078
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3079 static void
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3080 set_tty_hooks (struct terminal *terminal)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3081 {
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3082 terminal->rif = 0; /* ttys don't support window-based redisplay. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3083
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3084 terminal->cursor_to_hook = &tty_cursor_to;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3085 terminal->raw_cursor_to_hook = &tty_raw_cursor_to;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3086
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3087 terminal->clear_to_end_hook = &tty_clear_to_end;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3088 terminal->clear_frame_hook = &tty_clear_frame;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3089 terminal->clear_end_of_line_hook = &tty_clear_end_of_line;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3090
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3091 terminal->ins_del_lines_hook = &tty_ins_del_lines;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3092
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3093 terminal->insert_glyphs_hook = &tty_insert_glyphs;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3094 terminal->write_glyphs_hook = &tty_write_glyphs;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3095 terminal->delete_glyphs_hook = &tty_delete_glyphs;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3096
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3097 terminal->ring_bell_hook = &tty_ring_bell;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3098
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3099 terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3100 terminal->set_terminal_modes_hook = &tty_set_terminal_modes;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3101 terminal->update_begin_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3102 terminal->update_end_hook = &tty_update_end;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3103 terminal->set_terminal_window_hook = &tty_set_terminal_window;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3104
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3105 terminal->mouse_position_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3106 terminal->frame_rehighlight_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3107 terminal->frame_raise_lower_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3108
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3109 terminal->set_vertical_scroll_bar_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3110 terminal->condemn_scroll_bars_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3111 terminal->redeem_scroll_bar_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3112 terminal->judge_scroll_bars_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3113
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3114 terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3115 terminal->frame_up_to_date_hook = 0; /* Not needed. */
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3116
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3117 terminal->delete_frame_hook = &delete_tty_output;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3118 terminal->delete_terminal_hook = &delete_tty;
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3119 }
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3120
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3121 /* Drop the controlling terminal if fd is the same device. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3122 static void
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3123 dissociate_if_controlling_tty (int fd)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3124 {
83582
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3125 #ifndef WINDOWSNT
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3126 int pgid;
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3127 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3128 if (pgid != -1)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3129 {
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3130 #if defined (USG) && !defined (BSD_PGRPS)
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3131 setpgrp ();
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3132 no_controlling_tty = 1;
84359
b651dc7c54ac * term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83891
diff changeset
3133 #elif defined (CYGWIN)
b651dc7c54ac * term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83891
diff changeset
3134 setsid ();
b651dc7c54ac * term.c (dissociate_if_controlling_tty): Call setsid on CYGWIN.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83891
diff changeset
3135 no_controlling_tty = 1;
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3136 #else
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3137 #ifdef TIOCNOTTY /* Try BSD ioctls. */
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3138 sigblock (sigmask (SIGTTOU));
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3139 fd = emacs_open (DEV_TTY, O_RDWR, 0);
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3140 if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3141 {
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3142 no_controlling_tty = 1;
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3143 }
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3144 if (fd != -1)
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3145 emacs_close (fd);
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3146 sigunblock (sigmask (SIGTTOU));
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3147 #else
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3148 /* Unknown system. */
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3149 croak ();
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
3150 #endif /* ! TIOCNOTTY */
83158
f948c9fd910c Fix parse error in term.c (ARISAWA Akihiro).
Karoly Lorentey <lorentey@elte.hu>
parents: 83154
diff changeset
3151 #endif /* ! USG */
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3152 }
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3153 #endif /* !WINDOWSNT */
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3154 }
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3155
83338
5f293f92f85e Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83332
diff changeset
3156 static void maybe_fatal();
5f293f92f85e Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83332
diff changeset
3157
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3158 /* 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
3159 type.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3160
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3161 If NAME is NULL, then use the controlling tty, i.e., "/dev/tty".
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3162 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
3163 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
3164
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3165 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
3166
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3167 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
3168
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3169 struct terminal *
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
3170 init_tty (char *name, char *terminal_type, int must_succeed)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3171 {
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3172 char *area = NULL;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3173 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
3174 char *buffer = NULL;
52314
529dd59ee898 (term_init): Remove `const' from buffer_size's declaration.
Eli Zaretskii <eliz@gnu.org>
parents: 52294
diff changeset
3175 int buffer_size = 4096;
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3176 register char *p = NULL;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3177 int status;
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3178 struct tty_display_info *tty = NULL;
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3179 struct terminal *terminal = NULL;
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3180 int ctty = 0; /* 1 if asked to open controlling tty. */
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3181
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3182 if (!terminal_type)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3183 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
3184 "Unknown terminal type",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3185 "Unknown terminal type");
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
3186
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3187 if (name == NULL)
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3188 name = DEV_TTY;
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3189 if (!strcmp (name, DEV_TTY))
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3190 ctty = 1;
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3191
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3192 /* If we already have a terminal on the given device, use that. If
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3193 all such terminals are suspended, create a new one instead. */
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
3194 /* XXX Perhaps this should be made explicit by having init_tty
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3195 always create a new terminal and separating terminal and frame
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
3196 creation on Lisp level. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3197 terminal = get_named_tty (name);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3198 if (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3199 return terminal;
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3200
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3201 terminal = create_terminal ();
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3202 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
3203 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
3204 tty->next = tty_list;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3205 tty_list = tty;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3206
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3207 terminal->type = output_termcap;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3208 terminal->display_info.tty = tty;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3209 tty->terminal = terminal;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3210
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
3211 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
3212 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
3213
83616
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83582
diff changeset
3214 #ifndef WINDOWSNT
83521
40a5d8a15056 Fix crashes in redisplay functions on suspended tty frames. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83512
diff changeset
3215 set_tty_hooks (terminal);
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3216
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3217 {
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3218 int fd;
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3219 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
3220
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
3221 #ifdef O_IGNORE_CTTY
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3222 if (!ctty)
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
3223 /* 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
3224 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
3225 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
3226 fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0);
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3227 else
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
3228 #else
83074
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
3229 /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3230 defined on Hurd. On other systems, we need to explicitly
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3231 dissociate ourselves from the controlling tty when we want to
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3232 open a 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
3233 fd = emacs_open (name, O_RDWR | 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
3234 #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
3235
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3236 if (fd < 0)
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3237 maybe_fatal (must_succeed, buffer, terminal,
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3238 "Could not open file: %s",
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3239 "Could not open file: %s",
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3240 name);
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3241 if (!isatty (fd))
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3242 {
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3243 close (fd);
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3244 maybe_fatal (must_succeed, buffer, terminal,
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3245 "Not a tty device: %s",
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3246 "Not a tty device: %s",
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3247 name);
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3248 }
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3249
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3250 #ifndef O_IGNORE_CTTY
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3251 if (!ctty)
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3252 dissociate_if_controlling_tty (fd);
83498
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3253 #endif
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3254
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3255 file = fdopen (fd, "w+");
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3256 tty->name = xstrdup (name);
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3257 terminal->name = xstrdup (name);
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3258 tty->input = file;
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3259 tty->output = file;
f0987e2f27e2 Clean up tty device handling. Change name of controlling tty from nil to "/dev/tty".
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
3260 }
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3261
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3262 tty->type = xstrdup (terminal_type);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3263
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3264 add_keyboard_wait_descriptor (fileno (tty->input));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3265
83616
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83582
diff changeset
3266 #endif
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3267
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
3268 encode_terminal_bufsize = 0;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
3269
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
3270 #ifdef HAVE_GPM
83630
28201311b297 * term.c (init_tty): Use terminal specific mouse_position_hook.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83629
diff changeset
3271 terminal->mouse_position_hook = term_mouse_position;
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
3272 Qmouse_face_window = Qnil;
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3273 #endif
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3274
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3275 #ifdef WINDOWSNT
83883
cbc88cef4fca (init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents: 83875
diff changeset
3276 initialize_w32_display (terminal);
83889
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3277 /* The following two are inaccessible from w32console.c. */
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3278 terminal->delete_frame_hook = &delete_tty_output;
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3279 terminal->delete_terminal_hook = &delete_tty;
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3280
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3281 tty->name = xstrdup (name);
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3282 terminal->name = xstrdup (name);
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3283 tty->type = xstrdup (terminal_type);
83616
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83582
diff changeset
3284
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83582
diff changeset
3285 tty->output = stdout;
83889
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3286 tty->input = stdin;
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3287 add_keyboard_wait_descriptor (0);
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3288
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3289 Wcm_clear (tty);
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3290
83582
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3291 {
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3292 struct frame *f = XFRAME (selected_frame);
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3293
83889
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3294 FrameRows (tty) = FRAME_LINES (f);
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3295 FrameCols (tty) = FRAME_COLS (f);
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3296 tty->specified_window = FRAME_LINES (f);
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3297
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3298 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
2855c55ba18b (init_tty) [WINDOWSNT]: Add hooks that are not accessible
Jason Rumney <jasonr@gnu.org>
parents: 83883
diff changeset
3299 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
83582
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3300 }
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3301 tty->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
3302
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3303 UseTabs (tty) = 0;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3304 terminal->scroll_region_ok = 0;
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
3305
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
3306 /* Seems to insert lines when it's not supposed to, messing up the
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3307 display. In doing a trace, it didn't seem to be called much, so I
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
3308 don't think we're losing anything by turning it off. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3309 terminal->line_ins_del_ok = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3310 terminal->char_ins_del_ok = 1;
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3311
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3312 baud_rate = 19200;
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3313
83582
a6ca8e4443e4 (dissociate_if_controlling_tty) [WINDOWSNT]: Don't define function body.
Jason Rumney <jasonr@gnu.org>
parents: 83560
diff changeset
3314 tty->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
3315
21827
87c7f4bd99da Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents: 21624
diff changeset
3316 #else /* not WINDOWSNT */
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
3317
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3318 Wcm_clear (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3319
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
3320 buffer = (char *) xmalloc (buffer_size);
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3321
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3322 /* 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
3323 terminal. */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
3324 sigblock (sigmask (SIGTTOU));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3325 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
3326 sigunblock (sigmask (SIGTTOU));
84779
67e430e38471 (DEV_TTY): New macro. Provide a definition for MS-Windows.
Eli Zaretskii <eliz@gnu.org>
parents: 84769
diff changeset
3327
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3328 if (status < 0)
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3329 {
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3330 #ifdef TERMINFO
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3331 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3332 "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
3333 "Cannot open terminfo database file");
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3334 #else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3335 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3336 "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
3337 "Cannot open termcap database file");
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3338 #endif
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3339 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3340 if (status == 0)
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3341 {
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3342 #ifdef TERMINFO
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3343 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3344 "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
3345 "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
3346 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
3347 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
3348 `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
3349 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
3350 terminal_type);
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3351 #else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3352 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3353 "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
3354 "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
3355 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
3356 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
3357 `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
3358 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
3359 terminal_type);
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3360 #endif
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
3361 }
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
3362
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
3363 #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
3364 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
3365 abort ();
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
3366 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
3367 #endif
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
3368 area = (char *) xmalloc (buffer_size);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3369
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3370 tty->TS_ins_line = tgetstr ("al", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3371 tty->TS_ins_multi_lines = tgetstr ("AL", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3372 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
3373 BackTab (tty) = tgetstr ("bt", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3374 tty->TS_clr_to_bottom = tgetstr ("cd", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3375 tty->TS_clr_line = tgetstr ("ce", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3376 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
3377 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
3378 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
3379 CR (tty) = tgetstr ("cr", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3380 tty->TS_set_scroll_region = tgetstr ("cs", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3381 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
3382 RowPosition (tty) = tgetstr ("cv", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3383 tty->TS_del_char = tgetstr ("dc", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3384 tty->TS_del_multi_chars = tgetstr ("DC", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3385 tty->TS_del_line = tgetstr ("dl", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3386 tty->TS_del_multi_lines = tgetstr ("DL", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3387 tty->TS_delete_mode = tgetstr ("dm", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3388 tty->TS_end_delete_mode = tgetstr ("ed", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3389 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
3390 Home (tty) = tgetstr ("ho", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3391 tty->TS_ins_char = tgetstr ("ic", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3392 tty->TS_ins_multi_chars = tgetstr ("IC", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3393 tty->TS_insert_mode = tgetstr ("im", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3394 tty->TS_pad_inserted_char = tgetstr ("ip", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3395 tty->TS_end_keypad_mode = tgetstr ("ke", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3396 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
3397 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
3398 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
3399 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
3400 if (!Down (tty))
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3401 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3402 #ifdef VMS
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3403 /* VMS puts a carriage return before each linefeed,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3404 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
3405 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
3406 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3407 #endif /* VMS */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3408 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
3409 Left (tty) = "\b"; /* can't possibly be longer! */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3410 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
3411 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
3412 if (!Left (tty))
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3413 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
3414 tty->TS_pad_char = tgetstr ("pc", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3415 tty->TS_repeat = tgetstr ("rp", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3416 tty->TS_end_standout_mode = tgetstr ("se", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3417 tty->TS_fwd_scroll = tgetstr ("sf", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3418 tty->TS_standout_mode = tgetstr ("so", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3419 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
3420 tty->Wcm->cm_tab = tgetstr ("ta", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3421 tty->TS_end_termcap_modes = tgetstr ("te", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3422 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
3423 Up (tty) = tgetstr ("up", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3424 tty->TS_visible_bell = tgetstr ("vb", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3425 tty->TS_cursor_normal = tgetstr ("ve", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3426 tty->TS_cursor_visible = tgetstr ("vs", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3427 tty->TS_cursor_invisible = tgetstr ("vi", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3428 tty->TS_set_window = tgetstr ("wi", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3429
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3430 tty->TS_enter_underline_mode = tgetstr ("us", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3431 tty->TS_exit_underline_mode = tgetstr ("ue", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3432 tty->TS_enter_bold_mode = tgetstr ("md", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3433 tty->TS_enter_dim_mode = tgetstr ("mh", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3434 tty->TS_enter_blink_mode = tgetstr ("mb", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3435 tty->TS_enter_reverse_mode = tgetstr ("mr", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3436 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
3437 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
3438 tty->TS_exit_attribute_mode = tgetstr ("me", address);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
3439
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3440 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
3441 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
3442 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
3443 MultiRight (tty) = tgetstr ("RI", address);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3444
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
3445 /* 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
3446 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
3447 background. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3448 tty->TS_orig_pair = tgetstr ("op", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3449 if (tty->TS_orig_pair)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3450 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3451 tty->TS_set_foreground = tgetstr ("AF", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3452 tty->TS_set_background = tgetstr ("AB", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3453 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
3454 {
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
3455 /* SVr4. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3456 tty->TS_set_foreground = tgetstr ("Sf", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3457 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
3458 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
3459
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3460 tty->TN_max_colors = tgetnum ("Co");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3461 tty->TN_max_pairs = tgetnum ("pa");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3462
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3463 tty->TN_no_color_video = tgetnum ("NC");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3464 if (tty->TN_no_color_video == -1)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3465 tty->TN_no_color_video = 0;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3466 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3467
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3468 tty_default_color_capabilities (tty, 1);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
3469
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3470 MagicWrap (tty) = tgetflag ("xn");
11530
a265aaa699e0 (term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
3471 /* 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
3472 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
3473 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3474 terminal->memory_below_frame = tgetflag ("db");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3475 tty->TF_hazeltine = tgetflag ("hz");
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3476 terminal->must_write_spaces = tgetflag ("in");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3477 tty->meta_key = tgetflag ("km") || tgetflag ("MT");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3478 tty->TF_insmode_motion = tgetflag ("mi");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3479 tty->TF_standout_motion = tgetflag ("ms");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3480 tty->TF_underscore = tgetflag ("ul");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3481 tty->TF_teleray = tgetflag ("xt");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3482
83883
cbc88cef4fca (init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents: 83875
diff changeset
3483 #endif /* !WINDOWSNT */
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
3484 #ifdef MULTI_KBOARD
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3485 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3486 init_kboard (terminal->kboard);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3487 terminal->kboard->next_kboard = all_kboards;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3488 all_kboards = terminal->kboard;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3489 terminal->kboard->reference_count++;
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
3490 /* Don't let the initial kboard remain current longer than necessary.
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
3491 That would cause problems if a file loaded on startup tries to
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
3492 prompt in the mini-buffer. */
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
3493 if (current_kboard == initial_kboard)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3494 current_kboard = terminal->kboard;
83883
cbc88cef4fca (init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents: 83875
diff changeset
3495 #ifndef WINDOWSNT
83619
5da6a46ddbd6 * s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83616
diff changeset
3496 term_get_fkeys (address, terminal->kboard);
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
3497 #endif
83883
cbc88cef4fca (init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents: 83875
diff changeset
3498 #endif
cbc88cef4fca (init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents: 83875
diff changeset
3499
cbc88cef4fca (init_tty) [WINDOWSNT]: Pass terminal to
Jason Rumney <jasonr@gnu.org>
parents: 83875
diff changeset
3500 #ifndef WINDOWSNT
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
3501 /* 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
3502 {
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
3503 int height, width;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3504 get_tty_size (fileno (tty->input), &width, &height);
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3505 FrameCols (tty) = width;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3506 FrameRows (tty) = height;
16093
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
3507 }
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
3508
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3509 if (FrameCols (tty) <= 0)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3510 FrameCols (tty) = tgetnum ("co");
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3511 if (FrameRows (tty) <= 0)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3512 FrameRows (tty) = tgetnum ("li");
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3513
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3514 if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3515 maybe_fatal (must_succeed, NULL, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3516 "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
3517 "Screen size %dx%d is too small",
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3518 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
3519
53225
4250e7e26247 Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents: 52681
diff changeset
3520 #if 0 /* This is not used anywhere. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3521 tty->terminal->min_padding_speed = tgetnum ("pb");
53225
4250e7e26247 Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents: 52681
diff changeset
3522 #endif
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3523
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3524 TabWidth (tty) = tgetnum ("tw");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3525
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3526 #ifdef VMS
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3527 /* These capabilities commonly use ^J.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3528 I don't know why, but sending them on VMS does not work;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3529 it causes following spaces to be lost, sometimes.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3530 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
3531 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
3532 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3533 #endif /* VMS */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3534
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3535 if (!tty->TS_bell)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3536 tty->TS_bell = "\07";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3537
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3538 if (!tty->TS_fwd_scroll)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3539 tty->TS_fwd_scroll = Down (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3540
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3541 PC = tty->TS_pad_char ? *tty->TS_pad_char : 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3542
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3543 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
3544 TabWidth (tty) = 8;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
3545
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3546 /* Turned off since /etc/termcap seems to have :ta= for most terminals
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3547 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
3548 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
3549 tty->Wcm->cm_tab = "\t";
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3550 */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3551
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
3552 /* 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
3553 turn off any that do. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3554 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
3555 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3556 tty->TS_standout_mode = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3557 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
3558 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3559 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
3560 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3561 tty->TS_enter_underline_mode = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3562 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
3563 }
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
3564
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
3565 /* 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
3566 if (tty->TS_standout_mode == 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3567 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3568 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
3569 tty->TS_end_standout_mode = tty->TS_exit_underline_mode;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3570 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3571
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
3572 /* 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
3573 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
3574 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
3575 {
8612
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
3576 char *s = tgetstr ("me", address);
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
3577 if (s != 0)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3578 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
3579 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3580 tty->TS_standout_mode = 0;
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
3581 }
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
3582
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3583 if (tty->TF_teleray)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3584 {
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3585 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
3586 /* 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
3587 tty->TS_standout_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3588 /* 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
3589 CR (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3590 /* LF can't be trusted either -- can alter hpos */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3591 /* 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
3592 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3593 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3594
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3595 /* Special handling for certain terminal types known to need it */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3596
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3597 if (!strcmp (terminal_type, "supdup"))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3598 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3599 terminal->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
3600 tty->Wcm->cm_losewrap = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3601 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3602 if (!strncmp (terminal_type, "c10", 3)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3603 || !strcmp (terminal_type, "perq"))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3604 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3605 /* Supply a makeshift :wi string.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3606 This string is not valid in general since it works only
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3607 for windows starting at the upper left corner;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3608 but that is all Emacs uses.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3609
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
3610 This string works only if the frame is using
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3611 the top of the video memory, because addressing is memory-relative.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3612 So first check the :ti string to see if that is true.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3613
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3614 It would be simpler if the :wi string could go in the termcap
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3615 entry, but it can't because it is not fully valid.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3616 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
3617 if (!tty->TS_set_window)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3618 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3619 p = tty->TS_termcap_modes;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3620 while (*p && strcmp (p, "\033v "))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3621 p++;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3622 if (*p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3623 tty->TS_set_window = "\033v%C %C %C %C ";
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3624 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3625 /* Termcap entry often fails to have :in: flag */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3626 terminal->must_write_spaces = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3627 /* :ti string typically fails to have \E^G! in it */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3628 /* 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
3629 strcpy (area, tty->TS_termcap_modes);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3630 strcat (area, "\033\007!");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3631 tty->TS_termcap_modes = area;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3632 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
3633 p = AbsPosition (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3634 /* Change all %+ parameters to %C, to handle
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3635 values above 96 correctly for the C100. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3636 while (*p)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3637 {
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3638 if (p[0] == '%' && p[1] == '+')
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3639 p[1] = 'C';
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3640 p++;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3641 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3642 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3643
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3644 tty->specified_window = FrameRows (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3645
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
3646 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
3647 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3648 maybe_fatal (must_succeed, NULL, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3649 "Terminal type \"%s\" is not powerful enough to run Emacs",
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3650 #ifdef VMS
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3651 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3652 It lacks the ability to position the cursor.\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3653 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
3654 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
3655 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
3656 #else /* not VMS */
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
3657 # ifdef TERMINFO
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3658 "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
3659 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
3660 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
3661 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
3662 `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
3663 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
3664 # else /* TERMCAP */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3665 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3666 It lacks the ability to position the cursor.\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3667 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
3668 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
3669 `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
3670 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
3671 # endif /* TERMINFO */
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
3672 #endif /*VMS */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3673 terminal_type);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3674 }
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3675
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3676 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3677 maybe_fatal (must_succeed, NULL, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3678 "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
3679 "Could not determine the frame size");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3680
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3681 tty->delete_in_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3682 = tty->TS_delete_mode && tty->TS_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3683 && !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
3684
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3685 tty->se_is_so = (tty->TS_standout_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3686 && tty->TS_end_standout_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3687 && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3688
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3689 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3690
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3691 terminal->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
3692 = (tty->Wcm->cm_abs
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3693 && (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
3694
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3695 terminal->line_ins_del_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3696 = (((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
3697 && (tty->TS_del_line || tty->TS_del_multi_lines))
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3698 || (terminal->scroll_region_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3699 && tty->TS_fwd_scroll && tty->TS_rev_scroll));
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
3700
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3701 terminal->char_ins_del_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3702 = ((tty->TS_ins_char || tty->TS_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3703 || 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
3704 && (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
3705
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3706 terminal->fast_clear_end_of_line = tty->TS_clr_line != 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3707
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3708 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
3709
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3710 #ifdef AIXHFT
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3711 /* 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
3712 really ugly at times. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3713 terminal->line_ins_del_ok = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3714 terminal->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
3715 #endif
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3716
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3717 /* Don't do this. I think termcap may still need the buffer. */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3718 /* xfree (buffer); */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3719
84849
ba20cee1aec0 (init_tty): Call init_sys_modes on WINDOWSNT also.
Jason Rumney <jasonr@gnu.org>
parents: 84779
diff changeset
3720 #endif /* not WINDOWSNT */
ba20cee1aec0 (init_tty): Call init_sys_modes on WINDOWSNT also.
Jason Rumney <jasonr@gnu.org>
parents: 84779
diff changeset
3721
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3722 /* Init system terminal modes (RAW or CBREAK, etc.). */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3723 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
3724
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3725 return terminal;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3726 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3727
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
3728 /* Auxiliary error-handling function for init_tty.
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3729 Free BUFFER and delete TERMINAL, 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
3730 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
3731
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3732 static void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3733 maybe_fatal (must_succeed, buffer, terminal, str1, str2, arg1, arg2)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3734 int must_succeed;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3735 char *buffer;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3736 struct terminal *terminal;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3737 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
3738 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3739 if (buffer)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3740 xfree (buffer);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3741
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3742 if (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3743 delete_tty (terminal);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3744
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3745 if (must_succeed)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3746 fatal (str2, arg1, arg2);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3747 else
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3748 error (str1, arg1, arg2);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3749
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3750 abort ();
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3751 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3752
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3753 /* VARARGS 1 */
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
3754 void
65795
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
3755 fatal (str, arg1, arg2)
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
3756 char *str, *arg1, *arg2;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3757 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3758 fprintf (stderr, "emacs: ");
65795
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
3759 fprintf (stderr, str, arg1, arg2);
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
3760 fprintf (stderr, "\n");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3761 fflush (stderr);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3762 exit (1);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3763 }
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3764
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3765
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3766
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3767 /* Delete the given tty terminal, closing all frames on it. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
3768
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3769 static void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3770 delete_tty (struct terminal *terminal)
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
3771 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3772 struct tty_display_info *tty;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3773 Lisp_Object tail, frame;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3774 int last_terminal;
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
3775
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3776 /* Protect against recursive calls. Fdelete_frame in
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3777 delete_terminal calls us back when it deletes our last frame. */
84692
0d8dd9a91520 (get_tty_terminal): Don't treat output_initial specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84461
diff changeset
3778 if (!terminal->name)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3779 return;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3780
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3781 if (terminal->type != output_termcap)
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3782 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3783
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3784 tty = terminal->display_info.tty;
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3785
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3786 last_terminal = 1;
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3787 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
3788 {
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3789 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
3790 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
3791 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3792 last_terminal = 0;
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3793 break;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3794 }
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3795 }
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3796 if (last_terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3797 error ("Attempt to delete the sole terminal device with live frames");
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
3798
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3799 if (tty == tty_list)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3800 tty_list = tty->next;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3801 else
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3802 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3803 struct tty_display_info *p;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3804 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
3805 ;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3806
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3807 if (! p)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3808 /* This should not happen. */
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3809 abort ();
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3810
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3811 p->next = tty->next;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3812 tty->next = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3813 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3814
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
3815 /* reset_sys_modes needs a valid device, so this call needs to be
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3816 before delete_terminal. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3817 reset_sys_modes (tty);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
3818
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3819 delete_terminal (terminal);
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3820
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3821 if (tty->name)
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3822 xfree (tty->name);
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3823
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3824 if (tty->type)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3825 xfree (tty->type);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3826
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3827 if (tty->input)
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3828 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3829 delete_keyboard_wait_descriptor (fileno (tty->input));
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3830 if (tty->input != stdin)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3831 fclose (tty->input);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3832 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3833 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
3834 fclose (tty->output);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3835 if (tty->termscript)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3836 fclose (tty->termscript);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3837
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3838 if (tty->old_tty)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3839 xfree (tty->old_tty);
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3840
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
3841 if (tty->Wcm)
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3842 xfree (tty->Wcm);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
3843
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3844 bzero (tty, sizeof (struct tty_display_info));
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3845 xfree (tty);
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
3846 }
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
3847
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3848
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3849
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3850 /* 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
3851 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
3852
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3853 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3854 mark_ttys (void)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3855 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3856 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
3857
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3858 for (tty = tty_list; tty; tty = tty->next)
83762
ffb5395e8445 (mark_ttys): Don't bother checking top_frame (incorrectly)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83653
diff changeset
3859 mark_object (tty->top_frame);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3860 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3861
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3862
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3863
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
3864 void
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3865 syms_of_term ()
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3866 {
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3867 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
3868 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
3869 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
3870 #ifdef TERMINFO
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3871 system_uses_terminfo = 1;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3872 #else
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3873 system_uses_terminfo = 0;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3874 #endif
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
3875
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3876 DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3877 doc: /* Functions to be run after suspending a tty.
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3878 The functions are run with one argument, the terminal id to be suspended.
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3879 See `suspend-tty'. */);
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3880 Vsuspend_tty_functions = Qnil;
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3881
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3882
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3883 DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions,
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3884 doc: /* Functions to be run after resuming a tty.
83525
b2e7507b55c6 Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents: 83522
diff changeset
3885 The functions are run with one argument, the terminal id that was revived.
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3886 See `resume-tty'. */);
83891
dab32bc3edc8 * server.el (server-start, server-unload-hook): Undo previous
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83889
diff changeset
3887 Vresume_tty_functions = Qnil;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3888
67935
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3889 DEFVAR_BOOL ("visible-cursor", &visible_cursor,
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3890 doc: /* Non-nil means to make the cursor very visible.
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3891 This only has an effect when running in a text terminal.
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3892 What means \"very visible\" is up to your terminal. It may make the cursor
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3893 bigger, or it may make it blink, or it may do nothing at all. */);
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3894 visible_cursor = 1;
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3895
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3896 defsubr (&Stty_display_color_p);
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
3897 defsubr (&Stty_display_color_cells);
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
3898 defsubr (&Stty_no_underline);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3899 defsubr (&Stty_type);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3900 defsubr (&Scontrolling_tty_p);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3901 defsubr (&Ssuspend_tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3902 defsubr (&Sresume_tty);
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
3903 #ifdef HAVE_GPM
80979
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3904 defsubr (&Sterm_open_connection);
3d81d0b44577 (write_glyphs_with_face): New function.
Nick Roberts <nickrob@snap.net.nz>
parents: 76627
diff changeset
3905 defsubr (&Sterm_close_connection);
81102
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
3906
a00e7c5f2faa (mouse_face_window): Rename...
Nick Roberts <nickrob@snap.net.nz>
parents: 81083
diff changeset
3907 staticpro (&Qmouse_face_window);
80994
62b6aa7f8c37 Use HAVE_GPM instead of HAVE_GPM_H.
Nick Roberts <nickrob@snap.net.nz>
parents: 80979
diff changeset
3908 #endif /* HAVE_GPM */
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3909 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3910
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3911
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3912
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52314
diff changeset
3913 /* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52314
diff changeset
3914 (do not change this comment) */