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