Mercurial > emacs
annotate src/termhooks.h @ 1517:72b7bbcaf7d8
* keymap.c (Fdefine_key, Flookup_key, describe_map): Don't assume
that Flength returns an integer.
* keymap.c: Deal with autoloaded keymaps properly.
(get_keymap_1): Renamed to inner_get_keymap; made
static. New argument AUTOLOAD says to pursue autoloads if
non-zero.
(Fkeymapp, get_keymap, get_keyelt, Flookup_key): Ask get_keymap_1
not to perform autoloads.
(Fdefine_key): Ask get_keymap_1 to perform autoloads. Since
autoloading may GC, remember that we have to GCPRO our local
variables now.
(Fminor_mode_key_binding): Call get_keymap instead of calling
get_keymap_1 with equivalent arguments.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sat, 31 Oct 1992 05:24:47 +0000 |
parents | 20862b54b932 |
children | aa7d6d57504b |
rev | line source |
---|---|
296 | 1 /* Hooks by which low level terminal operations |
2 can be made to call other routines. | |
648 | 3 Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. |
296 | 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 | |
648 | 9 the Free Software Foundation; either version 2, or (at your option) |
296 | 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) (); | |
766 | 26 extern int (*clear_frame_hook) (); |
296 | 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 | |
485 | 48 /* Return the current position of the mouse. This should clear |
49 mouse_moved until the next motion event arrives. */ | |
766 | 50 extern void (*mouse_position_hook) ( /* FRAME_PTR *f, |
485 | 51 Lisp_Object *x, |
52 Lisp_Object *y, | |
732 | 53 unsigned long *time */ ); |
296 | 54 |
485 | 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. */ | |
58 extern int mouse_moved; | |
296 | 59 |
766 | 60 /* When a frame's focus redirection is changed, this hook tells the |
357 | 61 window system code to re-decide where to put the highlight. Under |
485 | 62 X, this means that Emacs lies about where the focus is. */ |
766 | 63 extern void (*frame_rehighlight_hook) ( /* void */ ); |
338 | 64 |
296 | 65 /* If nonzero, send all terminal output characters to this stream also. */ |
66 extern FILE *termscript; | |
67 | |
68 /* Expedient hack: only provide the below definitions to files that | |
69 are prepared to handle lispy things. XINT is defined iff lisp.h | |
485 | 70 has been included before this file. */ |
71 #ifdef XINT | |
296 | 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 | |
78 struct 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. */ | |
338 | 84 ascii_keystroke, /* The ASCII code is in .code. |
766 | 85 .frame is the frame in which the key |
338 | 86 was typed. |
87 Note that this includes meta-keys, and | |
88 the modifiers field of the event | |
485 | 89 is unused. |
90 .timestamp gives a timestamp (in | |
91 milliseconds) for the keystroke. */ | |
296 | 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 | |
338 | 99 modifier keys. |
766 | 100 .frame is the frame in which the key |
485 | 101 was typed. |
102 .timestamp gives a timestamp (in | |
103 milliseconds) for the keystroke. */ | |
1312
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
104 mouse_click, /* The button number is in .code; it must |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
105 be >= 0 and < NUM_MOUSE_BUTTONS, defined |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
106 below. |
296 | 107 .modifiers holds the state of the |
108 modifier keys. | |
109 .x and .y give the mouse position, | |
708 | 110 in characters, within the window. |
766 | 111 .frame gives the frame the mouse |
296 | 112 click occurred in. |
113 .timestamp gives a timestamp (in | |
114 milliseconds) for the click. */ | |
115 scrollbar_click, /* .code gives the number of the mouse | |
116 button that was clicked. | |
117 .part is a lisp symbol indicating which | |
118 part of the scrollbar got clicked. This | |
119 indicates whether the scroll bar was | |
120 horizontal or vertical. | |
121 .modifiers gives the state of the | |
122 modifier keys. | |
123 .x gives the distance from the start | |
124 of the scroll bar of the click; .y gives | |
125 the total length of the scroll bar. | |
766 | 126 .frame gives the frame the click |
296 | 127 should apply to. |
128 .timestamp gives a timestamp (in | |
129 milliseconds) for the click. */ | |
338 | 130 #if 0 |
766 | 131 frame_selected, /* The user has moved the focus to another |
132 frame. | |
133 .frame is the frame that should become | |
296 | 134 selected at the next convenient time. */ |
338 | 135 #endif |
296 | 136 } kind; |
137 | |
138 Lisp_Object code; | |
139 Lisp_Object part; | |
732 | 140 |
141 /* This is obviously wrong, but I'm not sure what else I should do. | |
766 | 142 Obviously, this should be a FRAME_PTR. But that would require that |
143 every file which #includes this one should also #include "frame.h", | |
732 | 144 which would mean that files like cm.c and other innocents would be |
766 | 145 dragged into the set of frame.h users. Maybe the definition of this |
732 | 146 structure should be elsewhere? In its own file? */ |
766 | 147 #ifdef MULTI_FRAME |
148 struct frame *frame; | |
732 | 149 #else |
766 | 150 int frame; |
732 | 151 #endif |
296 | 152 int modifiers; /* See enum below for interpretation. */ |
732 | 153 |
296 | 154 Lisp_Object x, y; |
648 | 155 unsigned long timestamp; |
296 | 156 }; |
157 | |
1312
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
158 /* This is used in keyboard.c, to tell how many buttons we will need |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
159 to track the positions of. */ |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
160 #define NUM_MOUSE_BUTTONS (5) |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
161 |
1238
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
162 /* Bits in the modifiers member of the input_event structure. |
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
163 Note that reorder_modifiers assumes that the bits are in canonical |
1312
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
164 order. |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
165 |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
166 The modifiers applied to mouse clicks are rather ornate. The |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
167 window-system-specific code should store mouse clicks with |
1319 | 168 up_modifier or down_modifier set. Having an explicit down modifier |
169 simplifies some of window-system-independent code; without it, the | |
170 code would have to recognize down events by checking if the event | |
171 is a mouse click lacking the click and drag modifiers. | |
172 | |
173 The window-system independent code turns all up_modifier events | |
174 bits into either drag_modifier or click_modifier events. The | |
175 click_modifier has no written representation in the names of the | |
176 symbols used as event heads, but it does appear in the | |
177 Qevent_symbol_components property of the event heads. */ | |
296 | 178 enum { |
1312
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
179 up_modifier = 1, /* Only used on mouse buttons - always |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
180 turned into a click or a drag modifier |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
181 before lisp code sees the event. */ |
1238
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
182 alt_modifier = 2, /* Under X, the XK_Alt_[LR] keysyms. */ |
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
183 ctrl_modifier = 4, |
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
184 hyper_modifier= 8, /* Under X, the XK_Hyper_[LR] keysyms. */ |
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
185 meta_modifier = 16, /* Under X, the XK_Meta_[LR] keysyms. */ |
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
186 shift_modifier= 32, |
407100cee78a
* termhooks.h (alt_modifier, hyper_modifier, super_modifier,
Jim Blandy <jimb@redhat.com>
parents:
766
diff
changeset
|
187 super_modifier= 64, /* Under X, the XK_Super_[LR] keysyms. */ |
1312
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
188 down_modifier = 128, /* Only used on mouse buttons. */ |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
189 drag_modifier = 256, /* This is never used in the event |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
190 queue; it's only used internally by |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
191 the window-system-independent code. */ |
540110352c0d
* termhooks.h (struct input_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1238
diff
changeset
|
192 click_modifier= 512, /* See drag_modifier. */ |
296 | 193 last_modifier /* This should always be one more than the |
194 highest modifier bit defined. */ | |
195 }; | |
196 | |
197 #endif |