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
48/* Hook for Emacs to call to tell the window-system-specific code to
49 enable/disable low-level tracking. The value of ENABLE tells the
50 window system event handler whether it should notice or ignore
51 subsequent mouse movement and mouse button releases.
52
53 If this is 0, Emacs should assume that there is no mouse (or at
54 least no mouse tracking) available.
55
56 If called with ENABLE non-zero, the window system event handler
57 should call set_pointer_loc with the new mouse co-ordinates
58 whenever the mouse moves, and enqueue a mouse button event for
59 button releases as well as button presses.
60
61 If called with ENABLE zero, the window system event handler should
62 ignore mouse movement events, and not enqueue events for mouse
63 button releases. */
64extern int (*mouse_tracking_enable_hook) ( /* int ENABLE */ );
65
0f79a4ae
JB
66/* When a screen's focus redirection is changed, this hook tells the
67 window system code to re-decide where to put the highlight. Under
68 X, this means that the system lies about where the focus is. */
69extern void (*screen_rehighlight_hook) ( /* void */ );
62c07cc7 70
80856e74
JB
71/* If nonzero, send all terminal output characters to this stream also. */
72
73extern FILE *termscript;
74
75#ifdef XINT
76/* Expedient hack: only provide the below definitions to files that
77 are prepared to handle lispy things. XINT is defined iff lisp.h
78 has been included in the file before this file. */
79
80/* The keyboard input buffer is an array of these structures. Each one
81 represents some sort of input event - a keystroke, a mouse click, or
82 a window system event. These get turned into their lispy forms when
83 they are removed from the event queue. */
84
85struct input_event {
86
87 /* What kind of event was this? */
88 enum {
89 no_event, /* nothing happened. This should never
90 actually appear in the event queue. */
62c07cc7
JB
91 ascii_keystroke, /* The ASCII code is in .code.
92 .screen is the screen in which the key
93 was typed.
94 Note that this includes meta-keys, and
95 the modifiers field of the event
96 is unused. */
97
80856e74
JB
98 non_ascii_keystroke, /* .code is a number identifying the
99 function key. A code N represents
100 a key whose name is
101 function_key_names[N]; function_key_names
102 is a table in keyboard.c to which you
103 should feel free to add missing keys.
104 .modifiers holds the state of the
62c07cc7
JB
105 modifier keys.
106 .screen is the screen in which the key
107 was typed. */
80856e74
JB
108 mouse_click, /* The button number is in .code.
109 .modifiers holds the state of the
110 modifier keys.
111 .x and .y give the mouse position,
112 in pixels, within the window.
113 .screen gives the screen the mouse
114 click occurred in.
115 .timestamp gives a timestamp (in
116 milliseconds) for the click. */
117 scrollbar_click, /* .code gives the number of the mouse
118 button that was clicked.
119 .part is a lisp symbol indicating which
120 part of the scrollbar got clicked. This
121 indicates whether the scroll bar was
122 horizontal or vertical.
123 .modifiers gives the state of the
124 modifier keys.
125 .x gives the distance from the start
126 of the scroll bar of the click; .y gives
127 the total length of the scroll bar.
128 .screen gives the screen the click
129 should apply to.
130 .timestamp gives a timestamp (in
131 milliseconds) for the click. */
62c07cc7 132#if 0
80856e74
JB
133 screen_selected, /* The user has moved the focus to another
134 screen.
135 .screen is the screen that should become
136 selected at the next convenient time. */
62c07cc7 137#endif
80856e74
JB
138 } kind;
139
140 Lisp_Object code;
141 Lisp_Object part;
142 struct screen *screen;
143 int modifiers; /* See enum below for interpretation. */
144 Lisp_Object x, y;
145 Lisp_Object timestamp;
146};
147
148/* Bits in the modifiers member of the input_event structure. */
149enum {
150 shift_modifier = 1,
151 ctrl_modifier = 2,
152 meta_modifier = 4,
153 up_modifier = 8, /* This only applies to mouse buttons. */
154 last_modifier /* This should always be one more than the
155 highest modifier bit defined. */
156};
157
158#define NUM_MODIFIER_COMBOS ((last_modifier-1) << 1)
159
160#endif