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