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