annotate src/termhooks.h @ 483:00f564a647fa

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 13 Jan 1992 06:37:58 +0000
parents 1ad871406b12
children 8c615e453683
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Hooks by which low level terminal operations
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 can be made to call other routines.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3 Copyright (C) 1985, 1986 Free Software Foundation, Inc.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 This file is part of GNU Emacs.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 the Free Software Foundation; either version 1, or (at your option)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 any later version.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 extern int (*cursor_to_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 extern int (*raw_cursor_to_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 extern int (*clear_to_end_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 extern int (*clear_screen_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 extern int (*clear_end_of_line_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 extern int (*ins_del_lines_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 extern int (*change_line_highlight_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 extern int (*reassert_line_highlight_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 extern int (*insert_glyphs_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 extern int (*write_glyphs_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 extern int (*delete_glyphs_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 extern int (*ring_bell_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 extern int (*reset_terminal_modes_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 extern int (*set_terminal_modes_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 extern int (*update_begin_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 extern int (*update_end_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 extern int (*set_terminal_window_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 extern int (*read_socket_hook) ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 /* Hook for Emacs to call to tell the window-system-specific code to
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 enable/disable low-level tracking. The value of ENABLE tells the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 window system event handler whether it should notice or ignore
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 subsequent mouse movement and mouse button releases.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 If this is 0, Emacs should assume that there is no mouse (or at
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 least no mouse tracking) available.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 If called with ENABLE non-zero, the window system event handler
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 should call set_pointer_loc with the new mouse co-ordinates
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 whenever the mouse moves, and enqueue a mouse button event for
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 button releases as well as button presses.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 If called with ENABLE zero, the window system event handler should
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 ignore mouse movement events, and not enqueue events for mouse
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 button releases. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 extern int (*mouse_tracking_enable_hook) ( /* int ENABLE */ );
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65
357
1ad871406b12 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
66 /* When a screen's focus redirection is changed, this hook tells the
1ad871406b12 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
67 window system code to re-decide where to put the highlight. Under
1ad871406b12 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
68 X, this means that the system lies about where the focus is. */
1ad871406b12 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
69 extern void (*screen_rehighlight_hook) ( /* void */ );
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
70
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 /* If nonzero, send all terminal output characters to this stream also. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 extern FILE *termscript;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 #ifdef XINT
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 /* Expedient hack: only provide the below definitions to files that
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 are prepared to handle lispy things. XINT is defined iff lisp.h
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 has been included in the file before this file. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 /* The keyboard input buffer is an array of these structures. Each one
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 represents some sort of input event - a keystroke, a mouse click, or
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 a window system event. These get turned into their lispy forms when
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 they are removed from the event queue. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 struct input_event {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 /* What kind of event was this? */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 enum {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 no_event, /* nothing happened. This should never
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 actually appear in the event queue. */
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
91 ascii_keystroke, /* The ASCII code is in .code.
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
92 .screen is the screen in which the key
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
93 was typed.
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
94 Note that this includes meta-keys, and
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
95 the modifiers field of the event
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
96 is unused. */
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
97
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 non_ascii_keystroke, /* .code is a number identifying the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 function key. A code N represents
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 a key whose name is
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 function_key_names[N]; function_key_names
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 is a table in keyboard.c to which you
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 should feel free to add missing keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 .modifiers holds the state of the
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
105 modifier keys.
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
106 .screen is the screen in which the key
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
107 was typed. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 mouse_click, /* The button number is in .code.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 .modifiers holds the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 modifier keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 .x and .y give the mouse position,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 in pixels, within the window.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 .screen gives the screen the mouse
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 click occurred in.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 .timestamp gives a timestamp (in
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 milliseconds) for the click. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 scrollbar_click, /* .code gives the number of the mouse
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 button that was clicked.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 .part is a lisp symbol indicating which
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 part of the scrollbar got clicked. This
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 indicates whether the scroll bar was
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 horizontal or vertical.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 .modifiers gives the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 modifier keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 .x gives the distance from the start
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 of the scroll bar of the click; .y gives
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 the total length of the scroll bar.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 .screen gives the screen the click
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 should apply to.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 .timestamp gives a timestamp (in
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 milliseconds) for the click. */
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
132 #if 0
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 screen_selected, /* The user has moved the focus to another
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 screen.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 .screen is the screen that should become
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 selected at the next convenient time. */
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 296
diff changeset
137 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 } kind;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 Lisp_Object code;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 Lisp_Object part;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 struct screen *screen;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 int modifiers; /* See enum below for interpretation. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 Lisp_Object x, y;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 Lisp_Object timestamp;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 };
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 /* Bits in the modifiers member of the input_event structure. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 enum {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 shift_modifier = 1,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 ctrl_modifier = 2,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 meta_modifier = 4,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 up_modifier = 8, /* This only applies to mouse buttons. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 last_modifier /* This should always be one more than the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 highest modifier bit defined. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 };
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 #define NUM_MODIFIER_COMBOS ((last_modifier-1) << 1)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 #endif