annotate lib-src/emacstool.c @ 78618:090a8fb371a9

Don't use `iff'.
author Glenn Morris <rgm@gnu.org>
date Wed, 22 Aug 2007 16:47:00 +0000
parents 1f2482de3237
children 5714ff101fd9 f55f9811f5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1 /*
75250
6d19c76d81c5 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 68647
diff changeset
2 Copyright (C) 1986, 1988, 1990, 1991, 2001, 2002, 2003, 2004,
6d19c76d81c5 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 68647
diff changeset
3 2005, 2006, 2007 Free Software Foundation, Inc.
6112
ecaa966abd06 *** empty log message ***
David J. MacKenzie <djm@gnu.org>
parents: 6111
diff changeset
4
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
5 This file is part of GNU Emacs.
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
6
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
8 it under the terms of the GNU General Public License as published by
78257
1f2482de3237 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75250
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
10 any later version.
6111
617c0b6a50c0 Use GPL.
David J. MacKenzie <djm@gnu.org>
parents: 3591
diff changeset
11
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
15 GNU General Public License for more details.
6111
617c0b6a50c0 Use GPL.
David J. MacKenzie <djm@gnu.org>
parents: 3591
diff changeset
16
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
17 You should have received a copy of the GNU General Public License
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
64083
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
20 Boston, MA 02110-1301, USA. */
6111
617c0b6a50c0 Use GPL.
David J. MacKenzie <djm@gnu.org>
parents: 3591
diff changeset
21
617c0b6a50c0 Use GPL.
David J. MacKenzie <djm@gnu.org>
parents: 3591
diff changeset
22 /*
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
23 * For Emacs in SunView/Sun-Windows: (supported by Sun Unix v3.2 or greater)
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
24 * Insert a notifier filter-function to convert all useful input
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
25 * to "key" sequences that emacs can understand. See: Emacstool(1).
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
26 *
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
27 * Author: Jeff Peck, Sun Microsystems, Inc. <peck@eng.sun.com>
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28 *
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29 * Original Idea: Ian Batten
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
30 * Updated 15-Mar-88, Jeff Peck: set IN_EMACSTOOL, TERM, TERMCAP
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
31 * Updated 10-Sep-88, Jeff Peck: add XVIEW and JLE support
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
32 * Updated 8-Oct-90, Jeff Peck: add Meta-bit for Xview
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
33 * Updated 6-Mar-91, Jeff Peck: Hack to detect -Wt invocation
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
34 * [note, TTYSW limitation means you must Click-To-Type in Openwin]
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
35 * [fixed in OW3 or use local/tty.o]
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
36 * for better results, this should move to using TERMSW.
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
37 * Updated 10-Mar-91, Jeff Peck, et al: support for TERMSW (TTERM)
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
38 * allows point-to-type even in OW2
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
39 *
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
40 * [note: xvetool should be started with the "-nw" flag for emacs!]
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
43 #ifdef XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
44 #include <xview/xview.h>
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
45 #include <xview/panel.h>
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
46 #include <xview/attr.h>
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
47 #include <xview/tty.h>
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
48 #include <xview/ttysw.h> /* private defines */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
49 #include <xview/termsw.h> /* -DTTERM */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
50 #include <xview/font.h> /* for testing */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
51 #else
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 #include <suntool/sunview.h>
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
53 #include <suntool/tty.h>
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
54 #include <suntool/ttysw.h>
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
55 #endif XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
56
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
57 #ifdef JLE
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
58 # include <locale.h>
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
59 #endif JLE
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
60
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 #include <stdio.h>
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62 #include <sys/file.h>
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
64 #define BUFFER_SIZE 128 /* Size of all the buffers */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66 /* define WANT_CAPS_LOCK to make f-key T1 (aka F1) behave as CapsLock */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
67 #define WANT_CAPS_LOCK
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68 #ifdef WANT_CAPS_LOCK
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 287
diff changeset
69 int caps_lock; /* toggle indicator for f-key T1 caps lock */
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
70 static char *Caps = "[CAPS] "; /* Caps Lock prefix string */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
71 #define CAPS_LEN 7 /* strlen (Caps) */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 #endif
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
74 static char *mouse_prefix = "\030\000"; /* C-x C-@ */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75 static int m_prefix_length = 2; /* mouse_prefix length */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
76
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
77 static char *key_prefix = "\030*"; /* C-x * */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
78 static int k_prefix_length = 2; /* key_prefix length */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
79
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
80 #ifdef JLE
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
81 static char *emacs_name = "nemacs"; /* default run command */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
82 static char *title = "NEmacstool - "; /* initial title */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
83 #else
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84 static char *emacs_name = "emacs"; /* default run command */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
85 static char *title = "Emacstool - "; /* initial title */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
86 #endif JLE
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
87
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
88 static char buffer[BUFFER_SIZE]; /* send to ttysw_input */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
89 static char *bold_name = 0; /* for -bold option */
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
90
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
91 Frame frame; /* Base frame for system */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
92
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
93 #ifndef TTERM
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
94 #define SWTYPE TTY
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
95 Tty tty_win; /* Where emacs is reading */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
96 #else
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
97 #define SWTYPE TERMSW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
98 Termsw tty_win; /* Termsw does follow-mouse */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
99 #endif TTERM
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
100
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
101 #ifdef XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
102 Xv_Window tty_view; /* Where the events are in Xview*/
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
103 #else
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
104 Tty tty_view; /* SunView place filler */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
105 #endif XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
106
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
107 int font_width, font_height; /* For translating pixels to chars */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
108 int left_margin = 0; /* default window -- frame offset */
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
109
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
110 int console_fd = 0; /* for debugging: setenv DEBUGEMACSTOOL */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
111 FILE *console; /* for debugging: setenv DEBUGEMACSTOOL */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
112
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
113 Icon frame_icon;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
114 /* make an icon_image for the default frame_icon */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
115 static short default_image[258] =
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
116 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
117 #include <images/terminal.icon>
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
118 };
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
119 mpr_static(icon_image, 64, 64, 1, default_image);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
120
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
121 /*
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
122 * Assign a value to a set of keys
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
123 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
124 int
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
125 button_value (event)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
126 Event *event;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
127 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
128 int retval = 0;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
129 /*
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
130 * Code up the current situation:
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
131 *
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
132 * 1 = MS_LEFT;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 * 2 = MS_MIDDLE;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
134 * 4 = MS_RIGHT;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
135 * 8 = SHIFT;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
136 * 16 = CONTROL;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
137 * 32 = META;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
138 * 64 = DOUBLE;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
139 * 128 = UP;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
140 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
141
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
142 if (MS_LEFT == (event_id (event))) retval = 1;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
143 if (MS_MIDDLE == (event_id (event))) retval = 2;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
144 if (MS_RIGHT == (event_id (event))) retval = 4;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
145
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
146 if (event_shift_is_down (event)) retval += 8;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
147 if (event_ctrl_is_down (event)) retval += 16;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148 if (event_meta_is_down (event)) retval += 32;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
149 if (event_is_up (event)) retval += 128;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
150 return retval;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
151 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
152
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
153 /*
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154 * Variables to store the time of the previous mouse event that was
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
155 * sent to emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156 *
14036
621a575db6f7 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 6112
diff changeset
157 * The theory is that to time double clicks while ignoring UP buttons,
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 * we must keep track of the accumulated time.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 *
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160 * If someone writes a SUN-SET-INPUT-MASK for emacstool,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
161 * That could be used to selectively disable UP events,
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 * and then this cruft wouldn't be necessary.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164 static long prev_event_sec = 0;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 static long prev_event_usec = 0;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167 /*
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
168 * Give the time difference in milliseconds, where one second
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
169 * is considered infinite.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
170 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 int
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
172 time_delta (now_sec, now_usec, prev_sec, prev_usec)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
173 long now_sec, now_usec, prev_sec, prev_usec;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
174 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
175 long sec_delta = now_sec - prev_sec;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
176 long usec_delta = now_usec - prev_usec;
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
177
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
178 if (usec_delta < 0) { /* "borrow" a second */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
179 usec_delta += 1000000;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
180 --sec_delta;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
181 }
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
182
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
183 if (sec_delta >= 10)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
184 return (9999); /* Infinity */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
185 else
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
186 return ((sec_delta * 1000) + (usec_delta / 1000));
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
187 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
188
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
189
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
190 /*
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
191 * Filter function to translate selected input events for emacs
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
192 * Mouse button events become ^X^@(button x-col y-line time-delta) .
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42411
diff changeset
193 * Function keys: ESC-*{c}{lrt} l,r,t for Left, Right, Top;
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
194 * {c} encodes the keynumber as a character [a-o]
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
195 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
196 static Notify_value
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
197 input_event_filter_function (window, event, arg, type)
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
198 #ifdef XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
199 Xv_Window window;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
200 #else
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
201 Window window;
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
202 #endif XVIEW
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
203 Event *event;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
204 Notify_arg arg;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
205 Notify_event_type type;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
206 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
207 struct timeval time_stamp;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
208
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
209 if (console_fd) fprintf(console, "Event: %d\n", event_id(event));
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
210
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
211 /* UP L1 is the STOP key */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
212 if (event_id(event) == WIN_STOP) {
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
213 ttysw_input(tty_win, "\007\007\007\007\007\007\007", 7);
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
214 return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
215 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
216
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
217 /* UP L5 & L7 is Expose & Open, let them pass to sunview */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
218 if (event_id(event) == KEY_LEFT(5) || event_id(event) == KEY_LEFT(7))
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
219 if(event_is_up (event))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
220 return notify_next_event_func (window, event, arg, type);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
221 else return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
222
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
223 if (event_is_button (event)) { /* do Mouse Button events */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
224 /* Commented out so that we send mouse up events too.
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
225 if (event_is_up (event))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
226 return notify_next_event_func (window, event, arg, type);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
227 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
228 time_stamp = event_time (event);
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
229 ttysw_input (tty_win, mouse_prefix, m_prefix_length);
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
230 sprintf (buffer, "(%d %d %d %d)\015",
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
231 button_value (event),
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
232 (event_x (event) - left_margin) / font_width,
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
233 event_y (event) / font_height,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
234 time_delta (time_stamp.tv_sec, time_stamp.tv_usec,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
235 prev_event_sec, prev_event_usec)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
236 );
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
237 ttysw_input (tty_win, buffer, strlen(buffer));
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
238 prev_event_sec = time_stamp.tv_sec;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
239 prev_event_usec = time_stamp.tv_usec;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
240 return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
241 }
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
242
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
243 { /* Do the function key events */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
244 int d;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
245 char c = (char) 0;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
246 if ((event_is_key_left (event)) ?
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
247 ((d = event_id(event) - KEY_LEFT(1) + 'a'), c='l') :
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
248 ((event_is_key_right (event)) ?
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
249 ((d = event_id(event) - KEY_RIGHT(1) + 'a'), c='r') :
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
250 ((event_is_key_top (event)) ?
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
251 ((d = event_id(event) - KEY_TOP(1) + 'a'), c='t') : 0)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
252 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
253 if (event_is_up(event)) return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
254 if (event_shift_is_down (event)) c = c - 32;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
255 /* this will give a non-{lrt} for unshifted keys */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
256 if (event_ctrl_is_down (event)) c = c - 64;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
257 if (event_meta_is_down (event)) c = c + 128;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
258 #ifdef WANT_CAPS_LOCK
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
259 /* set a toggle and relabel window so T1 can act like caps-lock */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
260 if (event_id(event) == KEY_TOP(1))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
261 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
262 /* make a frame label with and without CAPS */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
263 strcpy (buffer, Caps);
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
264 title = &buffer[CAPS_LEN];
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
265 strncpy (title, (char *)window_get (frame, FRAME_LABEL),
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
266 BUFFER_SIZE - CAPS_LEN);
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
267 buffer[BUFFER_SIZE] = (char) 0;
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
268 if (strncmp (title, Caps, CAPS_LEN) == 0)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
269 title += CAPS_LEN; /* already Caps */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
270 caps_lock = (caps_lock ? 0 : CAPS_LEN);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
271 window_set(frame, FRAME_LABEL, (title -= caps_lock), 0);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
272 return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
273 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
274 #endif
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
275 ttysw_input (tty_win, key_prefix, k_prefix_length);
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
276 sprintf (buffer, "%c%c", d, c);
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
277 ttysw_input(tty_win, buffer, strlen(buffer));
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
278
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
279 return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
280 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
281 }
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
282 if ((event_is_ascii(event) || event_is_meta(event))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
283 && event_is_up(event)) return NOTIFY_IGNORED;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
284 #ifdef WANT_CAPS_LOCK
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
285 /* shift alpha chars to upper case if toggle is set */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
286 if ((caps_lock) && event_is_ascii(event)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
287 && (event_id(event) >= 'a') && (event_id(event) <= 'z'))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
288 event_set_id(event, (event_id(event) - 32));
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
289 /* crufty, but it works for now. is there an UPCASE(event)? */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
290 #endif
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
291 #ifndef NO_META_BIT
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
292 /* under Openwindows/X, the meta bit is not set in the key event,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
293 * emacs expects this so we add it in here:
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
294 */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
295 if (event_is_ascii(event) && event_meta_is_down(event))
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
296 event_set_id(event, 128 | event_id(event));
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
297 #endif
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
298 return notify_next_event_func (window, event, arg, type);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
299 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
300
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
301 main (argc, argv)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
302 int argc;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
303 char **argv;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
304 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
305 int error_code; /* Error codes */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
306
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
307 #ifdef JLE
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
308 setlocale(LC_ALL, "");
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
309 #endif JLE
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
310
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
311 if(getenv("DEBUGEMACSTOOL"))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
312 console = fdopen (console_fd = open("/dev/console",O_WRONLY), "w");
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
313
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
314 putenv("IN_EMACSTOOL=t"); /* notify subprocess that it is in emacstool */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
315
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
316 if (putenv("TERM=sun") != 0) /* TTY_WIN will be a TERM=sun window */
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
317 {fprintf (stderr, "%s: Could not set TERM=sun, using `%s'\n",
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
318 argv[0], (char *)getenv("TERM")) ;};
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
319 /*
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
320 * If TERMCAP starts with a slash, it is the pathname of the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
321 * termcap file, not an entry extracted from it, so KEEP it!
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
322 * Otherwise, it may not relate to the new TERM, so Nuke-It.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
323 * If there is no TERMCAP environment variable, don't make one.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
324 */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
325 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
326 char *termcap ; /* Current TERMCAP value */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
327 termcap = (char *)getenv("TERMCAP") ;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
328 if (termcap && (*termcap != '/'))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
329 {
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
330 if (putenv("TERMCAP=") != 0)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
331 {fprintf (stderr, "%s: Could not clear TERMCAP\n", argv[0]) ;} ;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
332 } ;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
333 } ;
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
334
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
335 /* find command to run as subprocess in window */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
336 if (!(argv[0] = (char *)getenv("EMACSTOOL"))) /* Set emacs command name */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
337 argv[0] = emacs_name;
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
338 /* Emacstool recognizes two special args: -rc <file> and -bold <bold-name> */
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
339 for (argc = 1; argv[argc]; argc++) /* Use last one on line */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
340 {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
341 if(!(strcmp ("-rc", argv[argc]))) /* Override if -rc given */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
342 {int i = argc;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
343 argv[argc--]=0; /* kill the -rc argument */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
344 if (argv[i+1]) { /* move to argv[0] and squeeze the rest */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
345 argv[0]=argv[i+1];
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
346 for (; argv[i+2]; (argv[i]=argv[i+2],argv[++i]=0));
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
347 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
348 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
349
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
350 if (!(strcmp ("-bold", argv[argc])))
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
351 {int i = argc;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
352 argv[argc--]=0; /* kill the -bold argument */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
353 if (argv[i+1]) { /* move to bold_name and squeeze the rest */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
354 bold_name = argv[i+1];
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
355 for (; argv[i+2]; (argv[i]=argv[i+2],argv[++i]=0));
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
356 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
357 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
358 };
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
359
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
360 strcpy (buffer, title);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
361 strncat (buffer, argv[0], /* append run command name */
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
362 (BUFFER_SIZE - (strlen (buffer)) - (strlen (argv[0]))) - 1);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
363
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
364 error_code = interpose_on_window(argc,argv);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
365 if (error_code != 0) { /* Barf */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
366 fprintf (stderr, "notify_interpose_event_func returns %d.\n", error_code);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
367 exit (1);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
368 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
369
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
370 #ifdef XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
371 xv_main_loop (frame); /* And away we go */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
372 #else
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
373 window_main_loop (frame);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
374 #endif XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
375 }
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
376
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
377 #ifdef XVIEW
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
378 int interpose_on_window(argc,argv)
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
379 int argc;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
380 char **argv;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
381 {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
382 #ifndef TTERM
14036
621a575db6f7 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 6112
diff changeset
383 int i, font_width_adjust = 1; /* hackery, and heuristics */
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
384 /* if -Wt is not supplied, then font comes out as lucida-14 (width=8)
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
385 * rather than the screen.r.12 (width=7) typically used
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
386 * this hack attempts to workaround it.
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
387 * could use a env var EMACSTOOL_DEFAULT_FONT_WIDTH instead */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
388 for (i = 1; argv[i]; i++) {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
389 if (!(strcmp ("-Wt", argv[i])))
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
390 {font_width_adjust = 0;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
391 if (console_fd) fprintf(console, "-Wt = %d\n", font_width_adjust);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
392 break;}
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
393 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
394 #endif TTERM
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
395 /* initialize Xview, and strip window args */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
396 xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
397
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
398 /* do this first, so arglist can override it */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
399 frame_icon = icon_create (ICON_LABEL, "Emacstool",
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
400 ICON_IMAGE, &icon_image,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
401 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
402
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
403 /* Build a frame to run in */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
404 frame = xv_create ((Xv_Window)NULL, FRAME,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
405 FRAME_LABEL, buffer,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
406 FRAME_ICON, frame_icon,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
407 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
408
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
409 /* Create a tty with emacs in it */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
410 tty_win = xv_create (frame, SWTYPE, WIN_IS_CLIENT_PANE,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
411 TTY_QUIT_ON_CHILD_DEATH, TRUE,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
412 TTY_BOLDSTYLE, TTYSW_BOLD_INVERT,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
413 TTY_ARGV, argv,
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
414 0);
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
415
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
416 if (bold_name) {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
417 (void)xv_set(tty_win, TTY_BOLDSTYLE_NAME, bold_name, 0);
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
418 }
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
419
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
420 {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
421 Xv_font font; /* declare temp font variable */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
422 font = (Xv_font)xv_get (tty_win, XV_FONT);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
423 font_height = (int)xv_get (font, FONT_DEFAULT_CHAR_HEIGHT);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
424 font_width = (int)xv_get (font, FONT_DEFAULT_CHAR_WIDTH);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
425 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
426 if (console_fd) fprintf(console, "Width = %d\n", font_width);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
427
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
428 #ifndef TTERM
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
429 font_width -= font_width_adjust; /* A guess! font bug in ttysw*/
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
430 #else
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
431 /* make the termsw act as a tty */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
432 xv_set(tty_win, TERMSW_MODE, TTYSW_MODE_TYPE, 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
433 /* termsw has variable offset depending on scrollbar size/location */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
434 left_margin = (int)xv_get (tty_win, TEXTSW_LEFT_MARGIN);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
435 #endif TTERM
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
436
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
437 tty_view = (Xv_Window) xv_get (tty_win, OPENWIN_NTH_VIEW, 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
438 xv_set(tty_view,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
439 WIN_CONSUME_EVENTS,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
440 WIN_MOUSE_BUTTONS, WIN_UP_EVENTS,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
441 ACTION_ADJUST, ACTION_MENU,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
442 WIN_ASCII_EVENTS,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
443 WIN_LEFT_KEYS, WIN_TOP_KEYS, WIN_RIGHT_KEYS,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
444 0,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
445 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
446 /* Interpose my event function */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
447 return (int) notify_interpose_event_func
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
448 (tty_view, input_event_filter_function, NOTIFY_SAFE);
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
449 }
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
450 #else
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
451 int interpose_on_window (argc, argv)
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
452 int argc;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
453 char **argv;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
454 {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
455 /* do this first, so arglist can override it */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
456 frame_icon = icon_create (ICON_LABEL, "Emacstool",
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
457 ICON_IMAGE, &icon_image,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
458 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
459
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
460 /* Build a frame to run in */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
461 frame = window_create ((Window)NULL, FRAME,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
462 FRAME_LABEL, buffer,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
463 FRAME_ICON, frame_icon,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
464 FRAME_ARGC_PTR_ARGV, &argc, argv,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
465 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
466
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
467 /* Create a tty with emacs in it */
42411
c67f88ae0e05 Remove trailing whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 42180
diff changeset
468 tty_win = window_create (frame, TTY,
c67f88ae0e05 Remove trailing whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 42180
diff changeset
469 TTY_QUIT_ON_CHILD_DEATH, TRUE,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
470 TTY_BOLDSTYLE, TTYSW_BOLD_INVERT,
42411
c67f88ae0e05 Remove trailing whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 42180
diff changeset
471 TTY_ARGV, argv,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
472 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
473
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
474 if (bold_name) {
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
475 (void)window_set(tty_win, TTY_BOLDSTYLE_NAME, bold_name, 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
476 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
477
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
478 /* ttysw uses pf_default, one must set WIN_FONT explicitly */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
479 window_set (tty_win, WIN_FONT, pf_default(), 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
480 font_height = (int)window_get (tty_win, WIN_ROW_HEIGHT);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
481 font_width = (int)window_get (tty_win, WIN_COLUMN_WIDTH);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
482
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
483 tty_view = tty_win;
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
484 window_set(tty_view,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
485 WIN_CONSUME_PICK_EVENTS,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
486 WIN_STOP,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
487 WIN_MOUSE_BUTTONS, WIN_UP_EVENTS,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
488 /* LOC_WINENTER, LOC_WINEXIT, LOC_MOVE, */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
489 0,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
490 WIN_CONSUME_KBD_EVENTS,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
491 WIN_STOP,
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
492 WIN_ASCII_EVENTS,
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
493 WIN_LEFT_KEYS, WIN_TOP_KEYS, WIN_RIGHT_KEYS,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
494 /* WIN_UP_ASCII_EVENTS, */
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
495 0,
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
496 0);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
497 /* Interpose my event function */
42180
35906f73a07d Clean-up whitespaces.
Pavel Janík <Pavel@Janik.cz>
parents: 14186
diff changeset
498 return (int) notify_interpose_event_func
287
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
499 (tty_view, input_event_filter_function, NOTIFY_SAFE);
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
500 }
1616777eaae5 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
501 #endif XVIEW
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
502
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
503 /* arch-tag: 7a2e7105-c059-418a-b3d9-5b5de96abb4e
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
504 (do not change this comment) */