annotate src/termhooks.h @ 337:165d128bc864

Initial revision
author Roland McGrath <roland@gnu.org>
date Fri, 19 Jul 1991 14:42:53 +0000
parents 558b874b5259
children 4840aae6a876
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
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 /* If nonzero, send all terminal output characters to this stream also. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 extern FILE *termscript;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 #ifdef XINT
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 /* Expedient hack: only provide the below definitions to files that
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 are prepared to handle lispy things. XINT is defined iff lisp.h
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 has been included in the file before this file. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 /* The keyboard input buffer is an array of these structures. Each one
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 represents some sort of input event - a keystroke, a mouse click, or
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 a window system event. These get turned into their lispy forms when
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 they are removed from the event queue. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 struct input_event {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 /* What kind of event was this? */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 enum {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 no_event, /* nothing happened. This should never
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 actually appear in the event queue. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 ascii_keystroke, /* The ASCII code is in .code. Note that
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 this includes meta-keys, and the modifiers
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 field of the event is unused. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 non_ascii_keystroke, /* .code is a number identifying the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 function key. A code N represents
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 a key whose name is
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 function_key_names[N]; function_key_names
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 is a table in keyboard.c to which you
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 should feel free to add missing keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 .modifiers holds the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 modifier keys. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 mouse_click, /* The button number is in .code.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 .modifiers holds the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 modifier keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 .x and .y give the mouse position,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 in pixels, within the window.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 .screen gives the screen the mouse
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 click occurred in.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 .timestamp gives a timestamp (in
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 milliseconds) for the click. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 scrollbar_click, /* .code gives the number of the mouse
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 button that was clicked.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 .part is a lisp symbol indicating which
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 part of the scrollbar got clicked. This
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 indicates whether the scroll bar was
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 horizontal or vertical.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 .modifiers gives the state of the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 modifier keys.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 .x gives the distance from the start
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 of the scroll bar of the click; .y gives
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 the total length of the scroll bar.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 .screen gives the screen the click
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 should apply to.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 .timestamp gives a timestamp (in
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 milliseconds) for the click. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 screen_selected, /* The user has moved the focus to another
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 screen.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 .screen is the screen that should become
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 selected at the next convenient time. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 } kind;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 Lisp_Object code;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 Lisp_Object part;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 struct screen *screen;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 int modifiers; /* See enum below for interpretation. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 Lisp_Object x, y;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 Lisp_Object timestamp;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 };
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 /* Bits in the modifiers member of the input_event structure. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 enum {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 shift_modifier = 1,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 ctrl_modifier = 2,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 meta_modifier = 4,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 up_modifier = 8, /* This only applies to mouse buttons. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 last_modifier /* This should always be one more than the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 highest modifier bit defined. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 };
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 #define NUM_MODIFIER_COMBOS ((last_modifier-1) << 1)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 #endif