(menu-bar-update-yank-menu): If string is too long,
[bpt/emacs.git] / src / keyboard.h
1 /* Declarations useful when processing input.
2 Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* Total number of times read_char has returned. */
21 extern int num_input_chars;
22
23 /* Total number of times read_char has returned, outside of macros. */
24 extern int num_nonmacro_input_chars;
25
26 /* Nonzero means polling for input is temporarily suppressed. */
27 extern int poll_suppress_count;
28
29 /* Nonzero if polling_for_input is actually being used. */
30 extern int polling_for_input;
31
32 /* Keymap mapping ASCII function key sequences onto their preferred forms.
33 Initialized by the terminal-specific lisp files. */
34 extern Lisp_Object Vfunction_key_map;
35
36 /* Vector holding the key sequence that invoked the current command.
37 It is reused for each command, and it may be longer than the current
38 sequence; this_command_key_count indicates how many elements
39 actually mean something. */
40 extern Lisp_Object this_command_keys;
41 extern int this_command_key_count;
42
43 #ifdef MULTI_FRAME
44 /* The frame in which the last input event occurred, or Qmacro if the
45 last event came from a macro. We use this to determine when to
46 generate switch-frame events. This may be cleared by functions
47 like Fselect_frame, to make sure that a switch-frame event is
48 generated by the next character. */
49 extern Lisp_Object internal_last_event_frame;
50 #endif
51
52 \f
53 /* Macros for dealing with lispy events. */
54
55 /* True iff EVENT has data fields describing it (i.e. a mouse click). */
56 #define EVENT_HAS_PARAMETERS(event) (CONSP (event))
57
58 /* Extract the head from an event.
59 This works on composite and simple events. */
60 #define EVENT_HEAD(event) \
61 (EVENT_HAS_PARAMETERS (event) ? XCONS (event)->car : (event))
62
63 /* Extract the starting and ending positions from a composite event. */
64 #define EVENT_START(event) (XCONS (XCONS (event)->cdr)->car)
65 #define EVENT_END(event) (XCONS (XCONS (XCONS (event)->cdr)->cdr)->car)
66
67 /* Extract the click count from a multi-click event. */
68 #define EVENT_CLICK_COUNT(event) (Fnth ((event), make_number (2)))
69
70 /* Extract the fields of a position. */
71 #define POSN_WINDOW(posn) (XCONS (posn)->car)
72 #define POSN_BUFFER_POSN(posn) (XCONS (XCONS (posn)->cdr)->car)
73 #define POSN_WINDOW_POSN(posn) (XCONS (XCONS (XCONS (posn)->cdr)->cdr)->car)
74 #define POSN_TIMESTAMP(posn) \
75 (XCONS (XCONS (XCONS (XCONS (posn)->cdr)->cdr)->cdr)->car)
76 #define POSN_SCROLLBAR_PART(posn) (Fnth ((posn), make_number (4)))
77
78 /* Some of the event heads. */
79 extern Lisp_Object Qswitch_frame;
80
81 /* Properties on event heads. */
82 extern Lisp_Object Qevent_kind, Qevent_symbol_elements;
83
84 /* Getting an unmodified version of an event head. */
85 #define EVENT_HEAD_UNMODIFIED(event_head) \
86 (Fcar (Fget ((event_head), Qevent_symbol_elements)))
87
88 /* The values of Qevent_kind properties. */
89 extern Lisp_Object Qfunction_key, Qmouse_click, Qmouse_movement;
90 extern Lisp_Object Qscroll_bar_movement;
91
92 /* Getting the kind of an event head. */
93 #define EVENT_HEAD_KIND(event_head) \
94 (Fget ((event_head), Qevent_kind))
95
96 /* Symbols to use for non-text mouse positions. */
97 extern Lisp_Object Qmode_line, Qvertical_line;
98
99 extern Lisp_Object get_keymap_1 ();
100 extern Lisp_Object Fkeymapp ();
101 extern Lisp_Object reorder_modifiers ();
102 extern Lisp_Object read_char ();
103 /* User-supplied string to translate input characters through. */
104 extern Lisp_Object Vkeyboard_translate_table;
105
106 extern Lisp_Object map_prompt ();